mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-09-16 17:03:29 +00:00
ios: share the create-and-refresh step between both pickers
Both create functions repeated the same create + listUsers + model update; only the final action differs. Extract it next to apiCreateActiveUser, as Kotlin already does with createProfileForInvitation.
This commit is contained in:
@@ -259,6 +259,14 @@ func apiCreateActiveUser(_ p: Profile?, pastTimestamp: Bool = false, keepActiveU
|
||||
throw r.unexpected
|
||||
}
|
||||
|
||||
func createProfileKeepingActiveUser(_ profile: Profile) async throws -> User {
|
||||
let newUser = try apiCreateActiveUser(profile, keepActiveUser: true)
|
||||
if let users = try? await listUsersAsync() {
|
||||
await MainActor.run { ChatModel.shared.users = users }
|
||||
}
|
||||
return newUser
|
||||
}
|
||||
|
||||
func listUsers() throws -> [UserInfo] {
|
||||
return try listUsersResponse(chatSendCmdSync(.listUsers))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user