nav: remove environmentObjects
environment objects are implicit arguments that cannot be checked by the compiler. They are a common source of crashes. Use a main NavigationCoordinator in DamusState for the core app, and pass in other coordinators in the account setup view for the parts of the app that don't have a DamusState.
This commit is contained in:
@@ -12,8 +12,6 @@ struct InnerTimelineView: View {
|
||||
@ObservedObject var events: EventHolder
|
||||
let state: DamusState
|
||||
let filter: (NostrEvent) -> Bool
|
||||
|
||||
@EnvironmentObject var navigationCoordinator: NavigationCoordinator
|
||||
|
||||
static var count: Int = 0
|
||||
|
||||
@@ -48,7 +46,7 @@ struct InnerTimelineView: View {
|
||||
.onTapGesture {
|
||||
let event = ev.get_inner_event(cache: state.events) ?? ev
|
||||
let thread = ThreadModel(event: event, damus_state: state)
|
||||
navigationCoordinator.push(route: Route.Thread(thread: thread))
|
||||
state.nav.push(route: Route.Thread(thread: thread))
|
||||
}
|
||||
.padding(.top, 7)
|
||||
.onAppear {
|
||||
|
||||
Reference in New Issue
Block a user