improve PWA feel on iOS: offline fallback, overscroll, tap feedback, dark status bar, apple touch icon
Add offline.html served by the service worker when a never-visited route is requested without network. Disable rubber-band overscroll bounce and gray tap highlights so standalone mode feels less like a webview. Split theme-color by prefers-color-scheme so the iOS status bar matches dark mode, and add a proper 180x180 apple-touch-icon instead of downscaling the 192px icon.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const CACHE_NAME = "habit-tracker-v3";
|
||||
const CACHE_NAME = "habit-tracker-v4";
|
||||
const APP_SHELL = [
|
||||
"/static/css/style.css",
|
||||
"/static/js/app.js",
|
||||
@@ -9,7 +9,9 @@ const APP_SHELL = [
|
||||
"/static/js/vendor/sortable.min.js",
|
||||
"/static/icons/icon-192.png",
|
||||
"/static/icons/icon-512.png",
|
||||
"/static/icons/icon-apple-180.png",
|
||||
"/static/manifest.json",
|
||||
"/static/offline.html",
|
||||
];
|
||||
|
||||
self.addEventListener("install", (event) => {
|
||||
@@ -50,7 +52,7 @@ self.addEventListener("fetch", (event) => {
|
||||
}
|
||||
return response;
|
||||
})
|
||||
.catch(() => caches.match(request))
|
||||
.catch(() => caches.match(request).then((cached) => cached || caches.match("/static/offline.html")))
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user