ios: use trailing closure in MainActor.run calls

This commit is contained in:
shum
2026-08-28 15:17:36 +00:00
parent 6756bc79b4
commit 25a3115cb0
2 changed files with 4 additions and 2 deletions
@@ -312,7 +312,8 @@ struct ContextProfilePickerView: View {
// and a notification action can have switched it while we were creating. After the
// await above, not before it: checked first, that await reopens the very window
// this closes. Kotlin orders it the same way.
guard await MainActor.run({ chatModel.currentUser?.userId }) == ownerUserId else {
let activeUserId = await MainActor.run { chatModel.currentUser?.userId }
guard activeUserId == ownerUserId else {
await MainActor.run { showAddProfile = false }
alertAfterDismissal(NSLocalizedString("Error changing chat profile", comment: "alert title"))
return
@@ -665,7 +665,8 @@ private struct ActiveProfilePicker: View {
// selectedProfile handler runs, and a notification action can have switched it.
// After the await above, not before it: checked first, that await reopens the very
// window this closes. Kotlin orders it the same way.
guard await MainActor.run({ chatModel.currentUser?.userId }) == ownerUserId else {
let activeUserId = await MainActor.run { chatModel.currentUser?.userId }
guard activeUserId == ownerUserId else {
await MainActor.run { showAddProfile = false }
alertAfterDismissal(NSLocalizedString("Error changing chat profile", comment: "alert title"))
return