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:
@@ -19,8 +19,6 @@ struct DirectMessagesView: View {
|
||||
@ObservedObject var model: DirectMessagesModel
|
||||
@ObservedObject var settings: UserSettingsStore
|
||||
|
||||
@EnvironmentObject var navigationCoordinator: NavigationCoordinator
|
||||
|
||||
func MainContent(requests: Bool) -> some View {
|
||||
ScrollView {
|
||||
LazyVStack(spacing: 0) {
|
||||
@@ -53,7 +51,7 @@ struct DirectMessagesView: View {
|
||||
EventView(damus: damus_state, event: ev, pubkey: model.pubkey, options: options)
|
||||
.onTapGesture {
|
||||
self.model.set_active_dm_model(model)
|
||||
navigationCoordinator.push(route: Route.DMChat(dms: self.model.active_model))
|
||||
damus_state.nav.push(route: Route.DMChat(dms: self.model.active_model))
|
||||
}
|
||||
|
||||
Divider()
|
||||
|
||||
Reference in New Issue
Block a user