Skip to content

Commit b9dfeca

Browse files
Merge pull request #21 from bringg/feature/MOBILE-5751-Parking-And-Vehicle-Details-clean
MOBILE-5751 - React Native - Parking and vehicle details on waypoint arrival
2 parents 8366b1c + 1012ba2 commit b9dfeca

File tree

18 files changed

+19834
-4971
lines changed

18 files changed

+19834
-4971
lines changed

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ android {
3535
versionName "1.0"
3636
multiDexEnabled true
3737
}
38-
38+
3939
buildTypes {
4040
release {
4141
minifyEnabled false
@@ -127,5 +127,5 @@ dependencies {
127127
// noinspection GradleDynamicVersion
128128
api 'com.facebook.react:react-native:+'
129129
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
130-
implementation 'com.bringg:driver_sdk:1.3.10'
130+
implementation 'com.bringg:driver_sdk:1.3.11'
131131
}

android/src/main/java/com/reactnativebringgdriversdk/BringgDriverSdkModule.kt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import driver_sdk.ActiveCustomerSdkFactory
1010
import driver_sdk.BringgSdkActiveCustomerClient
1111
import driver_sdk.connection.NetworkResult
1212
import driver_sdk.content.ResultCallback
13+
import driver_sdk.customer.CustomerVehicle
1314
import driver_sdk.customer.SdkSettings
1415
import driver_sdk.models.TaskState
1516
import driver_sdk.models.enums.LoginResult
@@ -141,6 +142,36 @@ class BringgDriverSdkModule(reactContext: ReactApplicationContext) : ReactContex
141142
})
142143
}
143144

145+
@ReactMethod
146+
fun arriveAtWaypointWithCustomerVehicle(saveVehicle: Boolean, licensePlate: String?, color: String?, model: String?, parkingSpot: String?, promise: Promise) {
147+
if (rejectIfNotInitialized(promise))
148+
return
149+
val customerVehicle = CustomerVehicle(null, saveVehicle, licensePlate, color, model, parkingSpot)
150+
return arriveAtWaypointWithCustomerVehicle(customerVehicle, promise)
151+
}
152+
153+
@ReactMethod
154+
fun arriveAtWaypointWithCustomerVehicleAndVehicleId(vehicleId: Double, saveVehicle: Boolean, licensePlate: String?, color: String?, model: String?, parkingSpot: String?, promise: Promise) {
155+
if (rejectIfNotInitialized(promise))
156+
return
157+
val customerVehicle = CustomerVehicle(vehicleId.toLong(), saveVehicle, licensePlate, color, model, parkingSpot)
158+
return arriveAtWaypointWithCustomerVehicle(customerVehicle, promise)
159+
}
160+
161+
private fun arriveAtWaypointWithCustomerVehicle(customerVehicle: CustomerVehicle, promise: Promise)
162+
{
163+
if (rejectIfNotInitialized(promise))
164+
return
165+
activeCustomerClient?.getActiveCustomerActions()?.arriveToWaypoint(customerVehicle, object : ResultCallback<ArriveWaypointResult> {
166+
override fun onResult(result: ArriveWaypointResult) {
167+
if (result.success())
168+
promise.resolve()
169+
else
170+
promise.reject(RequestFailedException("Failed to arrive to waypoint " + result.resultCode))
171+
}
172+
})
173+
}
174+
144175
@ReactMethod
145176
fun leaveWaypoint(promise: Promise) {
146177
if (rejectIfNotInitialized(promise))

0 commit comments

Comments
 (0)