damus

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

commit fae626b6c7ff0934b45a13848cd854c037386bbd
parent d84320bb2cf36f9c702ce6f9fde4e0bacebdf0ac
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 26 Dec 2022 19:01:53 -0800

Revert "Only reload global view on pulldown refresh"

This reverts commit a4d62d295c79686c0989854bec89c0846f7cb006.

Diffstat:
Mdamus/ContentView.swift | 5+----
Mdamus/Models/SearchHomeModel.swift | 9++++-----
Mdamus/Views/SearchHomeView.swift | 7++-----
3 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/damus/ContentView.swift b/damus/ContentView.swift @@ -68,8 +68,6 @@ struct ContentView: View { @State var thread_open: Bool = false @State var search_open: Bool = false @State var filter_state : FilterState = .posts_and_replies - - @StateObject var search: SearchHomeModel = SearchHomeModel() @StateObject var home: HomeModel = HomeModel() // connect retry timer @@ -135,7 +133,7 @@ struct ContentView: View { } switch selected_timeline { case .search: - SearchHomeView(damus_state: damus_state!, model: search) + SearchHomeView(damus_state: damus_state!, model: SearchHomeModel(damus_state: damus_state!)) case .home: PostingTimelineView @@ -405,7 +403,6 @@ struct ContentView: View { dms: home.dms ) home.damus_state = self.damus_state! - search.damus_state = self.damus_state! pool.connect() } diff --git a/damus/Models/SearchHomeModel.swift b/damus/Models/SearchHomeModel.swift @@ -10,18 +10,17 @@ import Foundation /// The data model for the SearchHome view, typically something global-like class SearchHomeModel: ObservableObject { - @Published var events: [NostrEvent] + @Published var events: [NostrEvent] = [] @Published var loading: Bool = false var seen_pubkey: Set<String> = Set() - var damus_state: DamusState + let damus_state: DamusState let base_subid = UUID().description let profiles_subid = UUID().description let limit: UInt32 = 250 - init() { - self.events = [] - self.damus_state = .empty + init(damus_state: DamusState) { + self.damus_state = damus_state } func get_base_filter() -> NostrFilter { diff --git a/damus/Views/SearchHomeView.swift b/damus/Views/SearchHomeView.swift @@ -10,7 +10,7 @@ import CryptoKit struct SearchHomeView: View { let damus_state: DamusState - @ObservedObject var model: SearchHomeModel + @StateObject var model: SearchHomeModel @State var search: String = "" var SearchInput: some View { @@ -97,15 +97,12 @@ struct SearchHomeView: View { } } -/* struct SearchHomeView_Previews: PreviewProvider { static var previews: some View { let state = test_damus_state() SearchHomeView( damus_state: state, - model: SearchHomeModel() + model: SearchHomeModel(damus_state: state) ) } } - -*/