diff --git a/LeCountdown/Conductor.swift b/LeCountdown/Conductor.swift index 2b93179..d987a14 100644 --- a/LeCountdown/Conductor.swift +++ b/LeCountdown/Conductor.swift @@ -71,6 +71,10 @@ class Conductor: ObservableObject { } } + fileprivate func _cleanupLiveTimers() { + self.liveTimers.removeAll() + } + fileprivate func _buildLiveTimers() { Logger.log("_buildLiveTimers") @@ -226,7 +230,7 @@ class Conductor: ObservableObject { } } - func restore() { + func restoreSoundPlayers() { for (countdownId, interval) in self.currentCountdowns { if !self._delayedSoundPlayers.contains(where: { $0.key == countdownId }) { @@ -253,7 +257,11 @@ class Conductor: ObservableObject { func cleanup() { self._cleanupCountdowns() - self._buildLiveTimers() + + withAnimation { + self._cleanupLiveTimers() + self._buildLiveTimers() + } } fileprivate func _cleanupCountdowns() { diff --git a/LeCountdown/LeCountdownApp.swift b/LeCountdown/LeCountdownApp.swift index 7500570..85e455e 100644 --- a/LeCountdown/LeCountdownApp.swift +++ b/LeCountdown/LeCountdownApp.swift @@ -68,7 +68,7 @@ struct LeCountdownApp: App { case .active: Logger.log("onChange(of: scenePhase) active") Logger.log(Conductor.maestro.currentCountdowns.count) - Conductor.maestro.restore() + Conductor.maestro.restoreSoundPlayers() Conductor.maestro.cleanup() default: break