Showing
1 changed file
with
18 additions
and
18 deletions
... | @@ -123,9 +123,9 @@ import CoreMotion | ... | @@ -123,9 +123,9 @@ import CoreMotion |
123 | } | 123 | } |
124 | 124 | ||
125 | DispatchQueue.main.async { | 125 | DispatchQueue.main.async { |
126 | - if (mIsTripStarted == true) { | 126 | + if (self.mIsTripStarted == true) { |
127 | // Stop trip | 127 | // Stop trip |
128 | - stopTrip() | 128 | + self.stopTrip() |
129 | 129 | ||
130 | } else { | 130 | } else { |
131 | // Start trip | 131 | // Start trip |
... | @@ -139,16 +139,16 @@ import CoreMotion | ... | @@ -139,16 +139,16 @@ import CoreMotion |
139 | // sampleTimeTextField.isEnabled = false | 139 | // sampleTimeTextField.isEnabled = false |
140 | 140 | ||
141 | // Start location and sensor updates | 141 | // Start location and sensor updates |
142 | - requestLocationUpdates() | 142 | + self.requestLocationUpdates() |
143 | // registerSensor() | 143 | // registerSensor() |
144 | 144 | ||
145 | - mIsTripStarted = true | 145 | + self.mIsTripStarted = true |
146 | // orientationCountLabel.text = "0" | 146 | // orientationCountLabel.text = "0" |
147 | // touchCountLabel.text = "0" | 147 | // touchCountLabel.text = "0" |
148 | - tripButton.setTitle("Stop Trip", for: .normal) | 148 | + self.tripButton.setTitle("Stop Trip", for: .normal) |
149 | - mStartTimestamp = String(Int(Date().timeIntervalSince1970 * 1000)) // time in milliseconds since January 1, 1970 | 149 | + self.mStartTimestamp = String(Int(Date().timeIntervalSince1970 * 1000)) // time in milliseconds since January 1, 1970 |
150 | - initializeOrientation() | 150 | + self.initializeOrientation() |
151 | - startTimer() | 151 | + self.startTimer() |
152 | } | 152 | } |
153 | } | 153 | } |
154 | } | 154 | } |
... | @@ -303,26 +303,26 @@ import CoreMotion | ... | @@ -303,26 +303,26 @@ import CoreMotion |
303 | private func requestLocationUpdates() { | 303 | private func requestLocationUpdates() { |
304 | DispatchQueue.global().async { | 304 | DispatchQueue.global().async { |
305 | if CLLocationManager.locationServicesEnabled() { | 305 | if CLLocationManager.locationServicesEnabled() { |
306 | - locationManager.desiredAccuracy = kCLLocationAccuracyBest | 306 | + self.locationManager.desiredAccuracy = kCLLocationAccuracyBest |
307 | // locationManager.requestLocation() | 307 | // locationManager.requestLocation() |
308 | 308 | ||
309 | - if (!locationServicesIsEnabled()) { | 309 | + if (!self.locationServicesIsEnabled()) { |
310 | - onLocationServicesIsDisabled(); | 310 | + self.onLocationServicesIsDisabled(); |
311 | - } | ||
312 | - else if (authorizationStatusIsDenied(status: CLLocationManager.authorizationStatus())) { | ||
313 | - onAuthorizationStatusIsDenied(); | ||
314 | } | 311 | } |
315 | - else if (authorizationStatusNeedRequest(status: CLLocationManager.authorizationStatus())) { | 312 | + else if (self.authorizationStatusIsDenied(status: CLLocationManager.authorizationStatus())) { |
316 | - onAuthorizationStatusNeedRequest(); | 313 | + self.onAuthorizationStatusIsDenied(); |
317 | } | 314 | } |
318 | - else if (authorizationStatusIsGranted(status: CLLocationManager.authorizationStatus())) { | 315 | + else if (self.authorizationStatusNeedRequest(status: CLLocationManager.authorizationStatus())) { |
319 | - onAuthorizationStatusIsGranted(); | 316 | + self.onAuthorizationStatusNeedRequest(); |
320 | } | 317 | } |
318 | + else if (self.authorizationStatusIsGranted(status: CLLocationManager.authorizationStatus())) { | ||
319 | + self.onAuthorizationStatusIsGranted(); | ||
321 | } | 320 | } |
322 | } else { | 321 | } else { |
323 | self.onLocationServicesIsDisabled(); | 322 | self.onLocationServicesIsDisabled(); |
324 | } | 323 | } |
325 | } | 324 | } |
325 | + } | ||
326 | 326 | ||
327 | private func stopLocationUpdates() { | 327 | private func stopLocationUpdates() { |
328 | locationManager.stopUpdatingLocation() | 328 | locationManager.stopUpdatingLocation() | ... | ... |
-
Please register or login to post a comment