-
-
Notifications
You must be signed in to change notification settings - Fork 141
/
app.plugin.js
54 lines (50 loc) · 1.28 KB
/
app.plugin.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
// eslint-disable-next-line @typescript-eslint/no-var-requires
const {withAndroidManifest, withInfoPlist} = require('@expo/config-plugins');
const schemes = [
'comgooglemaps',
'citymapper',
'uber',
'lyft',
'transit',
'truckmap',
'waze',
'yandexnavi',
'moovit',
'yandextaxi',
'yandexmaps',
'kakaomap',
'tmap',
'szn-mapy',
'mapsme',
'osmandmaps',
'gett',
'nmap',
'dgis',
'lftgpas',
'petalmaps',
'sygic',
];
const intents = ['geo', 'waze'].map((app) => {
return {
action: {$: {'android:name': 'android.intent.action.VIEW'}},
data: {$: {'android:scheme': app}},
};
});
/**
* @type {import('@expo/config-plugins').ConfigPlugin}
*/
module.exports = function withReactNativeMapLink(config) {
// eslint-disable-next-line no-shadow
config = withAndroidManifest(config, async (config) => {
let intent = config.modResults.manifest.queries[0].intent ?? [];
// @ts-expect-error unnecessary type gymnastics
config.modResults.manifest.queries[0].intent = intent.concat(intents);
return config;
});
// eslint-disable-next-line no-shadow
return withInfoPlist(config, (config) => {
config.modResults.LSApplicationQueriesSchemes =
config.modResults.LSApplicationQueriesSchemes?.concat(schemes) ?? schemes;
return config;
});
};