From 975147d5b3c1397512460d96e81e9d7f9299f6cf Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 25 Jul 2024 12:04:35 +0700 Subject: [PATCH 1/7] chore(web): Revert "chore(android): restores try-catch, now with console.error err forwarding" This reverts commit d705589726a1fb553e7a8b4daf8b92617fc4a67d. --- android/KMEA/app/src/main/assets/android-host.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/android/KMEA/app/src/main/assets/android-host.js b/android/KMEA/app/src/main/assets/android-host.js index 05f33f71e8d..9c786e17770 100644 --- a/android/KMEA/app/src/main/assets/android-host.js +++ b/android/KMEA/app/src/main/assets/android-host.js @@ -37,11 +37,7 @@ function init() { keyman.beepKeyboard = beepKeyboard; // Readies the keyboard stub for instant loading during the init process. - try { - KeymanWeb.registerStub(JSON.parse(jsInterface.initialKeyboard())); - } catch(error) { - console.error(error); - } + KeymanWeb.registerStub(JSON.parse(jsInterface.initialKeyboard())); keyman.init({ 'embeddingApp':device, From 9370bd4f6c086ab7ab77d0409902a4fd220fdf74 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 25 Jul 2024 12:04:38 +0700 Subject: [PATCH 2/7] chore(web): Revert "chore(android): reverts error-silencing try-catch" This reverts commit db4a7bfcd0958c843dbceb53ab33447098213e16. --- android/KMEA/app/src/main/assets/android-host.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/android/KMEA/app/src/main/assets/android-host.js b/android/KMEA/app/src/main/assets/android-host.js index 9c786e17770..a38eaf68259 100644 --- a/android/KMEA/app/src/main/assets/android-host.js +++ b/android/KMEA/app/src/main/assets/android-host.js @@ -37,7 +37,9 @@ function init() { keyman.beepKeyboard = beepKeyboard; // Readies the keyboard stub for instant loading during the init process. - KeymanWeb.registerStub(JSON.parse(jsInterface.initialKeyboard())); + try { + KeymanWeb.registerStub(JSON.parse(jsInterface.initialKeyboard())); + } catch {}; keyman.init({ 'embeddingApp':device, From b6442912112fdd2807a3720d55049797a52c3a98 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 25 Jul 2024 12:04:40 +0700 Subject: [PATCH 3/7] chore(web): Revert "fix(web): OSK now checks pred-text state on init" This reverts commit 7466b82893859acafe8c529d099944627c70c150. --- .../src/text/prediction/predictionContext.ts | 4 ---- web/src/engine/main/src/keymanEngine.ts | 2 -- web/src/engine/osk/src/views/oskView.ts | 7 ------- 3 files changed, 13 deletions(-) diff --git a/common/web/input-processor/src/text/prediction/predictionContext.ts b/common/web/input-processor/src/text/prediction/predictionContext.ts index def3dfa7c04..eebccb0fe3e 100644 --- a/common/web/input-processor/src/text/prediction/predictionContext.ts +++ b/common/web/input-processor/src/text/prediction/predictionContext.ts @@ -105,10 +105,6 @@ export default class PredictionContext extends EventEmitter Date: Thu, 25 Jul 2024 12:04:42 +0700 Subject: [PATCH 4/7] chore(web): Revert "fix(ios): ios-host adjustments" This reverts commit 829d40f5f35d6f4230b172409682f314d14c2b9b. --- .../resources/Keyman.bundle/Contents/Resources/ios-host.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ios/engine/KMEI/KeymanEngine/resources/Keyman.bundle/Contents/Resources/ios-host.js b/ios/engine/KMEI/KeymanEngine/resources/Keyman.bundle/Contents/Resources/ios-host.js index 93730c72ff4..bd323b970b4 100644 --- a/ios/engine/KMEI/KeymanEngine/resources/Keyman.bundle/Contents/Resources/ios-host.js +++ b/ios/engine/KMEI/KeymanEngine/resources/Keyman.bundle/Contents/Resources/ios-host.js @@ -131,10 +131,8 @@ function getOskWidth() { function getOskHeight() { var height = oskHeight; - if(keyman.osk && keyman.osk.banner._activeType != 'blank') { + if(keyman.osk.banner._activeType != 'blank') { height = height - keyman.osk.banner.height; - } else { - height = height - (bannerHeight ? bannerHeight : 0); } return height; } From 752a2e179ccca134d25aa4c768de286f497cf722 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 25 Jul 2024 12:06:15 +0700 Subject: [PATCH 5/7] chore(web): Revert "fix(web): adds newly-needed null guards due to new pattern" This reverts commit 786c48074249dd457145cc4ed670ee8e8c0c4804. --- web/src/engine/osk/src/views/floatingOskView.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/web/src/engine/osk/src/views/floatingOskView.ts b/web/src/engine/osk/src/views/floatingOskView.ts index fb172b5f649..44c18298b02 100644 --- a/web/src/engine/osk/src/views/floatingOskView.ts +++ b/web/src/engine/osk/src/views/floatingOskView.ts @@ -31,7 +31,7 @@ export default class FloatingOSKView extends OSKView { dfltX: string; dfltY: string; - private layoutSerializer = new FloatingOSKCookieSerializer(); + layoutSerializer = new FloatingOSKCookieSerializer(); private titleBar: TitleBar; private resizeBar: ResizeBar; @@ -233,15 +233,6 @@ export default class FloatingOSKView extends OSKView { * @return {boolean} */ private loadPersistedLayout(): void { - /* - If a keyboard is available during OSK construction, it is possible - for this field to be `undefined`. `loadPersistedLayout` will be called - later in construction, so it's safe to skip. - */ - if(!this.layoutSerializer) { - return; - } - let c = this.layoutSerializer.loadWithDefaults({ visible: 1, userSet: 0, From f1619f23671fa6ac6539d8afba1e46e21d5d3c2d Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 25 Jul 2024 12:07:56 +0700 Subject: [PATCH 6/7] chore(web): Revert "fix(web): OSK set activeKeyboard should not bypass during init" This reverts commit eebf3e5ba80c735cbc5aa629482d353b5e82385a. --- web/src/engine/osk/src/views/oskView.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/web/src/engine/osk/src/views/oskView.ts b/web/src/engine/osk/src/views/oskView.ts index 1fce9f557ef..6163b8ba774 100644 --- a/web/src/engine/osk/src/views/oskView.ts +++ b/web/src/engine/osk/src/views/oskView.ts @@ -201,7 +201,6 @@ export default abstract class OSKView private _baseFontSize: ParsedLengthStyle; private needsLayout: boolean = true; - private initialized: boolean; private _animatedHideTimeout: number; @@ -258,9 +257,6 @@ export default abstract class OSKView if(this.hostDevice.touchable) { this.setBaseTouchEventListeners(); } - - this._Box.style.display = 'none'; - this.initialized = true; } protected get configuration(): Configuration { @@ -550,7 +546,7 @@ export default abstract class OSKView // // Note: ensures that the _instances_ are the same; it's possible to make new instances // to force a refresh. Does not perform a deep-equals. - if(this.initialized && this.keyboardData?.keyboard == keyboardData?.keyboard && this.keyboardData?.metadata == keyboardData?.metadata) { + if(this.keyboardData?.keyboard == keyboardData?.keyboard && this.keyboardData?.metadata == keyboardData?.metadata) { return; } this.keyboardData = keyboardData; From 8c87b5516a203cbafd9af243fb7350e82e1321d0 Mon Sep 17 00:00:00 2001 From: "Joshua A. Horton" Date: Thu, 25 Jul 2024 12:08:32 +0700 Subject: [PATCH 7/7] chore(web): Revert "change(web): initializes OSK with keyboard if available during init" This reverts commit 4b1394a54f8dfbe3e35e7b8cb08d0cbeaf3ed9d9. --- .../KMEA/app/src/main/assets/android-host.js | 4 +- web/src/app/browser/src/contextManager.ts | 4 +- web/src/app/browser/src/keymanEngine.ts | 44 +++++++------------ web/src/app/browser/src/viewsAnchorpoint.ts | 6 +-- web/src/app/webview/src/keymanEngine.ts | 37 +++------------- .../osk/src/config/viewConfiguration.ts | 9 ---- web/src/engine/osk/src/views/oskView.ts | 11 +---- 7 files changed, 29 insertions(+), 86 deletions(-) diff --git a/android/KMEA/app/src/main/assets/android-host.js b/android/KMEA/app/src/main/assets/android-host.js index a38eaf68259..9c786e17770 100644 --- a/android/KMEA/app/src/main/assets/android-host.js +++ b/android/KMEA/app/src/main/assets/android-host.js @@ -37,9 +37,7 @@ function init() { keyman.beepKeyboard = beepKeyboard; // Readies the keyboard stub for instant loading during the init process. - try { - KeymanWeb.registerStub(JSON.parse(jsInterface.initialKeyboard())); - } catch {}; + KeymanWeb.registerStub(JSON.parse(jsInterface.initialKeyboard())); keyman.init({ 'embeddingApp':device, diff --git a/web/src/app/browser/src/contextManager.ts b/web/src/app/browser/src/contextManager.ts index 756c83afecc..a6cf6850e2b 100644 --- a/web/src/app/browser/src/contextManager.ts +++ b/web/src/app/browser/src/contextManager.ts @@ -818,9 +818,7 @@ export default class ContextManager extends ContextManagerBase = this.contextManager.restoreSavedKeyboard(savedKeyboardStr); - - // Wait for the initial keyboard to load before setting the OSK; this will avoid building an - // empty OSK that we'll instantly discard after. - try { - await loadingKbd; - } catch { /* in case of failed fetch due to network error or bad URI; we must still let the OSK init. */ }; - - const firstKbdConfig = { - keyboardToActivate: this.contextManager.activeKeyboard - }; - const osk = device.touchable ? new views.AnchoredOSKView(this, firstKbdConfig) : new views.FloatingOSKView(this, firstKbdConfig); + await Promise.resolve(); + + // Attempt to restore the user's last-used keyboard from their previous session. + // + // Note: any cloud stubs will probably not be available yet. + // If we tracked cloud requests and awaited a Promise.all on pending queries, + // we could handle that too. + this.contextManager.restoreSavedKeyboard(savedKeyboardStr); - setupOskListeners(this, osk, this.contextManager); - // And, now that we have our loaded active keyboard - or failed, thus must use that default... - // Now we set the OSK in place, an act which triggers VisualKeyboard construction. - this.osk = osk; + await Promise.resolve(); } get register(): (x: CloudQueryResult) => void { diff --git a/web/src/app/browser/src/viewsAnchorpoint.ts b/web/src/app/browser/src/viewsAnchorpoint.ts index 3bc6064dbfa..3df908c402e 100644 --- a/web/src/app/browser/src/viewsAnchorpoint.ts +++ b/web/src/app/browser/src/viewsAnchorpoint.ts @@ -17,7 +17,7 @@ function buildBaseOskConfiguration(engine: KeymanEngine) { }; class PublishedAnchoredOSKView extends AnchoredOSKView { - constructor(engine: KeymanEngine, config?: Partial) { + constructor(engine: KeymanEngine, config?: ViewConfiguration) { let finalConfig = { ...buildBaseOskConfiguration(engine), ...(config || {}) @@ -28,7 +28,7 @@ class PublishedAnchoredOSKView extends AnchoredOSKView { } class PublishedFloatingOSKView extends FloatingOSKView { - constructor(engine: KeymanEngine, config?: Partial) { + constructor(engine: KeymanEngine, config?: FloatingOSKViewConfiguration) { let finalConfig: FloatingOSKViewConfiguration = { ...buildBaseOskConfiguration(engine), ...(config || {}) @@ -39,7 +39,7 @@ class PublishedFloatingOSKView extends FloatingOSKView { } class PublishedInlineOSKView extends InlinedOSKView { - constructor(engine: KeymanEngine, config?: Partial) { + constructor(engine: KeymanEngine, config?: ViewConfiguration) { let finalConfig: ViewConfiguration = { ...buildBaseOskConfiguration(engine), ...(config || {}) diff --git a/web/src/app/webview/src/keymanEngine.ts b/web/src/app/webview/src/keymanEngine.ts index f9095aa0222..81704534c62 100644 --- a/web/src/app/webview/src/keymanEngine.ts +++ b/web/src/app/webview/src/keymanEngine.ts @@ -1,4 +1,4 @@ -import { DefaultRules, DeviceSpec, RuleBehavior, isEmptyTransform, Keyboard } from '@keymanapp/keyboard-processor' +import { DefaultRules, DeviceSpec, RuleBehavior } from '@keymanapp/keyboard-processor' import { KeymanEngine as KeymanEngineBase, KeyboardInterface } from 'keyman/engine/main'; import { AnchoredOSKView, ViewConfiguration, StaticActivator } from 'keyman/engine/osk'; import { getAbsoluteX, getAbsoluteY } from 'keyman/engine/dom-utils'; @@ -71,32 +71,7 @@ export default class KeymanEngine extends KeymanEngineBase