[O] Stop motion detection after alarm stopped

This commit is contained in:
Hykilpikonna
2021-01-27 18:32:25 -05:00
parent 7089e480ae
commit 33718976f9
@@ -106,11 +106,13 @@ class AlarmActivationViewController: UIViewController
case "Shake":
shakeView.show()
// Start motion detection
motion.accelerometerUpdateInterval = 0.2
motion.startAccelerometerUpdates(to: OperationQueue.current!) { data, error in
if data!.acceleration.x > 5
{
ui { self.endAlarm() }
motion.stopAccelerometerUpdates()
}
}
default: