Додані повідомлення та перепрацьована структура застосунку та api

This commit is contained in:
2026-03-15 00:25:10 +02:00
parent 85483b85bb
commit 4bc9c11512
101 changed files with 5763 additions and 2546 deletions

View File

@@ -1,4 +1,4 @@
const STATIC_CACHE_NAME = 'v2.0.103';
const STATIC_CACHE_NAME = 'v2.2.1';
const FILES_TO_CACHE = [
'/',
@@ -7,7 +7,12 @@ const FILES_TO_CACHE = [
"/lib/router/router.js",
"/lib/router/routes.js",
"/lib/customElements/notification.js",
"/lib/customElements/notifManager.js",
"/lib/customElements/pwaInstallBanner.js",
"/lib/customElements/swipeUpdater.js",
"/lib/customElements/menuContainer.js",
"/lib/customElements/territoryCard.js",
"/lib/customElements/smartSelect.js",
"/lib/components/leaflet/leaflet.css",
"/lib/components/leaflet/leaflet.js",
@@ -19,12 +24,9 @@ const FILES_TO_CACHE = [
"/lib/components/cloud.js",
"/lib/components/metrics.js",
"/lib/components/clipboard.js",
"/lib/components/colorGroup.js",
"/lib/components/makeid.js",
"/lib/components/swipeUpdater.js",
"/lib/components/detectBrowser.js",
"/lib/components/detectOS.js",
"/lib/components/formattedDate.js",
@@ -141,7 +143,7 @@ self.addEventListener("push", event => {
try { data = event.data.json(); } catch { data = { title: "Повідомлення", body: event.data?.text() }; }
console.log('[ServiceWorker] ', data);
const title = data.title || "Повідомлення";
const options = {
@@ -157,7 +159,7 @@ self.addEventListener("push", event => {
self.addEventListener("notificationclick", event => {
event.notification.close();
event.waitUntil(
clients.matchAll({ type: "window", includeUncontrolled: true }).then(clientList => {
clients.matchAll({ type: "window", includeUncontrolled: true }).then(clientList => {
for (const client of clientList) {
if (client.url === event.notification.data && "focus" in client) return client.focus();
}