Skip to content

Commit

Permalink
Make sure splash is displayed after auto-refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaifroid committed Nov 3, 2024
1 parent 97c9389 commit 2eaa7fc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2745,9 +2745,12 @@ document.addEventListener('DOMContentLoaded', function () {
if (params.packagedFile && /medicine|wikivoyage|mdwiki/i.test(params.packagedFile)) {
noPackagedZIM.style.display = 'none';
}
// We remove splashScreenDismissed from the settingsStore to ensure that the modal is displayed after an autorefresh if user didn't consciously dismiss it
settingsStore.removeItem('splashScreenDismissed');
// On some platforms, bootstrap's jQuery functions have not been injected yet, so we have to run in a timeout
setTimeout(function () {
uiUtil.systemAlert(' ', '', false, null, null, null, 'myModal').then(function () {
settingsStore.setItem('splashScreenDismissed', true, Infinity);
// We need to delay any attempt to launch the UWP Service Worker till after the bootstrap modal is displayed
// or else app is left in an anomalous situation whereby it's not possible to exit the modal in some cases
if (appstate.launchUWPServiceWorker) {
Expand All @@ -2769,6 +2772,15 @@ document.addEventListener('DOMContentLoaded', function () {
}, 1000);
} else if (appstate.launchUWPServiceWorker) {
launchUWPServiceWorker();
} else {
if (!settingsStore.getItem('splashScreenDismissed')) {
// It looks like the user never dismissed the splash screen, so we need to display it
setTimeout(function () {
uiUtil.systemAlert(' ', '', false, null, null, null, 'myModal').then(function () {
settingsStore.setItem('splashScreenDismissed', true, Infinity);
});
}, 2000);
}
}
});

Expand Down

0 comments on commit 2eaa7fc

Please sign in to comment.