fix: prevent install prompt showing in installed PWA

- Improve installation status detection logic
- Add proper DOM cleanup when PWA is installed
- Enhance monitoring for installation state changes
- Fix shouldShowPrompt() logic to always check current status
- Add forceInstallationCheck() method for manual status updates
This commit is contained in:
lockbitchat
2025-08-24 17:04:01 -04:00
parent 171a7d9dfb
commit 26ba6eebb9
2 changed files with 168 additions and 84 deletions

9
sw.js
View File

@@ -57,6 +57,15 @@ const CACHE_FIRST_PATTERNS = [
/logo/
];
self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'PWA_INSTALLED') {
self.clients.matchAll().then(clients => {
clients.forEach(client => {
client.postMessage({ type: 'PWA_INSTALL_DETECTED' });
});
});
}
});
// Install event - cache static assets with better error handling
self.addEventListener('install', (event) => {
console.log('🔧 Service Worker installing...');