minor concurrency improvements

This commit is contained in:
neon443 committed 2025-05-29 18:32:54 +01:00
1 parent 69047010d7
commit 2ef000458f
3 files changed
+8 -5

No files matched your search

+5 -2
View File
@@ -95,8 +95,11 @@ struct SettingsView: View {
List { List {
if !settingsModel.notifsGranted { if !settingsModel.notifsGranted {
Button("Request Notifications") { Button("Request Notifications") {
Task { Task.detached {
settingsModel.notifsGranted = await requestNotifs() let requestNotifsResult = await requestNotifs()
await MainActor.run {
settingsModel.notifsGranted = requestNotifsResult
}
} }
} }
Text("\(Image(systemName: "xmark")) Notifications disabled for Near Future") Text("\(Image(systemName: "xmark")) Notifications disabled for Near Future")
+2 -2
View File
@@ -248,8 +248,8 @@ class EventViewModel: ObservableObject, @unchecked Sendable {
updateSyncStatus() updateSyncStatus()
loadEvents() loadEvents()
Task { Task.detached {
await checkPendingNotifs(getNotifs()) await self.checkPendingNotifs(self.getNotifs())
} }
WidgetCenter.shared.reloadAllTimelines()//reload all widgets when saving events WidgetCenter.shared.reloadAllTimelines()//reload all widgets when saving events
objectWillChange.send() objectWillChange.send()
+1 -1
View File
@@ -76,7 +76,7 @@ class SettingsViewModel: ObservableObject {
self.device = getDevice() self.device = getDevice()
if load { if load {
loadSettings() loadSettings()
Task { Task.detached {
let requestResult = await requestNotifs() let requestResult = await requestNotifs()
await MainActor.run { await MainActor.run {
self.notifsGranted = requestResult self.notifsGranted = requestResult
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.