Refactor task usage and profile auto update

This commit is contained in:
世界
2023-09-22 11:32:51 +08:00
parent 390e063f20
commit 3374f8e727
49 changed files with 823 additions and 636 deletions
@@ -2,6 +2,7 @@ import Library
import SwiftUI
#if os(macOS)
@MainActor
public struct EditProfileWindowView: View {
public static let windowID = "edit-profile"
@@ -21,7 +22,7 @@ import SwiftUI
viewBuilder {
if isLoading {
ProgressView().onAppear {
Task.detached {
Task {
await doReload()
}
}
@@ -41,7 +42,7 @@ import SwiftUI
return
}
do {
profile = try ProfileManager.get(profileID)
profile = try await ProfileManager.get(profileID)
} catch {
alert = Alert(error)
return
@@ -53,4 +54,5 @@ import SwiftUI
isLoading = false
}
}
#endif