diff --git a/ProjectClock/AlarmActivator.swift b/ProjectClock/AlarmActivator.swift
index 53c95e1..0d6900a 100644
--- a/ProjectClock/AlarmActivator.swift
+++ b/ProjectClock/AlarmActivator.swift
@@ -6,20 +6,26 @@
//
import Foundation
+import UIKit
/**
Class to activate alarms when the user is inside the app
Note: This will not run when app is switched to the background or when the display is turned off, but it will run right after the user switched back to the app.
*/
-class AlarmActivator
+class AlarmActivator: UITabBarController
{
/// Interval in seconds
- static var interval = 1.0
+ static var interval = 2.0
/// Timer for scheduled calls
var timer: Timer?
+ override func viewDidLoad()
+ {
+ start()
+ }
+
/**
Start detecting alarms
*/
@@ -43,9 +49,11 @@ class AlarmActivator
*/
@objc func check()
{
+ NSLog("Check")
+
// Get the alarm to activate
guard let alarm = Alarms.fromLocal().listActivating.first else { return }
NSLog(JSON.stringify(alarm)!)
-
+ performSegue(withIdentifier: "activate-alarmactivate-alarm", sender: nil)
}
}
diff --git a/ProjectClock/AppDelegate.swift b/ProjectClock/AppDelegate.swift
index 1f37015..9306d1c 100644
--- a/ProjectClock/AppDelegate.swift
+++ b/ProjectClock/AppDelegate.swift
@@ -10,8 +10,6 @@ import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate
{
- var alarmActivator: AlarmActivator!
-
/// Override point for customization after application launch.
func application(_ app: UIApplication, didFinishLaunchingWithOptions op: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
@@ -20,10 +18,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate
"alarms": JSON.stringify([Alarm(enabled: true, hour: 7, minute: 20, text: "Wake up lol", wakeMethod: wvms[0])])!
])
- // Start alarm activator
- alarmActivator = AlarmActivator()
- alarmActivator.start()
-
return true
}
diff --git a/ProjectClock/Base.lproj/Main.storyboard b/ProjectClock/Base.lproj/Main.storyboard
index 2d307b8..6157961 100644
--- a/ProjectClock/Base.lproj/Main.storyboard
+++ b/ProjectClock/Base.lproj/Main.storyboard
@@ -25,7 +25,7 @@
-
+
@@ -422,6 +422,9 @@
+
+
+