From 25a3115cb0ae38137b6b255433c15f0ec79b7449 Mon Sep 17 00:00:00 2001 From: shum Date: Fri, 28 Aug 2026 15:17:07 +0000 Subject: [PATCH] ios: use trailing closure in MainActor.run calls --- .../Views/Chat/ComposeMessage/ContextProfilePickerView.swift | 3 ++- apps/ios/Shared/Views/NewChat/NewChatView.swift | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/ios/Shared/Views/Chat/ComposeMessage/ContextProfilePickerView.swift b/apps/ios/Shared/Views/Chat/ComposeMessage/ContextProfilePickerView.swift index 27655bb251..ec64efc8ed 100644 --- a/apps/ios/Shared/Views/Chat/ComposeMessage/ContextProfilePickerView.swift +++ b/apps/ios/Shared/Views/Chat/ComposeMessage/ContextProfilePickerView.swift @@ -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 diff --git a/apps/ios/Shared/Views/NewChat/NewChatView.swift b/apps/ios/Shared/Views/NewChat/NewChatView.swift index 85d55766a3..2bf6a2a65e 100644 --- a/apps/ios/Shared/Views/NewChat/NewChatView.swift +++ b/apps/ios/Shared/Views/NewChat/NewChatView.swift @@ -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