|
|
|
|
@ -8,6 +8,7 @@ |
|
|
|
|
import Foundation |
|
|
|
|
import ActivityKit |
|
|
|
|
import BackgroundTasks |
|
|
|
|
import SwiftUI |
|
|
|
|
|
|
|
|
|
enum Key: String { |
|
|
|
|
case countdowns |
|
|
|
|
@ -33,14 +34,18 @@ class Conductor: ObservableObject { |
|
|
|
|
@Published var currentCountdowns: [String : DateInterval] = [:] { |
|
|
|
|
didSet { |
|
|
|
|
Conductor.savedCountdowns = currentCountdowns |
|
|
|
|
self._buildLiveTimers() |
|
|
|
|
withAnimation { |
|
|
|
|
self._buildLiveTimers() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Published var currentStopwatches: [String : Date] = [:] { |
|
|
|
|
didSet { |
|
|
|
|
Conductor.savedStopwatches = currentStopwatches |
|
|
|
|
self._buildLiveTimers() |
|
|
|
|
withAnimation { |
|
|
|
|
self._buildLiveTimers() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -51,6 +56,7 @@ class Conductor: ObservableObject { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fileprivate func _buildLiveTimers() { |
|
|
|
|
|
|
|
|
|
let liveCountdowns = self.currentCountdowns.map { |
|
|
|
|
return LiveTimer(id: $0, date: $1.end) |
|
|
|
|
} |
|
|
|
|
|