Skip to content

Commit

Permalink
Update SDK initialization, update demo app
Browse files Browse the repository at this point in the history
  • Loading branch information
sgusakovsky committed Jan 11, 2024
1 parent 2333c28 commit c35f366
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 138 deletions.
20 changes: 10 additions & 10 deletions android/src/main/kotlin/com/telematicssdk/TelematicsSDKPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ class TelematicsSDKPlugin : ActivityAware, ActivityResultListener, FlutterPlugin
"isTracking" -> isTracking(result)
"setDeviceID" -> setDeviceID(call, result)
"setEnableSdk" -> setEnableSdk(call, result)
"startTracking" -> startTracking(result)
"stopTracking" -> stopTracking(result)
"setDisableWithUpload" -> setDisableWithUpload(result)
"startManualTracking" -> startManualTracking(result)
"stopManualTracking" -> stopManualTracking(result)
"showPermissionWizard" -> showPermissionWizard(call, result)
"getTrackTags" -> getTrackTags(call, result)
"addTrackTags" -> addTrackTags(call, result)
Expand Down Expand Up @@ -156,23 +157,22 @@ class TelematicsSDKPlugin : ActivityAware, ActivityResultListener, FlutterPlugin

private fun setEnableSdk(call: MethodCall, result: Result) {
val enable = call.argument<Boolean?>("enable") as Boolean
val uploadBeforeDisabling = call.argument<Boolean?>("uploadBeforeDisabling") as Boolean
api.setEnableSdk(enable)
result.success(null)
}

if (!enable && uploadBeforeDisabling) {
api.setDisableWithUpload()
} else {
api.setEnableSdk(enable)
}
private fun setDisableWithUpload(result: Result) {
api.setDisableWithUpload()
result.success(null)
}

private fun startTracking(result: Result) {
private fun startManualTracking(result: Result) {
val startResult = api.startTracking()

result.success(startResult)
}

private fun stopTracking(result: Result) {
private fun stopManualTracking(result: Result) {
val stopResult = api.stopTracking()

result.success(stopResult)
Expand Down
Loading

0 comments on commit c35f366

Please sign in to comment.