diff options
Diffstat (limited to 'app/views/pwa')
| -rw-r--r-- | app/views/pwa/manifest.json.erb | 22 | ||||
| -rw-r--r-- | app/views/pwa/service-worker.js | 26 | 
2 files changed, 48 insertions, 0 deletions
| diff --git a/app/views/pwa/manifest.json.erb b/app/views/pwa/manifest.json.erb new file mode 100644 index 0000000..7a1a68b --- /dev/null +++ b/app/views/pwa/manifest.json.erb @@ -0,0 +1,22 @@ +{ +  "name": "Flacon", +  "icons": [ +    { +      "src": "/icon.png", +      "type": "image/png", +      "sizes": "512x512" +    }, +    { +      "src": "/icon.png", +      "type": "image/png", +      "sizes": "512x512", +      "purpose": "maskable" +    } +  ], +  "start_url": "/", +  "display": "standalone", +  "scope": "/", +  "description": "Flacon.", +  "theme_color": "red", +  "background_color": "red" +} diff --git a/app/views/pwa/service-worker.js b/app/views/pwa/service-worker.js new file mode 100644 index 0000000..b3a13fb --- /dev/null +++ b/app/views/pwa/service-worker.js @@ -0,0 +1,26 @@ +// Add a service worker for processing Web Push notifications: +// +// self.addEventListener("push", async (event) => { +//   const { title, options } = await event.data.json() +//   event.waitUntil(self.registration.showNotification(title, options)) +// }) +// +// self.addEventListener("notificationclick", function(event) { +//   event.notification.close() +//   event.waitUntil( +//     clients.matchAll({ type: "window" }).then((clientList) => { +//       for (let i = 0; i < clientList.length; i++) { +//         let client = clientList[i] +//         let clientPath = (new URL(client.url)).pathname +// +//         if (clientPath == event.notification.data.path && "focus" in client) { +//           return client.focus() +//         } +//       } +// +//       if (clients.openWindow) { +//         return clients.openWindow(event.notification.data.path) +//       } +//     }) +//   ) +// }) | 
