mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-08-14 07:10:19 +00:00
fix the docs the API merge invalidated, and use the async listUsers
Merging keepActiveUser into apiCreateActiveUser changed a signature that two Kotlin docs quote. spec/api.md still described the old parameters and said the command sets the profile as active, full stop; product/flows/onboarding.md quoted the old signature one step above the line this branch had already updated to mention the flag. The iOS spec table was fixed in the previous commit and these were missed - the same drift on the other platform. Both iOS call sites now use listUsersAsync, which is what changeActiveUserAsync_ uses a few lines later; the synchronous listUsers blocks whatever executor the Task is on, and SwiftUI infers that as the main actor. Not compiled: the Kotlin changes here are markdown only, and the Swift ones cannot be built on this machine.
This commit is contained in:
@@ -261,7 +261,7 @@ struct ContextProfilePickerView: View {
|
||||
defer { Task { @MainActor in creatingProfile = false } }
|
||||
let profile = Profile(displayName: displayName, fullName: "", shortDescr: shortDescr, image: image)
|
||||
let newUser = try apiCreateActiveUser(profile, keepActiveUser: true)
|
||||
let updatedUsers = try? listUsers()
|
||||
let updatedUsers = try? await listUsersAsync()
|
||||
await MainActor.run {
|
||||
if let updatedUsers = updatedUsers {
|
||||
chatModel.users = updatedUsers
|
||||
@@ -274,7 +274,6 @@ struct ContextProfilePickerView: View {
|
||||
// An older remote host ignored keepActiveUser and activated it, so the
|
||||
// reassignment would fail. Resync to what the host did and report it - not
|
||||
// rethrown, or the form reports it as a failure to create the profile.
|
||||
// let, not var: MainActor.run's body is @Sendable and cannot capture a mutable local
|
||||
let switched: Bool
|
||||
do {
|
||||
try await changeActiveUserAsync_(newUser.userId, viewPwd: nil)
|
||||
|
||||
@@ -611,7 +611,7 @@ private struct ActiveProfilePicker: View {
|
||||
defer { Task { @MainActor in creatingProfile = false } }
|
||||
let profile = Profile(displayName: displayName, fullName: "", shortDescr: shortDescr, image: image)
|
||||
let newUser = try apiCreateActiveUser(profile, keepActiveUser: true)
|
||||
let updatedUsers = try? listUsers()
|
||||
let updatedUsers = try? await listUsersAsync()
|
||||
await MainActor.run {
|
||||
if let updatedUsers = updatedUsers { chatModel.users = updatedUsers }
|
||||
profiles = chatModel.users.map { $0.user }
|
||||
|
||||
Reference in New Issue
Block a user