End previous live activity when launching a new timer

main
Laurent 3 years ago
parent de847a739e
commit 0522ca17cf
  1. 5
      LeCountdown/Conductor.swift

@ -137,7 +137,7 @@ class Conductor: ObservableObject {
DispatchQueue.main.async {
let countdownId = countdown.stringId
self._cleanupCurrentTimerIfNecessary(countdownId)
self._cleanupPreviousTimerIfNecessary(countdownId)
do {
let start = Date()
@ -171,11 +171,12 @@ class Conductor: ObservableObject {
}
}
fileprivate func _cleanupCurrentTimerIfNecessary(_ timerId: TimerID) {
fileprivate func _cleanupPreviousTimerIfNecessary(_ timerId: TimerID) {
self.removeLiveTimer(id: timerId)
if let player = self._delayedSoundPlayers[timerId] {
player.stop() // release resources
}
self._endLiveActivity(timerId: timerId)
}
func cancelCountdown(id: TimerID) {

Loading…
Cancel
Save