Skip to content
Open
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
3 changes: 3 additions & 0 deletions src/directions.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export interface NavigateToOptions {
* Default false.
*/
allowGoogleMapsWeb?: boolean;

preferYandexNavi? : boolean;

};
}

Expand Down
8 changes: 6 additions & 2 deletions src/directions.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ export class Directions extends DirectionsCommon implements DirectionsApi {
try {
const fromToQs = Directions.getFromToQuerystring(options);

if ((options.ios === undefined || options.ios.preferGoogleMaps !== false) && isAppAvailable("comgooglemaps://")) {
if ((options.ios === undefined || options.ios.preferYandexNavi !== false) && isAppAvailable("yandexnavi://")) {
//this is the documentation of yandexnavi route map https://github.com/yandexmobile/yandexmapkit-ios/wiki/%D0%98%D0%BD%D1%82%D0%B5%D0%B3%D1%80%D0%B0%D1%86%D0%B8%D1%8F-%D1%81-%D0%AF%D0%BD%D0%B4%D0%B5%D0%BA%D1%81.%D0%9D%D0%B0%D0%B2%D0%B8%D0%B3%D0%B0%D1%82%D0%BE%D1%80%D0%BE%D0%BC
const toArray = options.to instanceof Array ? options.to : [options.to];
utils.openUrl(`yandexnavi://build_route_on_map?lat_to=${toArray[0].lat}&lon_to=${toArray[0].lng}`);
} else if ((options.ios === undefined || options.ios.preferGoogleMaps !== false) && isAppAvailable("comgooglemaps://")) {
// if Google maps is installed, use that, otherwise use Apple maps (which doesn't support waypoints.. so nav to the first destination if that's used)
// url = `http://maps.google.com/maps?${fromToQs}+to:${encodeURIComponent("Weerdestein 144, Dordrecht, Netherlands")}`;
utils.openUrl("comgooglemaps://" + fromToQs);
} else if (options.ios && options.ios.allowGoogleMapsWeb && options.to instanceof Array && options.to.length > 1) {
}else if (options.ios && options.ios.allowGoogleMapsWeb && options.to instanceof Array && options.to.length > 1) {
utils.openUrl("http://maps.google.com/maps" + fromToQs);
} else {
utils.openUrl("http://maps.apple.com/maps" + fromToQs);
Expand Down