Manos Chorianopoulos

telematics registerSensor fix

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -14,6 +14,8 @@ import CoreMotion
// MARK: Constants and Properties
private var mIsTripStarted = false
private var hasLocationPermissions = false
private var isFirstLoad = true
private var mAccelerationTimestamps = [[String: Any]]()
private var locationManager: CLLocationManager!
private var motionManager: CMMotionManager!
......@@ -68,6 +70,8 @@ import CoreMotion
accelerationLimitTextField.delegate = self
sampleTimeTextField.delegate = self
hasLocationPermissions = authorizationStatusIsGranted(status: CLLocationManager.authorizationStatus())
orientationCountLabel.text = "0"
touchCountLabel.text = "0"
recordsSavedLabel.text = "0"
......@@ -451,8 +455,13 @@ import CoreMotion
func onAuthorizationStatusIsGranted() {
// print("=== onAuthorizationStatusIsGranted === ")
locationManager.startUpdatingLocation();
// registerSensor()
if (!isFirstLoad || (isFirstLoad && !hasLocationPermissions)) {
registerSensor()
}
hasLocationPermissions = true
isFirstLoad = false
}
func onAuthorizationStatusIsDenied() {
......