Improves app stability, delays JS calls past page load

This commit is contained in:
jahorton 2019-09-25 14:38:42 +07:00
parent e1891b56d2
commit 7b7c93aed4
3 changed files with 16 additions and 2 deletions

View file

@ -207,7 +207,9 @@ final class KMKeyboard extends WebView {
if((keyboardType == KeyboardType.KEYBOARD_TYPE_INAPP && KMManager.InAppKeyboardLoaded) ||
(keyboardType == KeyboardType.KEYBOARD_TYPE_SYSTEM && KMManager.SystemKeyboardLoaded)) {
if(this.javascriptAfterLoad.size() == 1)
// If !this.keyboardSet, then pageLoaded hasn't fired yet.
// When pageLoaded fires, it'll call `callJavascriptAfterLoad` safely.
if(this.javascriptAfterLoad.size() == 1 && this.keyboardSet)
callJavascriptAfterLoad();
}
}

View file

@ -592,7 +592,16 @@ namespace com.keyman.osk {
// Build a layout using the default for the device
if(typeof layout != 'object' || layout == null) {
let kbdDevVersion = new utils.Version(activeKeyboard['KVER']);
var kbdDevVersion: utils.Version;
// This CAN be called with no backing keyboard; KMW will try to force-show
// the OSK even without a backing keyboard on mobile, using the default
// layout as the OSK's base.
if(activeKeyboard) {
kbdDevVersion = new utils.Version(activeKeyboard['KVER']);
} else {
kbdDevVersion = utils.Version.CURRENT;
}
layout=Layouts.buildDefaultLayout(PVK, kbdDevVersion, kbdBitmask, formFactor);
}

View file

@ -9,6 +9,9 @@ namespace com.keyman.utils {
// as it results in unexpected, bug-like behavior for keyboard designers when it is unwanted.
public static readonly NO_DEFAULT_KEYCAPS = new Version([12, 0]);
// Corresponds to the most recent known version of KMW and Keyman Developer.
public static readonly CURRENT = new Version([12, 0]);
private readonly components: number[]
/**