forked from tschoffelen/react-native-map-link
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.js
89 lines (82 loc) · 2.57 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**
* React Native Map Link
*/
import {Platform} from 'react-native';
export const isIOS = Platform.OS === 'ios';
export function generatePrefixes(options) {
return {
'apple-maps': isIOS ? 'maps://' : 'applemaps://',
'google-maps': prefixForGoogleMaps(options.alwaysIncludeGoogle),
citymapper: 'citymapper://',
uber: 'uber://',
lyft: 'lyft://',
transit: 'transit://',
truckmap: 'truckmap://',
waze: 'waze://',
yandex: 'yandexnavi://',
moovit: 'moovit://',
'yandex-maps': 'yandexmaps://maps.yandex.ru/',
'yandex-taxi': 'yandextaxi://',
kakaomap: 'kakaomap://',
mapycz: isIOS ? 'szn-mapy://' : 'mapycz://',
'maps-me': 'mapsme://',
osmand: isIOS ? 'osmandmaps://' : 'osmand.geo://',
gett: 'gett://',
navermap: options.naverCallerName ? 'nmap://' : 'nmap-disabled://',
dgis: 'dgis://2gis.ru/',
liftago: 'lftgpas://',
};
}
export function prefixForGoogleMaps(alwaysIncludeGoogle) {
return isIOS && !alwaysIncludeGoogle
? 'comgooglemaps://'
: 'https://www.google.com/maps/';
}
export function generateTitles(titles) {
return {
'apple-maps': 'Apple Maps',
'google-maps': 'Google Maps',
citymapper: 'Citymapper',
uber: 'Uber',
lyft: 'Lyft',
transit: 'The Transit App',
truckmap: 'TruckMap',
waze: 'Waze',
yandex: 'Yandex.Navi',
moovit: 'Moovit',
'yandex-taxi': 'Yandex Taxi',
'yandex-maps': 'Yandex Maps',
kakaomap: 'Kakao Maps',
mapycz: 'Mapy.cz',
'maps-me': 'Maps Me',
osmand: 'OsmAnd',
gett: 'Gett',
navermap: 'Naver Map',
dgis: '2GIS',
liftago: 'Liftago',
...(titles || {}),
};
}
export const icons = {
'apple-maps': require('./images/apple-maps.png'),
'google-maps': require('./images/google-maps.png'),
citymapper: require('./images/citymapper.png'),
uber: require('./images/uber.png'),
lyft: require('./images/lyft.png'),
transit: require('./images/transit.png'),
truckmap: require('./images/truckmap.png'),
waze: require('./images/waze.png'),
yandex: require('./images/yandex.png'),
moovit: require('./images/moovit.png'),
'yandex-taxi': require('./images/yandex-taxi.png'),
'yandex-maps': require('./images/yandex-maps.png'),
kakaomap: require('./images/kakao-map.png'),
mapycz: require('./images/mapycz.png'),
'maps-me': require('./images/maps-me.png'),
osmand: require('./images/osmand.png'),
gett: require('./images/gett.png'),
navermap: require('./images/naver-map.png'),
dgis: require('./images/dgis.png'),
liftago: require('./images/liftago.png'),
};
export const appKeys = Object.keys(icons);