From 5ca2ab61384f9a14b85ffc16dfa2aa8cbdeb8728 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Fri, 22 Sep 2023 12:23:53 +0400 Subject: [PATCH] ios: fix delete contact crashing from chat view (#3099) --- apps/ios/Shared/Views/Chat/ChatInfoView.swift | 4 ++-- apps/ios/Shared/Views/Chat/Group/GroupChatInfoView.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/ios/Shared/Views/Chat/ChatInfoView.swift b/apps/ios/Shared/Views/Chat/ChatInfoView.swift index e7a5978044..ec4cb90097 100644 --- a/apps/ios/Shared/Views/Chat/ChatInfoView.swift +++ b/apps/ios/Shared/Views/Chat/ChatInfoView.swift @@ -440,9 +440,9 @@ struct ChatInfoView: View { do { try await apiDeleteChat(type: chat.chatInfo.chatType, id: chat.chatInfo.apiId) await MainActor.run { - chatModel.removeChat(chat.chatInfo.id) - chatModel.chatId = nil dismiss() + chatModel.chatId = nil + chatModel.removeChat(chat.chatInfo.id) } } catch let error { logger.error("deleteContactAlert apiDeleteChat error: \(responseError(error))") diff --git a/apps/ios/Shared/Views/Chat/Group/GroupChatInfoView.swift b/apps/ios/Shared/Views/Chat/Group/GroupChatInfoView.swift index 75e81790a2..3b9ef347e8 100644 --- a/apps/ios/Shared/Views/Chat/Group/GroupChatInfoView.swift +++ b/apps/ios/Shared/Views/Chat/Group/GroupChatInfoView.swift @@ -299,9 +299,9 @@ struct GroupChatInfoView: View { do { try await apiDeleteChat(type: chat.chatInfo.chatType, id: chat.chatInfo.apiId) await MainActor.run { - chatModel.removeChat(chat.chatInfo.id) - chatModel.chatId = nil dismiss() + chatModel.chatId = nil + chatModel.removeChat(chat.chatInfo.id) } } catch let error { logger.error("deleteGroupAlert apiDeleteChat error: \(error.localizedDescription)")