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