forked from coracle/flotilla
Handle encrypted notifications
This commit is contained in:
@@ -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]))
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user