Return more details about notification registration failure

This commit is contained in:
Jon Staab
2026-03-12 14:07:52 -07:00
parent 189af077e7
commit 1df2284ea3
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -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) {
+1 -1
View File
@@ -34,7 +34,7 @@
return pushToast({
theme: "error",
message: "Failed to request notification permissions.",
message: `Failed to request notification permissions (${permissions}).`,
})
}
}