small improvements

main
Laurent 3 years ago
parent 78b43f5f63
commit ef6a75724c
  1. 2
      LeCountdown/Conductor.swift
  2. 26
      LeCountdown/CountdownScheduler.swift
  3. 4
      LeCountdown/Sound/DelaySoundPlayer.swift
  4. 3
      LeCountdown/Views/LiveTimerListView.swift

@ -139,7 +139,6 @@ class Conductor: ObservableObject {
self.removeLiveTimer(id: countdown.stringId)
let sound = countdown.someSound
let soundPlayer = try DelaySoundPlayer(timerID: countdown.stringId, sound: sound)
FileLogger.log("a) self._delayedSoundPlayers count = \(self._delayedSoundPlayers.count)")
@ -159,6 +158,7 @@ class Conductor: ObservableObject {
handler(.success(date))
} catch {
FileLogger.log("start error : \(error.localizedDescription)")
Logger.error(error)
handler(.failure(error))
}

@ -39,16 +39,8 @@ class CountdownScheduler {
self._createNotification(countdown: countdown, content: content, handler: handler)
// content.sound = UNNotificationSound.criticalSoundNamed(UNNotificationSoundName(rawValue: sound), withAudioVolume: 1.0)
content.interruptionLevel = .critical
// content.interruptionLevel = .critical
content.relevanceScore = 1.0
// let notificationCount = 1 + countdown.repeatCount
// for i in 0..<notificationCount {
// let offset = Double(i) * 10.0 // every 30 seconds
// self._createNotification(countdown: countdown, offset: offset, content: content, handler: handler)
// }
}
@ -67,26 +59,10 @@ class CountdownScheduler {
if let error {
handler(.failure(error))
print("Scheduling error = \(error)")
} else {
// if offset == 0.0 {
// if let triggerDate = trigger.nextTriggerDate() {
// Conductor.maestro.startCountdown(triggerDate, countdown: countdown)
// handler(.success(triggerDate))
// } else {
// let backupDate = Date().addingTimeInterval(duration)
// Conductor.maestro.startCountdown(backupDate, countdown: countdown)
// }
// }
}
}
}
// DispatchQueue.main.async {
// let d = countdown.duration + offset
// let td = Date().addingTimeInterval(d)
// Conductor.maestro.startCountdown(td, countdown: countdown)
// }
}
func cancelCurrentNotifications(countdownId: String) {

@ -14,14 +14,14 @@ import AVFoundation
fileprivate var _timerID: TimerID
fileprivate var _soundDuration: TimeInterval?
// fileprivate var _soundDuration: TimeInterval?
fileprivate var _timer: Timer? = nil
init(timerID: TimerID, sound: Sound) throws {
self._timerID = timerID
self._soundDuration = Preferences.soundDurations[sound.fileName]
// self._soundDuration = Preferences.soundDurations[sound.fileName]
let soundFile = try sound.soundFile()
guard let url = soundFile.url else {

@ -127,6 +127,7 @@ struct LiveStopwatchView: View {
}
fileprivate func _actionHandler() {
FileLogger.log("stopwatch _actionHandler")
withAnimation {
if self.endDate == nil {
self._stop()
@ -204,7 +205,7 @@ struct LiveCountdownView: View {
fileprivate func _actionHandler() {
FileLogger.log("_actionHandler")
FileLogger.log("countdown _actionHandler")
withAnimation {
if conductor.currentCountdowns[self.countdown.stringId] != nil {
self._cancelCountdown()

Loading…
Cancel
Save