@@ -10,6 +10,7 @@ import driver_sdk.ActiveCustomerSdkFactory
1010import driver_sdk.BringgSdkActiveCustomerClient
1111import driver_sdk.connection.NetworkResult
1212import driver_sdk.content.ResultCallback
13+ import driver_sdk.customer.CustomerVehicle
1314import driver_sdk.customer.SdkSettings
1415import driver_sdk.models.TaskState
1516import 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