Fixed editing alarm tones.
This commit is contained in:
@@ -182,7 +182,7 @@ class AddAlarmViewController: EndEditingOnReturn
|
|||||||
let alarm = Alarm(hour: h, minute: m,
|
let alarm = Alarm(hour: h, minute: m,
|
||||||
text: alarmNameTextField.text ?? "Alarm",
|
text: alarmNameTextField.text ?? "Alarm",
|
||||||
wakeMethod: wvms[wvmPicker.selectedRow(inComponent: 0)],
|
wakeMethod: wvms[wvmPicker.selectedRow(inComponent: 0)],
|
||||||
lastActivate: Date(), alarmTone: ringtones[ringtonePicker.selectedRow(inComponent: 0)].tone)
|
lastActivate: Date(), alarmTone: ringtones[ringtonePicker.selectedRow(inComponent: 0)].tone, toneName: ringtones[ringtonePicker.selectedRow(inComponent: 0)].name)
|
||||||
|
|
||||||
// Set alarm.repeats to correspond with what the user selects
|
// Set alarm.repeats to correspond with what the user selects
|
||||||
(0...6).forEach { alarm.repeats[$0] = false }
|
(0...6).forEach { alarm.repeats[$0] = false }
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ class Alarms: Codable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Read alarms from local storage
|
/// Read alarms from local storage
|
||||||
func localRead() { list = JSON.parse([Alarm].self, localStorage.string(forKey: "alarms")!)! }
|
func localRead() { list = JSON.parse([Alarm].self, localStorage.string(forKey: "alarms")!) ?? []}
|
||||||
|
|
||||||
/// Read an alarm object from local storage
|
/// Read an alarm object from local storage
|
||||||
static func fromLocal() -> Alarms { return Alarms().apply { $0.localRead() } }
|
static func fromLocal() -> Alarms { return Alarms().apply { $0.localRead() } }
|
||||||
|
|||||||
Reference in New Issue
Block a user