-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.plugin.utils.js
More file actions
55 lines (50 loc) · 1.24 KB
/
app.plugin.utils.js
File metadata and controls
55 lines (50 loc) · 1.24 KB
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
const Description = {
foreground: 'Required to use location information while the app is in use.',
background:
'Required to use location information while the app is open in the background.',
};
const Android = {
/**
* @param {any[]} permissions
* @param {string} permission
*/
addPermission: (permissions, permission) => {
const exist = permissions.some(p => p.$['android:name'] === permission);
if (!exist) {
permissions.push({$: {'android:name': permission}});
}
},
/**
* @param {any[]} services
* @param {Record<string, any>} service
*/
addService: (services, service) => {
const name = service['android:name'];
const exists = services.some(s => s.$['android:name'] === name);
if (!exists) {
services.push({$: service});
}
},
};
const Ios = {
/**
* @param {Record<string, string>} info
* @param {string} key
* @param {string} value
*/
addPermission: (info, key, value) => {
if (!info.hasOwnProperty(key)) {
info[key] = value;
}
},
/**
* @param {any[]} modes
* @param {string} mode
*/
addBackgroundMode: (modes, mode) => {
if (!modes.includes(mode)) {
modes.push(mode);
}
},
};
module.exports = {Description, Android, Ios};