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 <evgeny@poberezkin.com>
This commit is contained in:
Stanislav Dmitrenko
2024-03-22 02:36:05 +07:00
committed by GitHub
parent d27502ec47
commit ca0ce4dfdd

View File

@@ -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)