This commit is contained in:
Avently
2023-01-23 12:25:01 +03:00
parent f69cdb84bc
commit 57e5ef2679
2 changed files with 5 additions and 12 deletions
@@ -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 {
@@ -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 {