fix: resolve application startup freeze on older Android WebViews and improve splash screen behavior - #309
Open
rmsalinas wants to merge 1 commit into
Open
Conversation
…h screen dismissal - Add polyfills for globalThis, Array.prototype.flat, Array.prototype.flatMap, and Object.fromEntries in index.html and polyfills.ts for older Android WebViews (Chrome < 71). - Set TypeScript compiler target to ES2018 in tsconfig.json and update .browserslistrc to target Chrome 60+. - Move splashScreen.hide() immediately after platform.ready() in app.component.ts and enable launchAutoHide: true with a 2-second duration fallback in capacitor.config.ts.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary of Changes
This PR resolves an issue where AirGap Vault fails to load or hangs indefinitely on the splash screen when launched on Android devices with older System WebView versions (such as Chrome < 71 / Chrome 68).
🐛 Problem
globalThisis Undefined:On System WebViews prior to Chrome 71,
globalThisis not natively supported. Whenvendor.jsevaluates, dependencies throwUncaught ReferenceError: globalThis is not defined, preventing Angular from bootstrapping.Array.prototype.flat/flatMap:Third-party libraries (such as
@ngrx/effects) rely onArray.prototype.flat, which was introduced in Chrome 69. On Chrome 68, this threwUncaught TypeError: rootEffects.flat is not a function.?./??):tsconfig.jsontargetedES2022, emitting modern optional chaining (?.) and nullish coalescing (??) syntax. Chrome 68 failed to parse these syntax tokens, throwingUncaught SyntaxError: Unexpected token ?.In
app.component.ts,splashScreen.hide()was executed afterPromise.all([this.initializeTranslations(), this.initializeProtocols()]). If protocol initialization stalled or took time, the splash screen remained visible continuously due tolaunchAutoHide: falseincapacitor.config.ts.🛠️ Solution
globalThis,Array.prototype.flat,Array.prototype.flatMap, andObject.fromEntriesinsrc/index.html(inline head script) andsrc/polyfills.ts.ES2018intsconfig.jsonand updated.browserslistrcto targetChromeAndroid >=60to ensure syntax downleveling.splashScreen.hide()immediately afterplatform.ready()inapp.component.tsand enabledlaunchAutoHide: truewith a 2-second fallback incapacitor.config.ts.🧪 Verification
npm run build,npx cap copy android,./gradlew assembleDebug).adb logcatthat all JS syntax/type errors are resolved and Angular bootstraps successfully.