fix(pwa): stop repeating install prompt after dismissal and bump sw version

This commit is contained in:
Julien Maille 2025-12-23 16:12:04 +01:00 committed by Julien Maille
parent f123efabdb
commit 97a932fc0d
2 changed files with 5 additions and 2 deletions

View file

@ -545,7 +545,9 @@ document.addEventListener('DOMContentLoaded', async () => {
window.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
deferredPrompt = e;
showInstallPrompt(deferredPrompt);
if (!localStorage.getItem('installPromptDismissed')) {
showInstallPrompt(deferredPrompt);
}
});
if (!localStorage.getItem('shortcuts-shown')) {
@ -596,6 +598,7 @@ function showInstallPrompt(deferredPrompt) {
document.getElementById('dismiss-install').addEventListener('click', () => {
notification.remove();
localStorage.setItem('installPromptDismissed', 'true');
});
}

2
sw.js
View file

@ -1,5 +1,5 @@
//sw.js
const CACHE_NAME = 'monochrome-v3';
const CACHE_NAME = 'monochrome-v4';
const IMAGE_CACHE_NAME = 'monochrome-images-v1';
const urlsToCache = [
'/',