react-native-map-link 3.3.1 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -3
- package/lib/index.d.ts +1 -1
- package/lib/index.js +7 -1
- package/lib/type.d.ts +5 -2
- package/lib/utils.d.ts +8 -6
- package/lib/utils.js +197 -72
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -249,8 +249,8 @@ showLocation({
|
|
|
249
249
|
latitude: 38.8976763,
|
|
250
250
|
longitude: -77.0387185,
|
|
251
251
|
sourceLatitude: -8.0870631, // optionally specify starting location for directions
|
|
252
|
-
sourceLongitude: -34.8941619, //
|
|
253
|
-
title: 'The White House', // optional
|
|
252
|
+
sourceLongitude: -34.8941619, // required if sourceLatitude is specified
|
|
253
|
+
title: 'The White House', // optional
|
|
254
254
|
googleForceLatLon: false, // optionally force GoogleMaps to use the latlon for the query instead of the title
|
|
255
255
|
googlePlaceId: 'ChIJGVtI4by3t4kRr51d_Qm_x58', // optionally specify the google-place-id
|
|
256
256
|
alwaysIncludeGoogle: true, // optional, true will always add Google Maps to iOS and open in Safari, even if app is not installed (default: false)
|
|
@@ -265,12 +265,23 @@ showLocation({
|
|
|
265
265
|
});
|
|
266
266
|
```
|
|
267
267
|
|
|
268
|
+
Alternatively you can specify the `address` field and leave the latitude and longitude properties as empty strings
|
|
269
|
+
|
|
270
|
+
```js
|
|
271
|
+
import {showLocation} from 'react-native-map-link';
|
|
272
|
+
|
|
273
|
+
showLocation({
|
|
274
|
+
address: '1600 Pennsylvania Avenue NW, Washington, DC 20500', // Required if replacing latitude and longitude
|
|
275
|
+
app: 'comgooglemaps', // optionally specify specific app to use
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
268
279
|
Notes:
|
|
269
280
|
|
|
270
281
|
- The `sourceLatitude` / `sourceLongitude` options only work if you specify both. Currently supports all apps except Waze.
|
|
271
282
|
- `directionsMode` works on google-maps, apple-maps and sygic (on apple-maps, `bike` mode will not work, while on sygic, only `walk` and `car` will work). Without setting it, the app will decide based on its own settings.
|
|
272
283
|
- If you set `directionsMode` but do not set `sourceLatitude` and `sourceLongitude`, google-maps and apple-maps will still enter directions mode, and use the current location as starting point.
|
|
273
|
-
-
|
|
284
|
+
- If you want to query an address instead of passing the `latitude` and `longitude` fields, you can do this by leaving those fields off and provide a full address to be queried with the `address` field. Just be aware that not all applications support this.
|
|
274
285
|
|
|
275
286
|
### Or
|
|
276
287
|
|
|
@@ -296,6 +307,7 @@ const Demo = () => {
|
|
|
296
307
|
const result = await getApps({
|
|
297
308
|
latitude: 38.8976763,
|
|
298
309
|
longitude: -77.0387185,
|
|
310
|
+
address: '1600 Pennsylvania Avenue NW, Washington, DC 20500', // optional
|
|
299
311
|
title: 'The White House', // optional
|
|
300
312
|
googleForceLatLon: false, // optionally force GoogleMaps to use the latlon for the query instead of the title
|
|
301
313
|
alwaysIncludeGoogle: true, // optional, true will always add Google Maps to iOS and open in Safari, even if app is not installed (default: false)
|
package/lib/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { GetAppsProps, GetAppsResponse, MapId, ShowLocationProps } from './type'
|
|
|
2
2
|
export type { DirectionMode, GetAppsProps, GetAppsResponse, MapId, SharedOptions, ShowLocationProps, } from './type';
|
|
3
3
|
export { Popup } from './components/popup/Popup';
|
|
4
4
|
export type { PopupProps } from './components/popup/Popup';
|
|
5
|
-
export declare const showLocation: ({ latitude, longitude, sourceLatitude, sourceLongitude, appleIgnoreLatLon, alwaysIncludeGoogle, googleForceLatLon, googlePlaceId, title: customTitle, app: customApp, dialogTitle: customDialogTitle, dialogMessage: customDialogMessage, cancelText: customCancelText, appsWhiteList: customAppsWhiteList, appTitles, naverCallerName, directionsMode, }: ShowLocationProps) => Promise<MapId | null | undefined>;
|
|
5
|
+
export declare const showLocation: ({ latitude, longitude, address, sourceLatitude, sourceLongitude, appleIgnoreLatLon, alwaysIncludeGoogle, googleForceLatLon, googlePlaceId, title: customTitle, app: customApp, dialogTitle: customDialogTitle, dialogMessage: customDialogMessage, cancelText: customCancelText, appsWhiteList: customAppsWhiteList, appTitles, naverCallerName, directionsMode, }: ShowLocationProps) => Promise<MapId | null | undefined>;
|
|
6
6
|
export declare function getApps({ alwaysIncludeGoogle, appsWhiteList, appTitles, naverCallerName, ...rest }: GetAppsProps): Promise<GetAppsResponse[]>;
|
package/lib/index.js
CHANGED
|
@@ -6,7 +6,7 @@ const constants_1 = require("./constants");
|
|
|
6
6
|
const utils_1 = require("./utils");
|
|
7
7
|
var Popup_1 = require("./components/popup/Popup");
|
|
8
8
|
Object.defineProperty(exports, "Popup", { enumerable: true, get: function () { return Popup_1.Popup; } });
|
|
9
|
-
const showLocation = async ({ latitude, longitude, sourceLatitude, sourceLongitude, appleIgnoreLatLon, alwaysIncludeGoogle, googleForceLatLon, googlePlaceId, title: customTitle, app: customApp, dialogTitle: customDialogTitle, dialogMessage: customDialogMessage, cancelText: customCancelText, appsWhiteList: customAppsWhiteList, appTitles, naverCallerName, directionsMode, }) => {
|
|
9
|
+
const showLocation = async ({ latitude, longitude, address, sourceLatitude, sourceLongitude, appleIgnoreLatLon, alwaysIncludeGoogle, googleForceLatLon, googlePlaceId, title: customTitle, app: customApp, dialogTitle: customDialogTitle, dialogMessage: customDialogMessage, cancelText: customCancelText, appsWhiteList: customAppsWhiteList, appTitles, naverCallerName, directionsMode, }) => {
|
|
10
10
|
const prefixes = (0, constants_1.generatePrefixes)({
|
|
11
11
|
alwaysIncludeGoogle,
|
|
12
12
|
naverCallerName,
|
|
@@ -14,6 +14,7 @@ const showLocation = async ({ latitude, longitude, sourceLatitude, sourceLongitu
|
|
|
14
14
|
(0, utils_1.checkOptions)({
|
|
15
15
|
latitude,
|
|
16
16
|
longitude,
|
|
17
|
+
address,
|
|
17
18
|
googleForceLatLon,
|
|
18
19
|
googlePlaceId,
|
|
19
20
|
title: customTitle,
|
|
@@ -26,6 +27,7 @@ const showLocation = async ({ latitude, longitude, sourceLatitude, sourceLongitu
|
|
|
26
27
|
let sourceLat;
|
|
27
28
|
let sourceLng;
|
|
28
29
|
let sourceLatLng;
|
|
30
|
+
let fullAddress;
|
|
29
31
|
if (sourceLatitude != null && sourceLongitude != null) {
|
|
30
32
|
useSourceDestiny = true;
|
|
31
33
|
sourceLat =
|
|
@@ -38,6 +40,9 @@ const showLocation = async ({ latitude, longitude, sourceLatitude, sourceLongitu
|
|
|
38
40
|
: sourceLongitude;
|
|
39
41
|
sourceLatLng = `${sourceLat},${sourceLng}`;
|
|
40
42
|
}
|
|
43
|
+
if (address) {
|
|
44
|
+
fullAddress = encodeURIComponent(address);
|
|
45
|
+
}
|
|
41
46
|
const lat = typeof latitude === 'string' ? parseFloat(latitude) : latitude;
|
|
42
47
|
const lng = typeof longitude === 'string' ? parseFloat(longitude) : longitude;
|
|
43
48
|
const latlng = `${lat},${lng}`;
|
|
@@ -77,6 +82,7 @@ const showLocation = async ({ latitude, longitude, sourceLatitude, sourceLongitu
|
|
|
77
82
|
sourceLat,
|
|
78
83
|
sourceLng,
|
|
79
84
|
sourceLatLng,
|
|
85
|
+
address: fullAddress,
|
|
80
86
|
title,
|
|
81
87
|
encodedTitle,
|
|
82
88
|
prefixes,
|
package/lib/type.d.ts
CHANGED
|
@@ -17,8 +17,11 @@ export type GetAppsResponse = {
|
|
|
17
17
|
open: () => Promise<string | null | undefined>;
|
|
18
18
|
};
|
|
19
19
|
export interface ShowLocationProps {
|
|
20
|
-
latitude
|
|
21
|
-
longitude
|
|
20
|
+
latitude?: number | string;
|
|
21
|
+
longitude?: number | string;
|
|
22
|
+
/** optionally you can enter a full address that will be queried against the map app's API and return the initial results if not the actual matched result. */
|
|
23
|
+
/** latitude and longitude will be ignored if the address field is set */
|
|
24
|
+
address?: string | null;
|
|
22
25
|
sourceLatitude?: number | null;
|
|
23
26
|
sourceLongitude?: number | null;
|
|
24
27
|
appleIgnoreLatLon?: boolean;
|
package/lib/utils.d.ts
CHANGED
|
@@ -15,9 +15,10 @@ export declare const askAppChoice: ({ dialogTitle, dialogMessage, cancelText, ap
|
|
|
15
15
|
export declare const getDirectionsModeAppleMaps: (directionsMode: 'car' | 'walk' | 'public-transport' | 'bike' | undefined) => string | undefined;
|
|
16
16
|
export declare const getDirectionsModeGoogleMaps: (directionsMode: 'car' | 'walk' | 'public-transport' | 'bike' | undefined) => string | undefined;
|
|
17
17
|
export declare const getDirectionsModeSygic: (directionsMode: 'car' | 'walk' | 'public-transport' | 'bike' | undefined) => string | undefined;
|
|
18
|
-
export declare const checkOptions: ({ latitude, longitude, googleForceLatLon, googlePlaceId, title, app, prefixes, appTitles, appsWhiteList, }: {
|
|
19
|
-
latitude
|
|
20
|
-
longitude
|
|
18
|
+
export declare const checkOptions: ({ latitude, longitude, address, googleForceLatLon, googlePlaceId, title, app, prefixes, appTitles, appsWhiteList, }: {
|
|
19
|
+
latitude?: string | number | undefined;
|
|
20
|
+
longitude?: string | number | undefined;
|
|
21
|
+
address?: string | null | undefined;
|
|
21
22
|
googleForceLatLon?: boolean | null | undefined;
|
|
22
23
|
googlePlaceId?: number | string | null | undefined;
|
|
23
24
|
title?: string | null | undefined;
|
|
@@ -26,19 +27,20 @@ export declare const checkOptions: ({ latitude, longitude, googleForceLatLon, go
|
|
|
26
27
|
prefixes: Record<string, string>;
|
|
27
28
|
appsWhiteList: string[] | null | undefined;
|
|
28
29
|
}) => void;
|
|
29
|
-
export declare const generateMapUrl: ({ app, directionsMode, appleIgnoreLatLon, googleForceLatLon, googlePlaceId, naverCallerName, lat, lng, latlng, sourceLat, sourceLng, sourceLatLng, title, encodedTitle, prefixes, useSourceDestiny, }: {
|
|
30
|
+
export declare const generateMapUrl: ({ app, directionsMode, appleIgnoreLatLon, googleForceLatLon, googlePlaceId, naverCallerName, lat, lng, latlng, sourceLat, sourceLng, sourceLatLng, address, title, encodedTitle, prefixes, useSourceDestiny, }: {
|
|
30
31
|
app: string | null;
|
|
31
32
|
directionsMode: 'car' | 'walk' | 'public-transport' | 'bike' | undefined;
|
|
32
33
|
appleIgnoreLatLon?: boolean | undefined;
|
|
33
34
|
googleForceLatLon?: boolean | undefined;
|
|
34
35
|
googlePlaceId: string | number | null | undefined;
|
|
35
36
|
naverCallerName: string | null | undefined;
|
|
36
|
-
lat
|
|
37
|
-
lng
|
|
37
|
+
lat?: number | undefined;
|
|
38
|
+
lng?: number | undefined;
|
|
38
39
|
latlng: string;
|
|
39
40
|
sourceLat?: number | undefined;
|
|
40
41
|
sourceLng?: number | undefined;
|
|
41
42
|
sourceLatLng?: string | undefined;
|
|
43
|
+
address?: string | null | undefined;
|
|
42
44
|
title?: string | null | undefined;
|
|
43
45
|
encodedTitle?: string | undefined;
|
|
44
46
|
prefixes: Record<string, string>;
|
package/lib/utils.js
CHANGED
|
@@ -117,10 +117,16 @@ const getDirectionsModeSygic = (directionsMode) => {
|
|
|
117
117
|
return modeMap[directionsMode || ''] || undefined;
|
|
118
118
|
};
|
|
119
119
|
exports.getDirectionsModeSygic = getDirectionsModeSygic;
|
|
120
|
-
const checkOptions = ({ latitude, longitude, googleForceLatLon, googlePlaceId, title, app, prefixes, appTitles, appsWhiteList, }) => {
|
|
120
|
+
const checkOptions = ({ latitude, longitude, address, googleForceLatLon, googlePlaceId, title, app, prefixes, appTitles, appsWhiteList, }) => {
|
|
121
121
|
if (!latitude || !longitude) {
|
|
122
122
|
throw new MapsException('`showLocation` should contain keys `latitude` and `longitude`.');
|
|
123
123
|
}
|
|
124
|
+
if (address && typeof address !== 'string') {
|
|
125
|
+
throw new MapsException('Option `address` should be of type `string`.');
|
|
126
|
+
}
|
|
127
|
+
if (!latitude && !longitude && !address) {
|
|
128
|
+
throw new MapsException('`latitude` & `longitude` or `address` is required. Both cannot be undefined.');
|
|
129
|
+
}
|
|
124
130
|
if (title && typeof title !== 'string') {
|
|
125
131
|
throw new MapsException('`title` should be of type `string`.');
|
|
126
132
|
}
|
|
@@ -143,21 +149,28 @@ const checkOptions = ({ latitude, longitude, googleForceLatLon, googlePlaceId, t
|
|
|
143
149
|
}
|
|
144
150
|
};
|
|
145
151
|
exports.checkOptions = checkOptions;
|
|
146
|
-
const generateMapUrl = ({ app, directionsMode, appleIgnoreLatLon, googleForceLatLon, googlePlaceId, naverCallerName, lat, lng, latlng, sourceLat, sourceLng, sourceLatLng, title, encodedTitle, prefixes, useSourceDestiny, }) => {
|
|
152
|
+
const generateMapUrl = ({ app, directionsMode, appleIgnoreLatLon, googleForceLatLon, googlePlaceId, naverCallerName, lat, lng, latlng, sourceLat, sourceLng, sourceLatLng, address, title, encodedTitle, prefixes, useSourceDestiny, }) => {
|
|
147
153
|
let url = '';
|
|
148
154
|
switch (app) {
|
|
149
155
|
case 'apple-maps':
|
|
150
156
|
const appleDirectionMode = (0, exports.getDirectionsModeAppleMaps)(directionsMode);
|
|
151
157
|
url = prefixes['apple-maps'];
|
|
152
|
-
if (
|
|
153
|
-
url = `${url}?
|
|
154
|
-
url += sourceLatLng ? `&saddr=${sourceLatLng}` : '';
|
|
158
|
+
if (address) {
|
|
159
|
+
url = `${url}?address=${address}`;
|
|
155
160
|
}
|
|
156
|
-
else
|
|
157
|
-
|
|
161
|
+
else {
|
|
162
|
+
if (useSourceDestiny || directionsMode) {
|
|
163
|
+
url = `${url}?daddr=${latlng}`;
|
|
164
|
+
url += sourceLatLng ? `&saddr=${sourceLatLng}` : '';
|
|
165
|
+
}
|
|
166
|
+
else if (!appleIgnoreLatLon) {
|
|
167
|
+
url = `${url}?ll=${latlng}`;
|
|
168
|
+
}
|
|
158
169
|
}
|
|
159
170
|
url +=
|
|
160
|
-
useSourceDestiny || directionsMode || !appleIgnoreLatLon
|
|
171
|
+
useSourceDestiny || directionsMode || address || !appleIgnoreLatLon
|
|
172
|
+
? '&'
|
|
173
|
+
: '?';
|
|
161
174
|
url += `q=${title ? encodedTitle : 'Location'}`;
|
|
162
175
|
url += appleDirectionMode ? `&dirflg=${appleDirectionMode}` : '';
|
|
163
176
|
break;
|
|
@@ -178,136 +191,248 @@ const generateMapUrl = ({ app, directionsMode, appleIgnoreLatLon, googleForceLat
|
|
|
178
191
|
url += googleDirectionMode ? `&travelmode=${googleDirectionMode}` : '';
|
|
179
192
|
}
|
|
180
193
|
else {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (!googleForceLatLon && title) {
|
|
184
|
-
url += `&query=${encodedTitle}`;
|
|
194
|
+
if (address) {
|
|
195
|
+
url = `https://www.google.com/maps/search/?api=1&query=${address}`;
|
|
185
196
|
}
|
|
186
197
|
else {
|
|
187
|
-
|
|
198
|
+
// Use "search" as this will open up a single marker
|
|
199
|
+
url = 'https://www.google.com/maps/search/?api=1';
|
|
200
|
+
if (!googleForceLatLon && title) {
|
|
201
|
+
url += `&query=${encodedTitle}`;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
url += `&query=${latlng}`;
|
|
205
|
+
}
|
|
206
|
+
url += googlePlaceId ? `&query_place_id=${googlePlaceId}` : '';
|
|
188
207
|
}
|
|
189
|
-
url += googlePlaceId ? `&query_place_id=${googlePlaceId}` : '';
|
|
190
208
|
}
|
|
191
209
|
break;
|
|
192
210
|
case 'citymapper':
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
url += `&endname=${encodedTitle}`;
|
|
211
|
+
if (address) {
|
|
212
|
+
url = `${prefixes.citymapper}directions?endname=${address}`;
|
|
196
213
|
}
|
|
197
|
-
|
|
198
|
-
url
|
|
214
|
+
else {
|
|
215
|
+
url = `${prefixes.citymapper}directions?endcoord=${latlng}`;
|
|
216
|
+
if (title) {
|
|
217
|
+
url += `&endname=${encodedTitle}`;
|
|
218
|
+
}
|
|
219
|
+
if (useSourceDestiny) {
|
|
220
|
+
url += `&startcoord=${sourceLatLng}`;
|
|
221
|
+
}
|
|
199
222
|
}
|
|
200
223
|
break;
|
|
201
224
|
case 'uber':
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
225
|
+
if (address) {
|
|
226
|
+
url = `${prefixes.uber}?action=setPickup&pickup=my_location&dropoff=${address}`;
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
url = `${prefixes.uber}?action=setPickup&dropoff[latitude]=${lat}&dropoff[longitude]=${lng}`;
|
|
230
|
+
if (title) {
|
|
231
|
+
url += `&dropoff[nickname]=${encodedTitle}`;
|
|
232
|
+
}
|
|
233
|
+
url += useSourceDestiny
|
|
234
|
+
? `&pickup[latitude]=${sourceLat}&pickup[longitude]=${sourceLng}`
|
|
235
|
+
: '&pickup=my_location';
|
|
205
236
|
}
|
|
206
|
-
url += useSourceDestiny
|
|
207
|
-
? `&pickup[latitude]=${sourceLat}&pickup[longitude]=${sourceLng}`
|
|
208
|
-
: '&pickup=my_location';
|
|
209
237
|
break;
|
|
210
238
|
case 'lyft':
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
239
|
+
if (address) {
|
|
240
|
+
url = `${prefixes.lyft}ridetype?id=lyft&destination[address]=${address}`;
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
url = `${prefixes.lyft}ridetype?id=lyft&destination[latitude]=${lat}&destination[longitude]=${lng}`;
|
|
244
|
+
if (useSourceDestiny) {
|
|
245
|
+
url += `&pickup[latitude]=${sourceLat}&pickup[longitude]=${sourceLng}`;
|
|
246
|
+
}
|
|
214
247
|
}
|
|
215
248
|
break;
|
|
216
249
|
case 'transit':
|
|
217
|
-
|
|
250
|
+
if (address) {
|
|
251
|
+
url = `${prefixes.transit}directions?destination=${address}`;
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
url = `${prefixes.transit}directions?to=${latlng}`;
|
|
255
|
+
}
|
|
218
256
|
if (useSourceDestiny) {
|
|
219
257
|
url += `&from=${sourceLatLng}`;
|
|
220
258
|
}
|
|
221
259
|
break;
|
|
222
260
|
case 'truckmap':
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
url = `https://truckmap.com/
|
|
261
|
+
if (address) {
|
|
262
|
+
// Constructed from documentation from https://truckmap.com/solutions/developer
|
|
263
|
+
url = `https://truckmap.com/place/${address}`;
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
url = `https://truckmap.com/place/${lat},${lng}`;
|
|
267
|
+
if (useSourceDestiny) {
|
|
268
|
+
url = `https://truckmap.com/route/${sourceLat},${sourceLng}/${lat},${lng}`;
|
|
269
|
+
}
|
|
226
270
|
}
|
|
227
271
|
break;
|
|
228
272
|
case 'waze':
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
273
|
+
if (address) {
|
|
274
|
+
url = `${prefixes.waze}?q=${address}`;
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
url = `${prefixes.waze}?ll=${latlng}&navigate=yes`;
|
|
278
|
+
if (title) {
|
|
279
|
+
url += `&q=${encodedTitle}`;
|
|
280
|
+
}
|
|
232
281
|
}
|
|
233
282
|
break;
|
|
234
283
|
case 'yandex':
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
284
|
+
if (address) {
|
|
285
|
+
url = `${prefixes.yandex}?text=${address}`;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
url = `${prefixes.yandex}build_route_on_map?lat_to=${lat}&lon_to=${lng}`;
|
|
289
|
+
if (useSourceDestiny) {
|
|
290
|
+
url += `&lat_from=${sourceLat}&lon_from=${sourceLng}`;
|
|
291
|
+
}
|
|
238
292
|
}
|
|
239
293
|
break;
|
|
240
294
|
case 'moovit':
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
url += `&dest_name=${encodedTitle}`;
|
|
295
|
+
if (address) {
|
|
296
|
+
url = `${prefixes.moovit}?dest_name=${address}`;
|
|
244
297
|
}
|
|
245
|
-
|
|
246
|
-
url
|
|
298
|
+
else {
|
|
299
|
+
url = `${prefixes.moovit}?dest_lat=${lat}&dest_lon=${lng}`;
|
|
300
|
+
if (title) {
|
|
301
|
+
url += `&dest_name=${encodedTitle}`;
|
|
302
|
+
}
|
|
303
|
+
if (useSourceDestiny) {
|
|
304
|
+
url += `&orig_lat=${sourceLat}&orig_lon=${sourceLng}`;
|
|
305
|
+
}
|
|
247
306
|
}
|
|
248
307
|
break;
|
|
249
308
|
case 'yandex-taxi':
|
|
250
|
-
|
|
309
|
+
if (address) {
|
|
310
|
+
throw new MapsException('yandex-taxi does not support passing the address or has not been implemented yet.');
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
url = `${prefixes['yandex-taxi']}route?end-lat=${lat}&end-lon=${lng}&appmetrica_tracking_id=1178268795219780156`;
|
|
314
|
+
}
|
|
251
315
|
break;
|
|
252
316
|
case 'yandex-maps':
|
|
253
|
-
|
|
317
|
+
if (address) {
|
|
318
|
+
url = `${prefixes['yandex-maps']}?text=${address}`;
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
url = `${prefixes['yandex-maps']}?pt=${lng},${lat}`;
|
|
322
|
+
}
|
|
254
323
|
break;
|
|
255
324
|
case 'kakaomap':
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
325
|
+
if (address) {
|
|
326
|
+
url = `${prefixes.kakaomap}route?ep=${address}`;
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
url = `${prefixes.kakaomap}look?p=${latlng}`;
|
|
330
|
+
if (useSourceDestiny) {
|
|
331
|
+
url = `${prefixes.kakaomap}route?sp=${sourceLat},${sourceLng}&ep=${latlng}&by=CAR`;
|
|
332
|
+
}
|
|
259
333
|
}
|
|
260
334
|
break;
|
|
261
335
|
case 'tmap':
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
336
|
+
if (address) {
|
|
337
|
+
url = `${prefixes.tmap}search?name=${address}`;
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
url = `${prefixes.tmap}viewmap?x=${lng}&y=${lat}`;
|
|
341
|
+
if (useSourceDestiny) {
|
|
342
|
+
url = `${prefixes.tmap}route?startx=${sourceLng}&starty=${sourceLat}&goalx=${lng}&goaly=${lat}`;
|
|
343
|
+
}
|
|
265
344
|
}
|
|
266
345
|
break;
|
|
267
346
|
case 'mapycz':
|
|
268
|
-
|
|
347
|
+
if (address) {
|
|
348
|
+
url = `${prefixes.mapycz}www.mapy.cz/zakladni?q=${address}`;
|
|
349
|
+
}
|
|
350
|
+
else {
|
|
351
|
+
url = `${prefixes.mapycz}www.mapy.cz/zakladni?x=${lng}&y=${lat}&source=coor&id=${lng},${lat}`;
|
|
352
|
+
}
|
|
269
353
|
break;
|
|
270
354
|
case 'maps-me':
|
|
271
|
-
|
|
355
|
+
if (address) {
|
|
356
|
+
url = `${prefixes['maps-me']}?q=${address}`;
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
url = `${prefixes['maps-me']}route?sll=${sourceLat},${sourceLng}&saddr= &dll=${lat},${lng}&daddr=${title}&type=vehicle`;
|
|
360
|
+
}
|
|
272
361
|
break;
|
|
273
362
|
case 'osmand':
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
363
|
+
if (address) {
|
|
364
|
+
url = `${prefixes.osmand}show_map?addr=${address}`;
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
url = constants_1.isIOS
|
|
368
|
+
? `${prefixes.osmand}?lat=${lat}&lon=${lng}`
|
|
369
|
+
: `${prefixes.osmand}?q=${lat},${lng}`;
|
|
370
|
+
}
|
|
277
371
|
break;
|
|
278
372
|
case 'gett':
|
|
279
|
-
|
|
373
|
+
if (address) {
|
|
374
|
+
throw new MapsException('gett does not support passing the address or has not been implemented yet.');
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
url = `${prefixes.gett}order?pickup=my_location&dropoff_latitude=${lat}&dropoff_longitude=${lng}`;
|
|
378
|
+
}
|
|
280
379
|
break;
|
|
281
380
|
case 'navermap':
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
381
|
+
if (address) {
|
|
382
|
+
url = `${prefixes.navermap}search?query=${address}`;
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
url = `${prefixes.navermap}map?lat=${lat}&lng=${lng}&appname=${naverCallerName}`;
|
|
386
|
+
if (useSourceDestiny) {
|
|
387
|
+
url = `${prefixes.navermap}route?slat=${sourceLat}&slng=${sourceLng}&dlat=${lat}&dlng=${lng}&appname=${naverCallerName}`;
|
|
388
|
+
}
|
|
285
389
|
}
|
|
286
390
|
break;
|
|
287
391
|
case 'dgis':
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
392
|
+
if (address) {
|
|
393
|
+
url = `${prefixes.dgis}?q=${address}`;
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
url = `${prefixes.dgis}routeSearch/to/${lng},${lat}/go`;
|
|
397
|
+
if (useSourceDestiny) {
|
|
398
|
+
url = `${prefixes.dgis}routeSearch/to/${lng},${lat}/from/${sourceLng},${sourceLat}/go`;
|
|
399
|
+
}
|
|
291
400
|
}
|
|
292
401
|
break;
|
|
293
402
|
case 'liftago':
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
url += `&destinationName=${encodedTitle}`;
|
|
403
|
+
if (address) {
|
|
404
|
+
throw new MapsException('liftago does not support passing the address or has not been implemented yet.');
|
|
297
405
|
}
|
|
298
|
-
|
|
299
|
-
url
|
|
406
|
+
else {
|
|
407
|
+
url = `${prefixes.liftago}order?destinationLat=${lat}&destinationLon=${lng}`;
|
|
408
|
+
if (title) {
|
|
409
|
+
url += `&destinationName=${encodedTitle}`;
|
|
410
|
+
}
|
|
411
|
+
if (useSourceDestiny) {
|
|
412
|
+
url += `&pickupLat=${sourceLat}&pickupLon=${sourceLng}`;
|
|
413
|
+
}
|
|
300
414
|
}
|
|
301
415
|
break;
|
|
302
416
|
case 'petalmaps':
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
url
|
|
417
|
+
if (address) {
|
|
418
|
+
// Got this from this documentation https://developer.huawei.com/consumer/en/doc/HMSCore-Guides/petal-maps-introduction-0000001059189679
|
|
419
|
+
url = `${prefixes.petalmaps}textSearch?text=${address}`;
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
url = `${prefixes.petalmaps}navigation?daddr=${lat},${lng}`;
|
|
423
|
+
if (useSourceDestiny) {
|
|
424
|
+
url += `&saddr=${sourceLat},${sourceLng}`;
|
|
425
|
+
}
|
|
306
426
|
}
|
|
307
427
|
break;
|
|
308
428
|
case 'sygic':
|
|
309
429
|
const sygicDirectionsMode = (0, exports.getDirectionsModeSygic)(directionsMode);
|
|
310
|
-
|
|
430
|
+
if (address) {
|
|
431
|
+
throw new MapsException('sygic does not support passing the address or has not been implemented yet.');
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
url = `${prefixes.sygic}coordinate|${lng}|${lat}|`;
|
|
435
|
+
}
|
|
311
436
|
url += sygicDirectionsMode ? `${sygicDirectionsMode}` : '';
|
|
312
437
|
break;
|
|
313
438
|
}
|