Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export const getNavigationViewController = (
return {
setDestination: (waypoint: Waypoint, routingOptions?: RoutingOptions) => {
let args: object[] = [];
args.push(waypoint);
args.push([waypoint]);

if (routingOptions != null) {
args.push(routingOptions);
}

sendCommand(viewId, commands.setDestination, args);
sendCommand(viewId, commands.setDestinations, args);
},
setDestinations: (
waypoints: Waypoint[],
Expand Down
26 changes: 15 additions & 11 deletions ios/react-native-navigation-sdk/NavViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -201,25 +201,29 @@ - (void)setDestinations:(NSArray *)waypoints
destinations = [[NSMutableArray alloc] init];

for (NSDictionary *wp in waypoints) {
NSString *placeId = @"";
GMSNavigationMutableWaypoint *w;

placeId = wp[@"placeId"];
NSString *placeId = wp[@"placeId"];

if ([placeId isEqual:@""] && wp[@"position"] != nil) {
if (placeId && ![placeId isEqual:@""]) {
w = [[GMSNavigationMutableWaypoint alloc] initWithPlaceID:placeId title:wp[@"title"]];
} else if (wp[@"position"]) {
w = [[GMSNavigationMutableWaypoint alloc]
initWithLocation:[ObjectTranslationUtil getLocationCoordinateFrom:wp[@"position"]]
title:wp[@"title"]
preferSameSideOfRoad:wp[@"preferSameSideOfRoad"]];
w.vehicleStopover = wp[@"vehicleStopover"];
initWithLocation:[ObjectTranslationUtil getLocationCoordinateFrom:wp[@"position"]]
title:wp[@"title"]];
} else {
// The validation will be done on the client, so just ignore this waypoint here.
continue;
}

if (![placeId isEqual:@""]) {
w = [[GMSNavigationMutableWaypoint alloc] initWithPlaceID:placeId title:wp[@"title"]];
w.vehicleStopover = wp[@"vehicleStopover"];
w.preferSameSideOfRoad = wp[@"preferSameSideOfRoad"];
if (wp[@"preferSameSideOfRoad"] != nil) {
w.preferSameSideOfRoad = [wp[@"preferSameSideOfRoad"] boolValue];
}

if (wp[@"vehicleStopover"] != nil) {
w.vehicleStopover = [wp[@"vehicleStopover"] boolValue];
}

if (wp[@"preferredHeading"] != nil) {
w.preferredHeading = [wp[@"preferredHeading"] intValue];
}
Expand Down
8 changes: 0 additions & 8 deletions ios/react-native-navigation-sdk/RCTNavViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,6 @@ + (BOOL)requiresMainQueueSetup {
});
}

RCT_EXPORT_METHOD(setDestination: (nonnull NSNumber *)reactTag
waypoints: (nonnull NSArray *)waypoints
routingOptions: (NSDictionary *)routingOptions) {
dispatch_async(dispatch_get_main_queue(), ^{
[viewController setDestinations:waypoints withRoutingOptions: routingOptions];
});
}

RCT_EXPORT_METHOD(setDestinations: (nonnull NSNumber *)reactTag
waypoints: (nonnull NSArray *)waypoints
routingOptions: (NSDictionary *)routingOptions) {
Expand Down