diff --git a/public/manifest.json b/public/manifest.json index e41d2d9..db0fe41 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -6,17 +6,5 @@ "display": "standalone", "background_color": "#0f172a", "theme_color": "#1e40af", - "orientation": "portrait-primary", - "icons": [ - { - "src": "/icon-192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/icon-512.png", - "sizes": "512x512", - "type": "image/png" - } - ] + "orientation": "portrait-primary" } \ No newline at end of file diff --git a/public/sw.js b/public/sw.js index c8391c4..32f0757 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,35 +1,24 @@ -const CACHE_NAME = 'steelcheck-v1'; -const ASSETS = [ - '/', - '/index.html', - '/index.tsx', - '/style.css' -]; +const CACHE_NAME = 'steelcheck-v2'; -self.addEventListener('install', (event) => { - event.waitUntil( - caches.open(CACHE_NAME).then((cache) => { - return cache.addAll(ASSETS); - }) - ); +self.addEventListener('install', (e) => { + self.skipWaiting(); }); -self.addEventListener('fetch', (event) => { - event.respondWith( - caches.match(event.request).then((response) => { - return response || fetch(event.request); - }) - ); -}); - -self.addEventListener('activate', (event) => { - event.waitUntil( +self.addEventListener('activate', (e) => { + e.waitUntil( caches.keys().then((cacheNames) => { return Promise.all( - cacheNames - .filter((name) => name !== CACHE_NAME) - .map((name) => caches.delete(name)) + cacheNames.map((cacheName) => { + return caches.delete(cacheName); + }) ); + }).then(() => { + return self.clients.claim(); }) ); -}); \ No newline at end of file +}); + +self.addEventListener('fetch', (e) => { + // Always fetch from network to avoid caching old index.html + e.respondWith(fetch(e.request)); +});