From 3dc9eded54dfdbc9c4063e7d8fc1941ac4bfe285 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sat, 2 Apr 2022 12:23:05 +0100 Subject: [PATCH] ios: fix alert on contact deletion from chat info (#496) --- apps/ios/Shared/Views/Chat/ChatInfoView.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/ios/Shared/Views/Chat/ChatInfoView.swift b/apps/ios/Shared/Views/Chat/ChatInfoView.swift index 7e0905913f..ec52ac977a 100644 --- a/apps/ios/Shared/Views/Chat/ChatInfoView.swift +++ b/apps/ios/Shared/Views/Chat/ChatInfoView.swift @@ -13,6 +13,8 @@ struct ChatInfoView: View { @ObservedObject var alertManager = AlertManager.shared @ObservedObject var chat: Chat @Binding var showChatInfo: Bool + @State var showDeleteAlert = false + @State var deletingContact: Contact? var body: some View { VStack{ @@ -40,7 +42,8 @@ struct ChatInfoView: View { Spacer() Button(role: .destructive) { - alertManager.showAlert(deleteContactAlert(contact)) + deletingContact = contact + showDeleteAlert = true } label: { Label("Delete contact", systemImage: "trash") } @@ -48,7 +51,7 @@ struct ChatInfoView: View { } } } - .alert(isPresented: $alertManager.presentAlert) { alertManager.alertView! } + .alert(isPresented: $showDeleteAlert) { deleteContactAlert(deletingContact!) } .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top) }