Minor fixes

This commit is contained in:
世界
2025-09-30 17:06:17 +08:00
parent 8a42e67060
commit 5d811d10b9
2 changed files with 6 additions and 4 deletions
@@ -20,11 +20,13 @@ public enum ProfileUpdateTask {
if updateInterval < minUpdateInterval { if updateInterval < minUpdateInterval {
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 { Task {
await getAndupdateProfiles() await getAndupdateProfiles()
} }
} }
RunLoop.main.add(newTimer, forMode: .common)
timer = newTimer
} }
static func calculateEarliestBeginDate(_ profiles: [Profile]) -> Date { static func calculateEarliestBeginDate(_ profiles: [Profile]) -> Date {
@@ -147,7 +147,7 @@ public struct DashboardView: View {
message: Text(report.message()), message: Text(report.message()),
dismissButton: .cancel(Text("Ok")) { dismissButton: .cancel(Text("Ok")) {
Task.detached { Task.detached {
try await Task.sleep(nanoseconds: 300 * MSEC_PER_SEC) try await Task.sleep(nanoseconds: 300 * NSEC_PER_MSEC)
await loopShowDeprecateNotes(reports) await loopShowDeprecateNotes(reports)
} }
} }
@@ -159,13 +159,13 @@ public struct DashboardView: View {
primaryButton: .default(Text("Documentation")) { primaryButton: .default(Text("Documentation")) {
openURL(URL(string: report.migrationLink)!) openURL(URL(string: report.migrationLink)!)
Task.detached { Task.detached {
try await Task.sleep(nanoseconds: 300 * MSEC_PER_SEC) try await Task.sleep(nanoseconds: 300 * NSEC_PER_MSEC)
await loopShowDeprecateNotes(reports) await loopShowDeprecateNotes(reports)
} }
}, },
secondaryButton: .cancel(Text("Ok")) { secondaryButton: .cancel(Text("Ok")) {
Task.detached { Task.detached {
try await Task.sleep(nanoseconds: 300 * MSEC_PER_SEC) try await Task.sleep(nanoseconds: 300 * NSEC_PER_MSEC)
await loopShowDeprecateNotes(reports) await loopShowDeprecateNotes(reports)
} }
} }