From 1df2284ea388d47099c72e6575d1e8f3962d92e5 Mon Sep 17 00:00:00 2001 From: Jon Staab Date: Thu, 12 Mar 2026 14:07:52 -0700 Subject: [PATCH] Return more details about notification registration failure --- src/app/util/notifications.ts | 7 ++++--- src/routes/settings/alerts/+page.svelte | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/util/notifications.ts b/src/app/util/notifications.ts index 40c08025..647435be 100644 --- a/src/app/util/notifications.ts +++ b/src/app/util/notifications.ts @@ -311,14 +311,15 @@ class CapacitorNotifications implements IPushAdapter { } let {token} = notificationState.get() + let error = "failed to retrieve token" if (!token) { const listeners = [ PushNotifications.addListener("registration", ({value}: Token) => { token = value }), - PushNotifications.addListener("registrationError", (error: RegistrationError) => { - console.error(error) + PushNotifications.addListener("registrationError", (err: RegistrationError) => { + error = err.error }), ] @@ -334,7 +335,7 @@ class CapacitorNotifications implements IPushAdapter { notificationState.update(assoc("token", token)) } - return token ? "granted" : "denied" + return token ? status.receive : error } async _syncServer(signal: AbortSignal) { diff --git a/src/routes/settings/alerts/+page.svelte b/src/routes/settings/alerts/+page.svelte index 1f4ed3bd..6aa78ce6 100644 --- a/src/routes/settings/alerts/+page.svelte +++ b/src/routes/settings/alerts/+page.svelte @@ -34,7 +34,7 @@ return pushToast({ theme: "error", - message: "Failed to request notification permissions.", + message: `Failed to request notification permissions (${permissions}).`, }) } }