From ca0ce4dfdd7d77a839016875b5dcdf000b787258 Mon Sep 17 00:00:00 2001 From: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com> Date: Fri, 22 Mar 2024 02:36:05 +0700 Subject: [PATCH] ios: making chat state .active when starting chat, correctly handle hidden users when deleting the last profile (#3936) * ios: making chat state .active when starting chat * changes * refactor --------- Co-authored-by: Evgeny Poberezkin --- apps/ios/Shared/Views/Onboarding/CreateProfile.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/ios/Shared/Views/Onboarding/CreateProfile.swift b/apps/ios/Shared/Views/Onboarding/CreateProfile.swift index 3f835e25d4..0ee6baa765 100644 --- a/apps/ios/Shared/Views/Onboarding/CreateProfile.swift +++ b/apps/ios/Shared/Views/Onboarding/CreateProfile.swift @@ -166,8 +166,10 @@ private func createProfile(_ displayName: String, showAlert: (UserProfileAlert) ) let m = ChatModel.shared do { + AppChatState.shared.set(.active) m.currentUser = try apiCreateActiveUser(profile) - if m.users.isEmpty { + // .isEmpty check is redundant here, but it makes it clearer what is going on + if m.users.isEmpty || m.users.allSatisfy({ $0.user.hidden }) { try startChat() withAnimation { onboardingStageDefault.set(.step3_CreateSimpleXAddress)