Manos Chorianopoulos

telematics registerSensor fix

...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>1</integer> 10 + <integer>0</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> 7 <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>0</integer> 10 + <integer>1</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
......
...@@ -14,6 +14,8 @@ import CoreMotion ...@@ -14,6 +14,8 @@ import CoreMotion
14 // MARK: Constants and Properties 14 // MARK: Constants and Properties
15 15
16 private var mIsTripStarted = false 16 private var mIsTripStarted = false
17 + private var hasLocationPermissions = false
18 + private var isFirstLoad = true
17 private var mAccelerationTimestamps = [[String: Any]]() 19 private var mAccelerationTimestamps = [[String: Any]]()
18 private var locationManager: CLLocationManager! 20 private var locationManager: CLLocationManager!
19 private var motionManager: CMMotionManager! 21 private var motionManager: CMMotionManager!
...@@ -68,6 +70,8 @@ import CoreMotion ...@@ -68,6 +70,8 @@ import CoreMotion
68 accelerationLimitTextField.delegate = self 70 accelerationLimitTextField.delegate = self
69 sampleTimeTextField.delegate = self 71 sampleTimeTextField.delegate = self
70 72
73 + hasLocationPermissions = authorizationStatusIsGranted(status: CLLocationManager.authorizationStatus())
74 +
71 orientationCountLabel.text = "0" 75 orientationCountLabel.text = "0"
72 touchCountLabel.text = "0" 76 touchCountLabel.text = "0"
73 recordsSavedLabel.text = "0" 77 recordsSavedLabel.text = "0"
...@@ -451,8 +455,13 @@ import CoreMotion ...@@ -451,8 +455,13 @@ import CoreMotion
451 func onAuthorizationStatusIsGranted() { 455 func onAuthorizationStatusIsGranted() {
452 // print("=== onAuthorizationStatusIsGranted === ") 456 // print("=== onAuthorizationStatusIsGranted === ")
453 locationManager.startUpdatingLocation(); 457 locationManager.startUpdatingLocation();
458 +// registerSensor()
459 + if (!isFirstLoad || (isFirstLoad && !hasLocationPermissions)) {
454 registerSensor() 460 registerSensor()
455 } 461 }
462 + hasLocationPermissions = true
463 + isFirstLoad = false
464 + }
456 465
457 func onAuthorizationStatusIsDenied() { 466 func onAuthorizationStatusIsDenied() {
458 467
......