commit 88801c276269411416ddd6c9d0165d43fc9fb006
parent 003482c971da3a78c7d990e958970694ce5afe9f
Author: Daniel D’Aquino <daniel@daquino.me>
Date: Fri, 1 Dec 2023 21:26:34 +0000
Fix user setting access issue in the notification extension
Notification settings test
--------------------------
PASS
Device: iPhone 15 Pro simulator
iOS: 17.0.1
Damus: This commit
Setup:
- Two phones running Damus on different accounts
- Local relay with strfry-push-notify test setup
- Apple push notification test tool
Coverage:
1. Mention notifications
2. DM notifications
3. Reaction notifications
4. Repost notifications
Steps for each notification type:
1. Trigger a push notification (Resend push notification from test tool)
2. Ensure that the notification is received on the other device
3. Turn off notifications for that type on settings
4. Trigger a push notification (Resend push notification from test tool)
5. Ensure that the notification is not received on the other device
Result: PASS (notifications are received when enabled and not received when disabled)
Closes: https://github.com/damus-io/damus/issues/1764
Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/DamusNotificationService/NotificationExtensionState.swift b/DamusNotificationService/NotificationExtensionState.swift
@@ -20,9 +20,13 @@ struct NotificationExtensionState: HeadlessDamusState {
init?() {
guard let ndb = try? Ndb(owns_db_file: false) else { return nil }
self.ndb = ndb
- self.settings = UserSettingsStore()
guard let keypair = get_saved_keypair() else { return nil }
+
+ // dumb stuff needed for property wrappers
+ UserSettingsStore.pubkey = keypair.pubkey
+ self.settings = UserSettingsStore()
+
self.contacts = Contacts(our_pubkey: keypair.pubkey)
self.muted_threads = MutedThreadsManager(keypair: keypair)
self.keypair = keypair