Reuse local notification logic with push notifications
Testing ------- Conditional pass Device: iPhone 15 Pro simulator iOS: 17.0.1 Damus: This commit Coverage: 1. Mention notification works (local and push). PASS 2. Thread replies do not appear (but upon code inspection it seems like it was not supported before). PASS? 3. DM notification works with decryption (local and push). PASS 4. Zaps not yet implemented. Coming later. Closes: https://github.com/damus-io/damus/issues/1702 Closes: https://github.com/damus-io/damus/issues/1703 Changelog-Changed: Improve push notification support to match local notification support Signed-off-by: Daniel D’Aquino <daniel@daquino.me> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
5db22ae244
commit
c4f0e833ff
29
DamusNotificationService/NotificationExtensionState.swift
Normal file
29
DamusNotificationService/NotificationExtensionState.swift
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// NotificationExtensionState.swift
|
||||
// DamusNotificationService
|
||||
//
|
||||
// Created by Daniel D’Aquino on 2023-11-27.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct NotificationExtensionState: HeadlessDamusState {
|
||||
let ndb: Ndb
|
||||
let settings: UserSettingsStore
|
||||
let contacts: Contacts
|
||||
let muted_threads: MutedThreadsManager
|
||||
let keypair: Keypair
|
||||
let profiles: Profiles
|
||||
|
||||
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 }
|
||||
self.contacts = Contacts(our_pubkey: keypair.pubkey)
|
||||
self.muted_threads = MutedThreadsManager(keypair: keypair)
|
||||
self.keypair = keypair
|
||||
self.profiles = Profiles(ndb: ndb)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user