Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2023-11-06 14:41:35 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
67904179c7a4f922f94ba989faa73be1275989ff
67904179
1 parent
9cab2c71
locationServices enable request fix TelematicsMain
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
SwiftWarplyFramework/SwiftWarplyFramework/TelematicsMainViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/TelematicsMainViewController.swift
View file @
6790417
...
...
@@ -116,34 +116,43 @@ import CoreMotion
// MARK: Actions
@IBAction
private
func
tripButtonTapped
(
_
sender
:
UIButton
)
{
DispatchQueue
.
global
()
.
async
{
if
(
!
self
.
locationServicesIsEnabled
())
{
self
.
onLocationServicesIsDisabled
();
return
;
}
DispatchQueue
.
main
.
async
{
if
(
mIsTripStarted
==
true
)
{
// Stop trip
stopTrip
()
}
else
{
// Start trip
// if let limitText = accelerationLimitTextField.text, limitText.isEmpty {
// // Handle empty limit field
// return
// }
// if let limitText = accelerationLimitTextField.text, limitText.isEmpty {
// // Handle empty limit field
// return
// }
// Disable UI elements
// accelerationLimitTextField.isEnabled = false
// sampleTimeTextField.isEnabled = false
// accelerationLimitTextField.isEnabled = false
// sampleTimeTextField.isEnabled = false
// Start location and sensor updates
requestLocationUpdates
()
// registerSensor()
// registerSensor()
mIsTripStarted
=
true
// orientationCountLabel.text = "0"
// touchCountLabel.text = "0"
// orientationCountLabel.text = "0"
// touchCountLabel.text = "0"
tripButton
.
setTitle
(
"Stop Trip"
,
for
:
.
normal
)
mStartTimestamp
=
String
(
Int
(
Date
()
.
timeIntervalSince1970
*
1000
))
// time in milliseconds since January 1, 1970
initializeOrientation
()
startTimer
()
}
}
}
}
private
func
stopTrip
()
{
...
...
@@ -289,9 +298,10 @@ import CoreMotion
}
private
func
requestLocationUpdates
()
{
DispatchQueue
.
global
()
.
async
{
if
CLLocationManager
.
locationServicesEnabled
()
{
locationManager
.
desiredAccuracy
=
kCLLocationAccuracyBest
// locationManager.requestLocation()
// locationManager.requestLocation()
if
(
!
locationServicesIsEnabled
())
{
onLocationServicesIsDisabled
();
...
...
@@ -306,6 +316,9 @@ import CoreMotion
onAuthorizationStatusIsGranted
();
}
}
}
else
{
self
.
onLocationServicesIsDisabled
();
}
}
private
func
stopLocationUpdates
()
{
...
...
Please
register
or
login
to post a comment