diff --git a/app/javascript/retrospring/common.ts b/app/javascript/retrospring/common.ts index 811e9a8a..a0b37013 100644 --- a/app/javascript/retrospring/common.ts +++ b/app/javascript/retrospring/common.ts @@ -1,10 +1,12 @@ import '@hotwired/turbo-rails'; import initializeBootstrap from './initializers/bootstrap'; +import initializeServiceWorker from './initializers/serviceWorker'; import initializeStimulus from './initializers/stimulus'; export default function start(): void { try { initializeBootstrap(); + initializeServiceWorker(); initializeStimulus(); } catch (e) { // initialization errors diff --git a/app/javascript/retrospring/features/webpush/enable.ts b/app/javascript/retrospring/features/webpush/enable.ts index 332a76ec..c92aed64 100644 --- a/app/javascript/retrospring/features/webpush/enable.ts +++ b/app/javascript/retrospring/features/webpush/enable.ts @@ -8,7 +8,7 @@ export function enableHandler (event: Event): void { const sender = event.target as HTMLButtonElement; try { - installServiceWorker() + getServiceWorker() .then(subscribe) .then(async subscription => { return Notification.requestPermission().then(permission => { @@ -51,8 +51,8 @@ export function enableHandler (event: Event): void { } } -async function installServiceWorker(): Promise { - return navigator.serviceWorker.register("/service_worker.js", { scope: "/" }); +async function getServiceWorker(): Promise { + return navigator.serviceWorker.getRegistration("/"); } async function getServerKey(): Promise { diff --git a/app/javascript/retrospring/initializers/serviceWorker.ts b/app/javascript/retrospring/initializers/serviceWorker.ts new file mode 100644 index 00000000..fdf5f1ff --- /dev/null +++ b/app/javascript/retrospring/initializers/serviceWorker.ts @@ -0,0 +1,3 @@ +export default function (): void { + navigator.serviceWorker.register("/service_worker.js", { scope: "/" }); +} diff --git a/public/icons/maskable_icon_x1024.webp b/public/icons/maskable_icon_x1024.webp index e69de29b..15f297d8 100644 Binary files a/public/icons/maskable_icon_x1024.webp and b/public/icons/maskable_icon_x1024.webp differ diff --git a/public/icons/maskable_icon_x128.webp b/public/icons/maskable_icon_x128.webp index e69de29b..0e662cd9 100644 Binary files a/public/icons/maskable_icon_x128.webp and b/public/icons/maskable_icon_x128.webp differ diff --git a/public/icons/maskable_icon_x144.webp b/public/icons/maskable_icon_x144.webp index bc19121f..f8c13815 100644 Binary files a/public/icons/maskable_icon_x144.webp and b/public/icons/maskable_icon_x144.webp differ diff --git a/public/icons/maskable_icon_x192.webp b/public/icons/maskable_icon_x192.webp index e69de29b..7cda2873 100644 Binary files a/public/icons/maskable_icon_x192.webp and b/public/icons/maskable_icon_x192.webp differ diff --git a/public/icons/maskable_icon_x384.webp b/public/icons/maskable_icon_x384.webp index e69de29b..ea6a9f15 100644 Binary files a/public/icons/maskable_icon_x384.webp and b/public/icons/maskable_icon_x384.webp differ diff --git a/public/icons/maskable_icon_x48.webp b/public/icons/maskable_icon_x48.webp index e69de29b..f8b1c163 100644 Binary files a/public/icons/maskable_icon_x48.webp and b/public/icons/maskable_icon_x48.webp differ diff --git a/public/icons/maskable_icon_x512.webp b/public/icons/maskable_icon_x512.webp index e69de29b..a90e2bcf 100644 Binary files a/public/icons/maskable_icon_x512.webp and b/public/icons/maskable_icon_x512.webp differ diff --git a/public/icons/maskable_icon_x72.webp b/public/icons/maskable_icon_x72.webp index e69de29b..5c39dcd0 100644 Binary files a/public/icons/maskable_icon_x72.webp and b/public/icons/maskable_icon_x72.webp differ diff --git a/public/icons/maskable_icon_x96.webp b/public/icons/maskable_icon_x96.webp index e69de29b..34396111 100644 Binary files a/public/icons/maskable_icon_x96.webp and b/public/icons/maskable_icon_x96.webp differ