From 75964b00770fe90eb3f308dbeeae8f782c8cec5f Mon Sep 17 00:00:00 2001 From: jahorton Date: Fri, 22 Apr 2022 11:30:08 -0500 Subject: [PATCH] chore(web): drops non-pred text dependence on es6-shim --- .../web/input-processor/src/tsconfig.bundled.json | 3 +-- web/bulk_rendering/tsconfig.json | 1 - web/package.json | 1 - web/source/osk/browser/pendingMultiTap.ts | 4 +++- web/source/osk/lengthStyle.ts | 13 ++++++++++++- web/source/tsconfig.embedded.json | 1 - web/source/tsconfig.json | 2 -- web/testing/commonHeader.js | 6 ++++-- 8 files changed, 20 insertions(+), 11 deletions(-) diff --git a/common/web/input-processor/src/tsconfig.bundled.json b/common/web/input-processor/src/tsconfig.bundled.json index 0b83ab3101..d16fe709fb 100644 --- a/common/web/input-processor/src/tsconfig.bundled.json +++ b/common/web/input-processor/src/tsconfig.bundled.json @@ -13,8 +13,7 @@ { "path": "../../utils", "prepend": true }, { "path": "../../keyboard-processor/src", "prepend": true }, // For headless tests, we need the headless version of the compile. - { "path": "../../../predictive-text/tsconfig.json", "prepend": true }, - { "path": "../..//es6-shim", "prepend": true } + { "path": "../../../predictive-text/tsconfig.json", "prepend": true } ], "files": [ "text/inputProcessor.ts", diff --git a/web/bulk_rendering/tsconfig.json b/web/bulk_rendering/tsconfig.json index 8b8b7770ab..a1ba9c08f7 100644 --- a/web/bulk_rendering/tsconfig.json +++ b/web/bulk_rendering/tsconfig.json @@ -19,7 +19,6 @@ "references": [ { "path": "../../common/web/utils", "prepend": true }, { "path": "../../common/web/keyman-version", "prepend": true }, - { "path": "../../common/web/es6-shim", "prepend": true }, { "path": "../../common/web/lm-message-types" }, ] } diff --git a/web/package.json b/web/package.json index 166d17f670..f66c331f50 100644 --- a/web/package.json +++ b/web/package.json @@ -58,7 +58,6 @@ "@keymanapp/keyman-version": "*", "@keymanapp/web-utils": "*", "@types/node": "^11.9.4", - "es6-shim": "^0.35.5", "eventemitter3": "^4.0.0" } } diff --git a/web/source/osk/browser/pendingMultiTap.ts b/web/source/osk/browser/pendingMultiTap.ts index 5d11ac01f8..eeb22bc213 100644 --- a/web/source/osk/browser/pendingMultiTap.ts +++ b/web/source/osk/browser/pendingMultiTap.ts @@ -52,8 +52,10 @@ namespace com.keyman.osk { } public static isValidTarget(vkbd: VisualKeyboard, baseKey: KeyElement) { + // Could use String.includes, but Chrome for Android must be version 41+. + // We support down to version 37. return ( - baseKey['keyId'].includes('K_SHIFT') && + baseKey['keyId'].indexOf('K_SHIFT') >= 0 && vkbd.layerGroup.layers['caps'] && !baseKey['subKeys'] && vkbd.touchCount == 1 diff --git a/web/source/osk/lengthStyle.ts b/web/source/osk/lengthStyle.ts index e30e17ec00..2d45dcffd9 100644 --- a/web/source/osk/lengthStyle.ts +++ b/web/source/osk/lengthStyle.ts @@ -11,7 +11,18 @@ namespace com.keyman.osk { public readonly special: 'em' | 'rem'; public constructor(style: LengthStyle | string) { - Object.assign(this, typeof style == 'string' ? ParsedLengthStyle.parseLengthStyle(style) : style); + let parsed: LengthStyle = (typeof style == 'string') ? ParsedLengthStyle.parseLengthStyle(style) : style; + + // While Object.assign would be nice (and previously, was used), it will break + // on old but still supported versions of Android if their Chrome isn't updated. + // Requires mobile Chrome 45+, but API 21 (5.0) launches with an older browser. + + // Object.assign(this, parsed); + this.val = parsed.val; + this.absolute = parsed.absolute; + if(parsed.special) { + this.special = parsed.special; + } } public get styleString(): string { diff --git a/web/source/tsconfig.embedded.json b/web/source/tsconfig.embedded.json index f8738f68ba..3744d69f43 100644 --- a/web/source/tsconfig.embedded.json +++ b/web/source/tsconfig.embedded.json @@ -32,7 +32,6 @@ { "path": "../../common/predictive-text/browser.tsconfig.json", "prepend": true }, { "path": "../../common/web/input-processor/src", "prepend": true }, { "path": "../../common/web/keyboard-processor/src", "prepend": true }, - { "path": "../../common/web/es6-shim", "prepend": true }, { "path": "../../common/web/lm-message-types" }, // sentry-manager is used by Keyman for Android and Keyman for iOS but not // directly by KeymanWeb, but it's neater to reference it here and get the diff --git a/web/source/tsconfig.json b/web/source/tsconfig.json index 8e67d579cd..a84294aa4e 100644 --- a/web/source/tsconfig.json +++ b/web/source/tsconfig.json @@ -30,10 +30,8 @@ { "path": "../../common/web/keyman-version", "prepend": true }, { "path": "../../common/web/utils", "prepend": true }, { "path": "../../common/predictive-text/browser.tsconfig.json", "prepend": true }, - //{ "path": "../../common/web/lm-worker", "prepend": true }, { "path": "../../common/web/input-processor/src", "prepend": true }, { "path": "../../common/web/keyboard-processor/src", "prepend": true }, - { "path": "../../common/web/es6-shim", "prepend": true }, { "path": "../../common/web/lm-message-types" } ] } diff --git a/web/testing/commonHeader.js b/web/testing/commonHeader.js index bd9fb4b7ce..2c644d37d1 100644 --- a/web/testing/commonHeader.js +++ b/web/testing/commonHeader.js @@ -41,9 +41,11 @@ */ function errToString(err) { + // Painful? Kinda. But needed on un-updated Android API 21! if(Array.isArray(err)) { - let result = ''; - for(let e of err) { + var result = ''; + for(var i = 0; i < err.length; i++) { + var e = err[i]; if(e.error instanceof Error) { result += e.error.message + '\n'; } else {