diff --git a/ProjectClock/Base.lproj/Main.storyboard b/ProjectClock/Base.lproj/Main.storyboard index 90a37e0..90e8e24 100644 --- a/ProjectClock/Base.lproj/Main.storyboard +++ b/ProjectClock/Base.lproj/Main.storyboard @@ -339,30 +339,60 @@ - - + + + + + + + + + + - - - - + + + + + + + + + diff --git a/ProjectClock/TestingViewController.swift b/ProjectClock/TestingViewController.swift index 13e9b07..459c1cc 100644 --- a/ProjectClock/TestingViewController.swift +++ b/ProjectClock/TestingViewController.swift @@ -8,11 +8,13 @@ import UIKit import UserNotifications -class TestingViewController: UIViewController { - - override func viewDidLoad() { +class TestingViewController: UIViewController +{ + override func viewDidLoad() + { super.viewDidLoad() + // Request notification permission UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { success, error in if success { print("All set!") @@ -20,16 +22,16 @@ class TestingViewController: UIViewController { print(error.localizedDescription) } } - - // Do any additional setup after loading the view. } - @IBAction func getAccel(_ sender: Any) { + @IBAction func getAccel(_ sender: Any) + { getAccelerometer() } //Sends a test notification - @IBAction func sendNotification(_ sender: Any) { + @IBAction func sendNotification(_ sender: Any) + { let alarm = Alarm(enabled: true, hour: 7, minute: 20, text: "Good morning!", wakeMethod: WVM(name: "walking", desc: "Walk")) let content = UNMutableNotificationContent() @@ -58,14 +60,11 @@ class TestingViewController: UIViewController { UNUserNotificationCenter.current().add(request, withCompletionHandler: nil) } - /* - // MARK: - Navigation - - // In a storyboard-based application, you will often want to do a little preparation before navigation - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { - // Get the new view controller using segue.destination. - // Pass the selected object to the new view controller. + @IBAction func addAlarm(_ sender: Any) + { + let (h, m, _) = Date().getHMS() + let alarms = Alarms.fromLocal() + alarms.list.append(Alarm(enabled: true, hour: h, minute: m, text: "Test alarm - \(h * m)", wakeMethod: wvms[0])) + alarms.localSave() } - */ - }