-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathapp.config.ts
More file actions
209 lines (205 loc) · 8.25 KB
/
app.config.ts
File metadata and controls
209 lines (205 loc) · 8.25 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import { execSync } from 'child_process';
import { type ExpoConfig } from 'expo/config';
import 'ts-node/register';
import { version } from './package.json';
const IS_DEV = process.env.APP_VARIANT === 'development';
// 内部版本号根据commit次数设置
// 前三位对应版本名,后三位或更多对应commit次数
let commitCount = 0;
try {
const stdout = execSync('git rev-list --count HEAD').toString().trim();
const parsedInt = parseInt(stdout, 10);
if (!isNaN(parsedInt)) {
commitCount = parsedInt;
}
} catch (err) {
console.error('无法获取 git commit 次数,将使用默认值 0:', err);
}
const versionCodePrefix = version.replace(/\./g, '');
const versionCodeSuffix = String(commitCount).padStart(3, '0');
// iOS
const buildNumber = versionCodePrefix + versionCodeSuffix;
// Android
const versionCode = parseInt(buildNumber, 10);
const config: ExpoConfig = {
name: 'fzuhelper',
slug: 'fzuhelper-app',
version,
githubUrl: 'https://github.com/west2-online/fzuhelper-app',
orientation: 'portrait',
icon: './assets/images/icon.png',
scheme: 'fzuhelper',
ios: {
appleTeamId: 'MEWHFZ92DY', // Apple Team ID
appStoreUrl: 'https://apps.apple.com/us/app/%E7%A6%8Fuu/id866768101',
bundleIdentifier: IS_DEV ? 'FzuHelper.FzuHelper.dev' : 'FzuHelper.FzuHelper',
buildNumber,
bitcode: true,
supportsTablet: true,
associatedDomains: ['applinks:fzuhelperapp.west2.online'], // 支持 Apple Universal Link 功能
icon: {
// 此处影响的主要是自动变更的桌面图标,参考:https://support.apple.com/zh-cn/guide/iphone/iph385473442/ios
dark: './assets/images/icon/dark.png',
light: './assets/images/icon/light.png',
tinted: './assets/images/icon/tinted.png',
},
infoPlist: {
// infoPlist 配置项,详见:https://developer.apple.com/documentation/bundleresources/information_property_list
// 或者:https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html
// 出口合规设置,详见:https://developer.apple.com/documentation/Security/complying-with-encryption-export-regulations
ITSAppUsesNonExemptEncryption: false,
ITSEncryptionExportComplianceCode: '',
NSCalendarsFullAccessUsageDescription: '我们需要申请日历权限以导出课表、考场安排等内容到日历',
NSCalendarsUsageDescription: '我们需要申请日历权限以导出课表、考场安排等内容到日历',
NSCameraUsageDescription: '我们需要申请相机权限以提供拍照上传头像、学习中心扫码签到等功能',
NSPhotoLibraryUsageDescription: '我们需要申请相册权限以提供上传头像等功能',
// 下面这两个定位权限申请缺一不可
NSLocationWhenInUseUsageDescription: '我们需要在应用内使用您的位置以提供校本化签到定位等功能',
NSLocationAlwaysAndWhenInUseUsageDescription: '我们需要在应用内使用您的位置以提供校本化签到定位等功能',
LSApplicationQueriesSchemes: ['itms-apps'],
CFBundleAllowMixedLocalizations: true,
CFBundleURLName: 'MEWHFZ92DY.FzuHelper.FzuHelper', // URL Scheme,用于跳转到 App,CFBundleURLSchemes Expo 已经帮忙配置好了
NSAppTransportSecurity: {
NSAllowsArbitraryLoads: true, // 允许访问非 HTTPS 的内容
},
// 关闭 iOS 26 液态玻璃效果
UIDesignRequiresCompatibility: true,
},
entitlements: {
'com.apple.security.application-groups': ['group.FzuHelper.NextCourse'],
},
},
locales: {
ja: './locales/japanese.json',
en: './locales/english.json',
'zh-Hans': './locales/chinese.json',
'zh-Hant': './locales/chinese-traditional.json',
},
android: {
package: IS_DEV ? 'com.helper.west2ol.fzuhelper.dev' : 'com.helper.west2ol.fzuhelper',
versionCode,
adaptiveIcon: {
foregroundImage: './assets/images/ic_launcher_foreground.png',
monochromeImage: './assets/images/ic_launcher_foreground.png',
backgroundColor: '#FFFFFF',
},
permissions: [
'android.permission.REQUEST_INSTALL_PACKAGES',
'android.permission.CAMERA',
'android.permission.READ_CALENDAR',
'android.permission.WRITE_CALENDAR',
'android.permission.ACCESS_COARSE_LOCATION',
'android.permission.ACCESS_FINE_LOCATION',
],
},
plugins: [
'expo-router',
[
'react-native-permissions',
{
iosPermissions: ['Camera', 'Calendars', 'Notifications', 'LocationWhenInUse', 'AppTrackingTransparency'],
},
],
[
'expo-build-properties',
{
android: {
buildArchs: ['arm64-v8a'],
useLegacyPackaging: true,
enableMinifyInReleaseBuilds: true,
enableShrinkResourcesInReleaseBuilds: true,
extraMavenRepos: ['https://developer.huawei.com/repo/'],
},
},
],
'./plugins/inject-android-config',
[
'./plugins/inject-android-network-security-config',
{ networkSecurityConfig: './assets/configs/network_security_config.xml', enable: true },
],
'./plugins/inject-ios-prebuild',
[
'./modules/umeng-bridge/app.plugin.js',
{
// 以下配置可以暴露在公网,不会导致安全问题
// Android
AndroidAppKey: '5dce696b570df3081900033f', // 发布(正式包名)时需更换
channel: 'default', // Android渠道号
msgsec: '2931a731b52ca1457b387bcc22cdff32', // 仅供 Android,iOS 是证书鉴权,具体参考 KeeWeb
mipushAppId: '2882303761517633929',
mipushAppKey: '5111763312929',
hmspushAppId: '100423559',
vivoPushApiKey: 'bfe61ef29b17b1b483e8505f5032a5f9',
vivoPushAppId: '105570681',
honorPushAppId: '104498819',
oppoPushAppKey: '6UNBx7ceC680s48cw4cwocCw8',
oppoPushAppSecret: '76fb94e392fc1D2e7798b2C2531216d2',
// iOS
iOSAppKey: '679132946d8fdd4ad83ab20e', // 发布(正式包名)时需更换
bridgingSourcePath: './modules/umeng-bridge/ios/ExpoUmeng-Bridging-Header.h', // (iOS) 源路径(相对于 app.plugin.js 文件)
bridgingTargetPath: 'fzuhelper/fzuhelper-Bridging-Header.h', // (iOS) 目标路径(相对于 ios 文件夹)这个文件可以不更改
// 请注意:这个文件的格式是符合{targetName}/{targetName}-Bridging-Header.h的,如果你的targetName不是fzuhelper,请更改
// 如果需要通用的 Header(即对所有 Target 都生效),你需要将其移动到一个独立的文件夹(比如 ios/Bridging)然后在 Xcode Project
// 的 config 注入过程中加入`project.addBuildProperty('SWIFT_OBJC_BRIDGING_HEADER', bridgingTargetPath);`
NSPushNotificationUsageDescription:
'我们会使用推送通知来推送成绩信息、教务处最新通知,通知发送受福州大学监管,不会泄露您的个人信息',
NSUserTrackingUsageDescription: '我们会使用设备号来分析软件使用情况,以便提供更好的服务以及修复漏洞',
},
],
[
'expo-splash-screen',
{
image: './assets/images/ic_launcher_foreground.png',
// 不设置默认的 backgroundColor,会导致 logo 透明背景被改变
dark: {
backgroundColor: '#000000',
},
imageWidth: 200,
},
],
[
'expo-quick-actions',
{
androidIcons: {
qrcode: {
foregroundImage: './assets/images/qr_action.png',
backgroundColor: '#FFFFFF',
},
},
},
],
'./plugins/with-android-theme',
'@bacons/apple-targets', // Apple Targets (e.g. widget)
[
'expo-font',
{
android: {
fonts: [
{
fontFamily: 'Roboto',
fontDefinitions: [
{
path: './assets/fonts/Roboto-Regular.ttf',
weight: 400,
},
{
path: './assets/fonts/Roboto-Bold.ttf',
weight: 700,
},
],
},
],
},
},
],
],
experiments: {
typedRoutes: true,
},
extra: {
eas: {
projectId: '7f521ea8-db0e-4bf3-a6ce-ff469936e540',
},
},
};
export default config;