[F] Fix repeats

This commit is contained in:
Hykilpikonna
2021-01-23 23:54:24 -05:00
parent 3129dc5b80
commit dda2d48ea0
3 changed files with 27 additions and 24 deletions
+5 -2
View File
@@ -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();