mirror of
https://github.com/neon443/NearFuture.git
synced 2026-03-11 06:49:12 +00:00
minor concurrency improvements
This commit is contained in:
@@ -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")
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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