mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-11-29 08:29:22 +00:00
Avoid publishing VoiceRecordingViewModel.state during SwiftUI alert updates
This commit is contained in:
1 parent
fec56edf43
commit
3e5310a457
3 files changed
+11
-3
No files matched your search
@@ -59,7 +59,8 @@ final class VoiceRecordingViewModel: ObservableObject {
|
||||
}
|
||||
}
|
||||
set {
|
||||
if !newValue { state = .idle }
|
||||
guard !newValue, showAlert else { return }
|
||||
state = .idle
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,9 @@ struct ContentPeopleSheetView: View {
|
||||
!hasModalPresentationBesidesVoiceAlert else {
|
||||
return
|
||||
}
|
||||
voiceRecordingVM.showAlert = false
|
||||
Task { @MainActor in
|
||||
voiceRecordingVM.showAlert = false
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -226,7 +226,12 @@ struct WalkieTalkieSheetView: View {
|
||||
Text(String(localized: "voice.error.title", defaultValue: "Recording error", comment: "Title of the voice recording error alert")),
|
||||
isPresented: Binding(
|
||||
get: { voiceRecordingVM.showAlert },
|
||||
set: { if !$0 { voiceRecordingVM.showAlert = false } }
|
||||
set: { isPresented in
|
||||
guard !isPresented, voiceRecordingVM.showAlert else { return }
|
||||
Task { @MainActor in
|
||||
voiceRecordingVM.showAlert = false
|
||||
}
|
||||
}
|
||||
),
|
||||
actions: {
|
||||
Button(String(localized: "common.ok"), role: .cancel) {}
|
||||
|
||||
Reference in new issue
Block a user