From fe7b30ee329b96f9ab552b4b8b7efe32f23bcb38 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Thu, 16 Nov 2023 04:03:38 -0500 Subject: [PATCH] Alert dialog for odd edge-case --- src/App.vue | 13 ++++++++++++- sw_scripts/safari-notifications.js | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index 947be47..3ad32f5 100644 --- a/src/App.vue +++ b/src/App.vue @@ -460,7 +460,18 @@ export default class App extends Vue { resolve(); }) .catch((error) => { - console.error("Push subscription failed:", error, options); + console.error( + "Subscription or server communication failed:", + error, + options, + ); + + // Inform the user about the issue + alert( + "We encountered an issue setting up push notifications. " + + "If you wish to revoke notification permissions, please do so in your browser settings.", + ); + reject(error); }); }); diff --git a/sw_scripts/safari-notifications.js b/sw_scripts/safari-notifications.js index d80f903..7243e18 100644 --- a/sw_scripts/safari-notifications.js +++ b/sw_scripts/safari-notifications.js @@ -105,6 +105,8 @@ async function getNotificationCount() { const messageWithNonceAsUint8Array = self.decodeBase64(identity); const nonce = messageWithNonceAsUint8Array.slice(0, 24); const message = messageWithNonceAsUint8Array.slice(24, identity.length); + const decoder = new TextDecoder("utf-8"); + break; } }