summaryrefslogtreecommitdiff
path: root/app/views/pwa
diff options
context:
space:
mode:
authorMarius Peter <marius.peter@tutanota.com>2024-11-11 16:55:14 +0100
committerMarius Peter <marius.peter@tutanota.com>2024-11-11 16:55:14 +0100
commitfea9476a591559bd8fdcf17b64e5114c592a5b08 (patch)
tree08aa0fdd62752f1d286aa66ac77413fb03d6d737 /app/views/pwa
C'est l'heure d'assurer le suivi de quelques flacons!main
Diffstat (limited to 'app/views/pwa')
-rw-r--r--app/views/pwa/manifest.json.erb22
-rw-r--r--app/views/pwa/service-worker.js26
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)
+// }
+// })
+// )
+// })
Copyright 2019--2024 Marius PETER