Fixes
This commit is contained in:
@@ -6,14 +6,14 @@ import Library
|
||||
public class UIProfileUpdateTask: BGAppRefreshTask {
|
||||
private static let taskSchedulerPermittedIdentifier = "\(FilePath.packageName).update_profiles"
|
||||
|
||||
private static var registered = false
|
||||
|
||||
public static func configure() async throws {
|
||||
private actor Register {
|
||||
private var registered = false
|
||||
func configure() async throws {
|
||||
if !registered {
|
||||
let success = BGTaskScheduler.shared.register(forTaskWithIdentifier: taskSchedulerPermittedIdentifier, using: nil) { task in
|
||||
NSLog("profile update task started")
|
||||
Task {
|
||||
await getAndupdateProfiles(task)
|
||||
await UIProfileUpdateTask.getAndupdateProfiles(task)
|
||||
}
|
||||
}
|
||||
if !success {
|
||||
@@ -28,6 +28,12 @@ import Library
|
||||
}
|
||||
try scheduleUpdate(ProfileUpdateTask.calculateEarliestBeginDate(profiles))
|
||||
}
|
||||
}
|
||||
|
||||
private static let register = Register()
|
||||
public static func configure() async throws {
|
||||
try await register.configure()
|
||||
}
|
||||
|
||||
private nonisolated static func getAndupdateProfiles(_ task: BGTask) async {
|
||||
let profiles: [Profile]
|
||||
|
||||
@@ -170,6 +170,7 @@ public struct EditProfileView: View {
|
||||
do {
|
||||
try await Task.sleep(nanoseconds: UInt64(100 * Double(NSEC_PER_MSEC)))
|
||||
try await profile.updateRemoteProfile()
|
||||
await performCallback()
|
||||
} catch {
|
||||
alert = Alert(error)
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public struct ProfileView: View {
|
||||
public init() {}
|
||||
|
||||
public var body: some View {
|
||||
viewBuilder {
|
||||
VStack {
|
||||
if isLoading {
|
||||
ProgressView().onAppear {
|
||||
Task {
|
||||
@@ -222,6 +222,9 @@ public struct ProfileView: View {
|
||||
isLoading = false
|
||||
}
|
||||
do {
|
||||
if !profileList.isEmpty {
|
||||
profileList.removeAll()
|
||||
}
|
||||
profileList = try await ProfileManager.list()
|
||||
} catch {
|
||||
alert = Alert(error)
|
||||
|
||||
Reference in New Issue
Block a user