[F] Fix repeats
This commit is contained in:
@@ -58,8 +58,11 @@ class AddAlarmViewController: UIViewController
|
||||
wakeMethod: wvms[wvmPicker.selectedRow(inComponent: 0)],
|
||||
lastActivate: Date())
|
||||
|
||||
// TODO: 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 }
|
||||
if repeatWeekdaysSwitch.isOn { (1...5).forEach { alarm.repeats[$0] = true } }
|
||||
if repeatWeekendsSwitch.isOn { [0, 6].forEach { alarm.repeats[$0] = true } }
|
||||
if (alarm.repeats.allSatisfy { !$0 }) { alarm.oneTime = true }
|
||||
|
||||
// Add the alarm to the list and save the list
|
||||
Alarms.fromLocal().apply { $0.list.append(alarm) }.localSave();
|
||||
|
||||
Reference in New Issue
Block a user