From 57e5ef26792cc777fc617b938abc7ec20f6f4ab9 Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Mon, 23 Jan 2023 12:25:01 +0300 Subject: [PATCH] complete --- apps/ios/Shared/Views/Chat/ChatView.swift | 4 ++++ apps/ios/Shared/Views/ChatList/ChatListView.swift | 13 +------------ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/apps/ios/Shared/Views/Chat/ChatView.swift b/apps/ios/Shared/Views/Chat/ChatView.swift index fd94e96a33..68ab7c191d 100644 --- a/apps/ios/Shared/Views/Chat/ChatView.swift +++ b/apps/ios/Shared/Views/Chat/ChatView.swift @@ -15,6 +15,7 @@ private let memberImageSize: CGFloat = 34 struct ChatView: View { @EnvironmentObject var chatModel: ChatModel @Environment(\.colorScheme) var colorScheme + @Environment(\.dismiss) var dismiss @State @ObservedObject var chat: Chat @State private var showChatInfoSheet: Bool = false @State private var showAddMembersSheet: Bool = false @@ -70,6 +71,9 @@ struct ChatView: View { } } } + .onChange(of: chatModel.chatId) { _ in + if chatModel.chatId == nil { dismiss() } + } .toolbar { ToolbarItem(placement: .navigationBarLeading) { Button { diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index 01e1f4f05b..8b3c9dadf0 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -17,7 +17,7 @@ struct ChatListView: View { @State private var showAddChat = false var body: some View { - NavStackWorkaround(isPresented: Binding(get: { chatModel.chatId != nil }, set: { _ in }), destination: chatView) { + NavStackWorkaround(path: Binding(get: { ChatModel.shared.chatId != nil ? [true] : [] }, set: { _ in }), destination: chatView) { VStack { if chatModel.chats.isEmpty { onboardingButtons() @@ -74,17 +74,6 @@ struct ChatListView: View { } } } - .background( - ProcessInfo().operatingSystemVersion.majorVersion < 16 - ? NavigationLink( - destination: chatView(), - isActive: Binding( - get: { chatModel.chatId != nil }, - set: { _ in } - ) - ) { EmptyView() } - : nil - ) } private func onboardingButtons() -> some View {