Improvements

main
Laurent 3 years ago
parent d81d951f43
commit 51b0430b47
  1. 12
      LeCountdown/Conductor.swift
  2. 2
      LeCountdown/LeCountdownApp.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() {

@ -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

Loading…
Cancel
Save