damus

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

commit 977ae29949ca98fb6d898a0ee707a2eebc569bbc
parent 52b2407f49bd09b064f989641e577e269f2ee323
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 31 Dec 2022 18:09:25 -0800

Fix navigation popping in DM view

Diffstat:
Mdamus/Views/DirectMessagesView.swift | 21+++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/damus/Views/DirectMessagesView.swift b/damus/Views/DirectMessagesView.swift @@ -9,10 +9,19 @@ import SwiftUI struct DirectMessagesView: View { let damus_state: DamusState + + @State var open_dm: Bool = false + @State var pubkey: String = "" + @State var active_model: DirectMessageModel = DirectMessageModel() @EnvironmentObject var model: DirectMessagesModel var MainContent: some View { ScrollView { + let chat = DMChatView(damus_state: damus_state, pubkey: pubkey) + .environmentObject(active_model) + NavigationLink(destination: chat, isActive: $open_dm) { + EmptyView() + } LazyVStack { if model.dms.isEmpty, !model.loading { EmptyTimelineView() @@ -30,12 +39,12 @@ struct DirectMessagesView: View { func MaybeEvent(_ tup: (String, DirectMessageModel)) -> some View { Group { if let ev = tup.1.events.last { - let chat = DMChatView(damus_state: damus_state, pubkey: tup.0) - .environmentObject(tup.1) - NavigationLink(destination: chat) { - EventView(damus: damus_state, event: ev, pubkey: tup.0, show_friend_icon: true) - } - .buttonStyle(PlainButtonStyle()) + EventView(damus: damus_state, event: ev, pubkey: tup.0, show_friend_icon: true) + .onTapGesture { + pubkey = tup.0 + active_model = tup.1 + open_dm = true + } } else { EmptyView() }