-
Notifications
You must be signed in to change notification settings - Fork 34
/
app.config.ts
212 lines (201 loc) · 5.68 KB
/
app.config.ts
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
210
211
212
import { ExpoConfig, ConfigContext } from 'expo/config';
import Tenant from './tenant.json';
import { APP_VERSION } from './app.constants';
// We only use a custom build number for Android OSS builds (The rest use auto-incremented build numbers)
const appBuildNumber = process.env.MINDS_APP_BUILD
? { versionCode: parseInt(process.env.MINDS_APP_BUILD, 10) }
: {};
const IS_OSS = (appBuildNumber.versionCode || 0) > 1050000001;
type ResizeType = 'cover' | 'contain';
/**
* Configuration settings for the minds / multi-tenant app, using environment variables.
*/
const name = Tenant.APP_NAME;
const theme = Tenant.THEME;
const is_dark = theme === 'dark';
const is_previewer_app = Tenant.APP_SLUG === 'mindspreview';
/**
* The camera and microphone permissions messages are different for the previewer app.
*/
const cameraMessage = is_previewer_app
? 'Camera access lets you scan QR codes to preview your mobile app, and to create posts with photos and videos.'
: 'Camera access lets you create posts with photos and videos.';
const micMessage = 'Microphone access lets you create new posts with videos.';
const extraUpdate: any = is_previewer_app
? {
checkAutomatically: 'NEVER',
fallbackToCacheTimeout: 0,
}
: {};
const permissions = [
'android.permission.READ_EXTERNAL_STORAGE',
'android.permission.WRITE_EXTERNAL_STORAGE',
'android.permission.ACCESS_MEDIA_LOCATION',
'android.permission.CAMERA',
'android.permission.RECORD_AUDIO',
'android.permission.POST_NOTIFICATIONS',
];
if (IS_OSS) {
permissions.push('android.permission.REQUEST_INSTALL_PACKAGES');
}
/**
* Plugins
*/
const plugins: any = [
'react-native-iap',
'expo-updates',
'expo-localization',
'./node_modules/react-native-notifications/app.plugin.js',
[
'@sentry/react-native/expo',
{
organization: 'minds-inc',
project: 'mobile',
},
],
[
'expo-build-properties',
{
android: {
compileSdkVersion: 34,
targetSdkVersion: 34,
buildToolsVersion: '34.0.0',
kotlinVersion: '1.8.0',
},
ios: {
deploymentTarget: '13.4',
flipper: false,
},
},
],
[
'expo-media-library',
{
photosPermission: 'This lets you share photos from your library',
savePhotosPermission: 'This lets you save photos to your camera roll',
isAccessMediaLocationEnabled: true,
},
],
[
'react-native-vision-camera',
{
cameraPermissionText: cameraMessage,
enableMicrophonePermission: true,
microphonePermissionText: micMessage,
enableLocation: false,
},
],
'./plugins/withAndroidMainApplicationAttributes.js',
];
// Add tracking-transparency plugin if enabled
if (Tenant.APP_TRACKING_MESSAGE_ENABLED) {
plugins.push([
'expo-tracking-transparency',
{
userTrackingPermission:
Tenant.APP_TRACKING_MESSAGE ||
'Allow this app to collect app-related data that can be used fro tracking you or your device.',
},
]);
}
export default ({ config }: ConfigContext): ExpoConfig => ({
...config,
name,
scheme: Tenant.APP_SCHEME,
slug: Tenant.APP_SLUG || 'minds',
version: APP_VERSION,
backgroundColor: is_dark
? Tenant.BACKGROUND_COLOR_DARK
: Tenant.BACKGROUND_COLOR_LIGHT,
icon: './assets/images/icon.png',
orientation: 'portrait',
runtimeVersion: {
policy: 'appVersion',
},
plugins,
android: {
package: Tenant.APP_ANDROID_PACKAGE,
adaptiveIcon: Tenant.ADAPTIVE_ICON
? {
foregroundImage: Tenant.ADAPTIVE_ICON,
backgroundColor: Tenant.ADAPTIVE_COLOR,
}
: undefined,
...appBuildNumber,
intentFilters: [
{
action: 'VIEW',
autoVerify: true,
data: [
{
scheme: 'https',
host: Tenant.APP_HOST || 'www.minds.com',
},
],
category: ['BROWSABLE', 'DEFAULT'],
},
],
splash: {
image: './assets/images/splash.png',
resizeMode: Tenant.APP_SPLASH_RESIZE as ResizeType,
backgroundColor: is_dark
? Tenant.BACKGROUND_COLOR_DARK
: Tenant.BACKGROUND_COLOR_LIGHT,
},
permissions,
googleServicesFile: './google-services.json',
},
ios: {
supportsTablet: true,
bundleIdentifier: Tenant.APP_IOS_BUNDLE,
associatedDomains: Tenant.APP_HOST
? [
'applinks:' + Tenant.APP_HOST,
'activitycontinuation:' + Tenant.APP_HOST,
'webcredentials:' + Tenant.APP_HOST,
]
: [
'applinks:www.minds.com',
'activitycontinuation:www.minds.com',
'webcredentials:www.minds.com',
],
infoPlist: {
LSApplicationQueriesSchemes: ['mindschat'],
NSPhotoLibraryUsageDescription:
'This lets you share photos from your library',
NSPhotoLibraryAddUsageDescription:
'This lets you save photos to your camera roll',
NSCameraUsageDescription: cameraMessage,
NSMicrophoneUsageDescription: micMessage,
UIBackgroundModes: ['audio'],
},
splash: {
image: './assets/images/splash.png',
resizeMode: Tenant.APP_SPLASH_RESIZE as ResizeType,
backgroundColor: is_dark
? Tenant.BACKGROUND_COLOR_DARK
: Tenant.BACKGROUND_COLOR_LIGHT,
},
entitlements: {
'aps-environment': 'development',
},
},
notification: {
icon: './assets/images/icon_mono.png',
color: Tenant.ACCENT_COLOR_LIGHT,
iosDisplayInForeground: true,
},
extra: {
eas: {
projectId:
Tenant.EAS_PROJECT_ID || '7a92bc49-6d7e-468f-af13-0a9aff39fc0e',
},
},
updates: {
...extraUpdate,
url: `https://u.expo.dev/${
Tenant.EAS_PROJECT_ID || '7a92bc49-6d7e-468f-af13-0a9aff39fc0e'
}`,
},
owner: 'minds-inc',
});