damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 616de2eebc191759ce0516f2d83555e355b680cf
parent 709aab549b185a3de82179f527edac810386c428
Author: William Casarin <jb55@jb55.com>
Date:   Tue,  1 Aug 2023 19:59:14 -0700

state: improve damus state init

It's a bit cleaner now

Diffstat:
Mdamus/Models/DamusState.swift | 30+++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/damus/Models/DamusState.swift b/damus/Models/DamusState.swift @@ -60,5 +60,33 @@ struct DamusState { static var empty: DamusState { let user_search_cache = UserSearchCache() - return DamusState.init(pool: RelayPool(), keypair: Keypair(pubkey: "", privkey: ""), likes: EventCounter(our_pubkey: ""), boosts: EventCounter(our_pubkey: ""), contacts: Contacts(our_pubkey: ""), profiles: Profiles(user_search_cache: user_search_cache), dms: DirectMessagesModel(our_pubkey: ""), previews: PreviewCache(), zaps: Zaps(our_pubkey: ""), lnurls: LNUrls(), settings: UserSettingsStore(), relay_filters: RelayFilters(our_pubkey: ""), relay_model_cache: RelayModelCache(), drafts: Drafts(), events: EventCache(), bookmarks: BookmarksManager(pubkey: ""), postbox: PostBox(pool: RelayPool()), bootstrap_relays: [], replies: ReplyCounter(our_pubkey: ""), muted_threads: MutedThreadsManager(keypair: Keypair(pubkey: "", privkey: nil)), wallet: WalletModel(settings: UserSettingsStore()), nav: NavigationCoordinator(), user_search_cache: user_search_cache) } + let empty_pub: Pubkey = .empty + let empty_sec: Privkey = .empty + let kp = Keypair(pubkey: empty_pub, privkey: nil) + + return DamusState.init( + pool: RelayPool(), + keypair: Keypair(pubkey: empty_pub, privkey: empty_sec), + likes: EventCounter(our_pubkey: empty_pub), + boosts: EventCounter(our_pubkey: empty_pub), + contacts: Contacts(our_pubkey: empty_pub), + profiles: Profiles(user_search_cache: user_search_cache), + dms: DirectMessagesModel(our_pubkey: empty_pub), + previews: PreviewCache(), + zaps: Zaps(our_pubkey: empty_pub), + lnurls: LNUrls(), + settings: UserSettingsStore(), + relay_filters: RelayFilters(our_pubkey: empty_pub), + relay_model_cache: RelayModelCache(), + drafts: Drafts(), + events: EventCache(), + bookmarks: BookmarksManager(pubkey: empty_pub), + postbox: PostBox(pool: RelayPool()), + bootstrap_relays: [], + replies: ReplyCounter(our_pubkey: empty_pub), + muted_threads: MutedThreadsManager(keypair: kp), + wallet: WalletModel(settings: UserSettingsStore()), + nav: NavigationCoordinator(), + user_search_cache: user_search_cache) + } }