Skip to content

Commit

Permalink
refactor: refactor setDestination on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
illuminati1911 committed Dec 4, 2024
1 parent 8942d26 commit a3f3d1a
Showing 1 changed file with 3 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,34 +407,9 @@ public void setDestination(
ReadableMap waypoint,
@Nullable ReadableMap routingOptions,
@Nullable ReadableMap displayOptions) {
pendingRoute = null; // reset pendingRoute.
mWaypoints.clear(); // reset waypoints
createWaypoint(waypoint.toHashMap());

if (routingOptions != null) {
if (displayOptions != null) {
pendingRoute =
mNavigator.setDestination(
mWaypoints.get(0),
ObjectTranslationUtil.getRoutingOptionsFromMap(routingOptions.toHashMap()),
ObjectTranslationUtil.getDisplayOptionsFromMap(displayOptions.toHashMap()));
} else {
pendingRoute =
mNavigator.setDestination(
mWaypoints.get(0),
ObjectTranslationUtil.getRoutingOptionsFromMap(routingOptions.toHashMap()));
}
} else {
pendingRoute = mNavigator.setDestination(mWaypoints.get(0));
}

setOnResultListener(
new IRouteStatusResult() {
@Override
public void onResult(Navigator.RouteStatus code) {
sendCommandToReactNative("onRouteStatusResult", code.toString());
}
});
WritableArray array = new WritableNativeArray();
array.pushMap(waypoint);
setDestinations(array, routingOptions, displayOptions);
}

@ReactMethod
Expand Down

0 comments on commit a3f3d1a

Please sign in to comment.