Added alarmTone property to Alarm class.

This commit is contained in:
Aaron
2021-01-24 18:09:40 -05:00
parent 26aa07f4b1
commit 49576828b6
2 changed files with 6 additions and 2 deletions
@@ -63,7 +63,7 @@ class AlarmActivationViewController: UIViewController
@objc func playSound() @objc func playSound()
{ {
AudioServicesPlayAlertSound(SystemSoundID(1005)) AudioServicesPlayAlertSound(currentAlarm!.alarmTone)
AudioServicesPlayAlertSound(kSystemSoundID_Vibrate) AudioServicesPlayAlertSound(kSystemSoundID_Vibrate)
} }
+5 -1
View File
@@ -6,6 +6,7 @@
// //
import Foundation import Foundation
import AVFoundation
struct User: Codable struct User: Codable
{ {
@@ -44,6 +45,7 @@ class Alarm: Codable
var minute: Int var minute: Int
var text: String var text: String
var wakeMethod: WVM var wakeMethod: WVM
var alarmTone: SystemSoundID
/// What days does it repeat (Sun, Mon, Tue, Wed, Thu, Fri, Sat) /// What days does it repeat (Sun, Mon, Tue, Wed, Thu, Fri, Sat)
var repeats: [Bool] var repeats: [Bool]
@@ -55,7 +57,8 @@ class Alarm: Codable
init(enabled: Bool = true, init(enabled: Bool = true,
hour: Int, minute: Int, text: String, wakeMethod: WVM, hour: Int, minute: Int, text: String, wakeMethod: WVM,
repeats: [Bool] = [false, true, true, true, true, true, false], repeats: [Bool] = [false, true, true, true, true, true, false],
lastActivate: Date = Date() lastActivate: Date = Date(),
alarmTone: SystemSoundID = SystemSoundID(1005)
) )
{ {
self.enabled = enabled self.enabled = enabled
@@ -65,6 +68,7 @@ class Alarm: Codable
self.wakeMethod = wakeMethod self.wakeMethod = wakeMethod
self.repeats = repeats self.repeats = repeats
self.lastActivate = lastActivate self.lastActivate = lastActivate
self.alarmTone = alarmTone
} }
/// Does it automatically disable after activating once /// Does it automatically disable after activating once