-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathapp.config.ts
More file actions
76 lines (73 loc) · 2.17 KB
/
Copy pathapp.config.ts
File metadata and controls
76 lines (73 loc) · 2.17 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import type { ConfigContext, ExpoConfig } from 'expo/config';
import 'dotenv-flow/config';
import updateInfo from './src/assets/data/updateInfo.json' with { type: 'json' };
export default ({ config }: ConfigContext): ExpoConfig => {
const isProduction = process.env.EXPO_PUBLIC_ENV === 'production';
const apsEnvironment = isProduction ? 'production' : 'development';
const plugins: (string | [] | [string] | [string, any])[] = [];
for (const plugin of config.plugins ?? []) {
const [name, configurations] = Array.isArray(plugin)
? plugin
: [plugin, undefined];
if (name === 'mx-jpush-expo') {
if (!process.env.JPUSH_APP_KEY) {
console.error('JPUSH_APP_KEY is not set');
continue;
}
plugins.push([
name,
{
...configurations,
apsForProduction: isProduction,
appKey: process.env.JPUSH_APP_KEY,
channel: process.env.JPUSH_CHANNEL ?? configurations?.channel ?? '',
packageName:
process.env.JPUSH_PKGNAME ??
configurations?.packageName ??
config.android?.package ??
'',
vendorChannels: {
vivo: {
appKey: process.env.JPUSH_VIVO_APP_KEY,
appId: process.env.JPUSH_VIVO_APP_ID,
},
xiaomi: {
appId: process.env.JPUSH_XIAOMI_APP_ID,
appKey: process.env.JPUSH_XIAOMI_APP_KEY,
},
oppo: {
appKey: process.env.JPUSH_OPPO_APP_KEY,
appId: process.env.JPUSH_OPPO_APP_ID,
appSecret: process.env.JPUSH_OPPO_APP_SECRET,
},
honor: {
appId: process.env.JPUSH_HONOR_APP_ID,
},
huawei: {
enabled: true,
},
},
},
]);
continue;
}
plugins.push(plugin);
}
return {
...config,
slug: 'ccnubox',
name: '华师匣子',
ios: {
...config.ios,
entitlements: {
...config.ios?.entitlements,
'aps-environment': apsEnvironment,
},
},
plugins,
extra: {
...config.extra,
updateInfo: updateInfo,
},
};
};