[+] Add wvm selector for adding debug alarms

This commit is contained in:
Hykilpikonna
2021-01-27 18:16:35 -05:00
parent 00e55b44cb
commit 492320e4d6
2 changed files with 44 additions and 12 deletions
+9 -1
View File
@@ -13,6 +13,9 @@ class DebugViewController: UIViewController
@IBOutlet weak var userModeButton: UIButton!
var darkMode = false
@IBOutlet weak var wvmInput: UITextField!
@IBOutlet weak var wvmStepper: UIStepper!
override func viewDidLoad()
{
super.viewDidLoad()
@@ -36,7 +39,7 @@ class DebugViewController: UIViewController
@IBAction func addAlarm(_ sender: Any)
{
let (h, m, _) = Date().getHMS()
let alarm = Alarm(hour: h, minute: m, text: "Test alarm - \(h * m)", wakeMethod: wvms[1], repeats: [true, true, true, true, true, true, true], lastActivate: Date().added(.minute, -1))
let alarm = Alarm(hour: h, minute: m, text: "Test alarm - \(h * m)", wakeMethod: wvms[Int(wvmStepper.value)], repeats: [true, true, true, true, true, true, true], lastActivate: Date().added(.minute, -1))
Alarms.fromLocal().apply { $0.list.append(alarm) }.localSave()
Notification.scheduleNotification(alarm: alarm)
@@ -47,6 +50,11 @@ class DebugViewController: UIViewController
Alarms.fromLocal().apply { $0.list.removeAll() }.localSave()
}
@IBAction func wvmStepperChange(_ sender: Any)
{
wvmInput.text = String(wvmStepper.value)
}
@IBAction func switchViewingMode(_ sender: Any) {
if !darkMode {
view.window?.overrideUserInterfaceStyle = .dark