Handle encrypted notifications

This commit is contained in:
Jon Staab
2026-01-29 13:52:04 -08:00
parent d4378731ae
commit cf8e736f46
+6 -4
View File
@@ -7,10 +7,10 @@ import type {ActionPerformed, RegistrationError, Token} from "@capacitor/push-no
import {synced, throttled} from "@welshman/store" import {synced, throttled} from "@welshman/store"
import { import {
pubkey, pubkey,
signer,
tracker, tracker,
repository, repository,
relaysByUrl, relaysByUrl,
signer,
publishThunk, publishThunk,
loadRelay, loadRelay,
waitForThunkError, waitForThunkError,
@@ -578,10 +578,12 @@ class CapacitorNotifications implements IPushAdapter {
PushNotifications.addListener( PushNotifications.addListener(
"pushNotificationActionPerformed", "pushNotificationActionPerformed",
async (action: ActionPerformed) => { async (action: ActionPerformed) => {
const event = parseJson(action.notification.data.event) const {relay, pubkey, payload} = action.notification.data
const relays = [action.notification.data.relay] const event = parseJson(await signer.get().nip44.decrypt(pubkey, payload))
goto(await getEventPath(event, relays)) if (event) {
goto(await getEventPath(event, [relay]))
}
}, },
) )