diff --git a/ApplicationLibrary/Service/ProfileUpdateTask.swift b/ApplicationLibrary/Service/ProfileUpdateTask.swift index 65ce3d7..1b649b1 100644 --- a/ApplicationLibrary/Service/ProfileUpdateTask.swift +++ b/ApplicationLibrary/Service/ProfileUpdateTask.swift @@ -20,11 +20,13 @@ public enum ProfileUpdateTask { if updateInterval < minUpdateInterval { updateInterval = minUpdateInterval } - timer = Timer(fire: calculateEarliestBeginDate(profiles), interval: updateInterval, repeats: true) { _ in + let newTimer = Timer(fire: calculateEarliestBeginDate(profiles), interval: updateInterval, repeats: true) { _ in Task { await getAndupdateProfiles() } } + RunLoop.main.add(newTimer, forMode: .common) + timer = newTimer } static func calculateEarliestBeginDate(_ profiles: [Profile]) -> Date { diff --git a/ApplicationLibrary/Views/Dashboard/DashboardView.swift b/ApplicationLibrary/Views/Dashboard/DashboardView.swift index 628c2a7..9f8a033 100644 --- a/ApplicationLibrary/Views/Dashboard/DashboardView.swift +++ b/ApplicationLibrary/Views/Dashboard/DashboardView.swift @@ -147,7 +147,7 @@ public struct DashboardView: View { message: Text(report.message()), dismissButton: .cancel(Text("Ok")) { Task.detached { - try await Task.sleep(nanoseconds: 300 * MSEC_PER_SEC) + try await Task.sleep(nanoseconds: 300 * NSEC_PER_MSEC) await loopShowDeprecateNotes(reports) } } @@ -159,13 +159,13 @@ public struct DashboardView: View { primaryButton: .default(Text("Documentation")) { openURL(URL(string: report.migrationLink)!) Task.detached { - try await Task.sleep(nanoseconds: 300 * MSEC_PER_SEC) + try await Task.sleep(nanoseconds: 300 * NSEC_PER_MSEC) await loopShowDeprecateNotes(reports) } }, secondaryButton: .cancel(Text("Ok")) { Task.detached { - try await Task.sleep(nanoseconds: 300 * MSEC_PER_SEC) + try await Task.sleep(nanoseconds: 300 * NSEC_PER_MSEC) await loopShowDeprecateNotes(reports) } }