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:
Narasimha-sc
2026-09-05 15:12:02 +00:00
parent 0cfbebfbb2
commit 86a8c64aa0
3 changed files with 12 additions and 12 deletions
+8
View File
@@ -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))
}