Manos Chorianopoulos

add logs to steps

......@@ -59,7 +59,13 @@ public class swiftApi {
func startTrackingCallback(_ steps: NSNumber?) -> Void {
print("=== steps ===")
print(steps as? Int ?? 0)
if (steps != nil) {
print("=== steps to save ===")
print((steps as! Int) - GlobalVariables.savedSteps)
swiftApi().setSteps((steps as! Int) - GlobalVariables.savedSteps)
}
......@@ -97,11 +103,14 @@ public class swiftApi {
}
func startTimer() {
print("========= Timer Started! =========")
let queue = DispatchQueue(label: Bundle.main.bundleIdentifier! + ".timer")
timer = DispatchSource.makeTimerSource(queue: queue)
timer!.schedule(deadline: .now(), repeating: .seconds(10))
timer!.setEventHandler { [weak self] in
// do whatever stuff you want on the background queue here here
print("========= interval! =========")
let persistedSteps = swiftApi().getSteps()
if (persistedSteps > 0) {
......@@ -132,6 +141,7 @@ public class swiftApi {
}
func stopTimer() {
print("========= Timer Stopped! =========")
timer?.cancel()
timer = nil
}
......