-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.config.ts
More file actions
180 lines (169 loc) · 5.44 KB
/
Copy pathapp.config.ts
File metadata and controls
180 lines (169 loc) · 5.44 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
import type { ConfigContext, ExpoConfig } from 'expo/config';
import type { AppConfig, AppEnv } from './app.config.types';
import { version } from './package.json';
// Replace these with your EAS project ID and project slug.
// You can find them at https://expo.dev/accounts/[account]/projects/[project].
const EAS_PROJECT_ID = '808dbf9f-9986-4409-a52d-050e69d62397';
const PROJECT_SLUG = 'taito-template';
const OWNER = 'taito-united';
const APP_NAME = 'Taito Template';
const BUNDLE_IDENTIFIER = 'com.taito.template';
const PACKAGE_NAME = 'com.taito.template';
const SCHEME = 'taito-template';
const ICON = './src/design-system/assets/icon.png';
const ADAPTIVE_ICON = './src/design-system/assets/adaptive-icon.png';
const SPLASHSCREEN = './src/design-system/assets/splash.png';
const BACKGROUND_COLOR = '#009a48'; // Corresponds to `colors.brand.brand`
// Store links for app store review prompts (recommended for user-facing apps to help users leave reviews and avoid negative feedback in the stores)
const APP_STORE_URL = 'https://apps.apple.com/us/app/example/id1234567890';
const PLAY_STORE_URL =
'https://play.google.com/store/apps/details?id=com.example';
export default ({ config }: ConfigContext): ExpoConfig => {
const env = (process.env.APP_ENV as AppEnv) || 'development';
const customConfig = getDynamicAppConfig(env);
console.log('⚙️ Building app for environment:', env);
return {
...config,
name: customConfig.name,
version, // Automatically bump your project version with `npm version patch`, `npm version minor` or `npm version major`.
slug: PROJECT_SLUG, // Must be consistent across all environments.
owner: OWNER,
orientation: 'portrait',
userInterfaceStyle: 'automatic',
icon: customConfig.icon,
scheme: customConfig.scheme,
ios: {
supportsTablet: true,
bundleIdentifier: customConfig.bundleIdentifier,
appStoreUrl: APP_STORE_URL,
config: {
usesNonExemptEncryption: false,
},
infoPlist: {},
},
android: {
adaptiveIcon: {
foregroundImage: customConfig.adaptiveIcon,
backgroundColor: customConfig.backgroundColor,
},
edgeToEdgeEnabled: true,
package: customConfig.packageName,
playStoreUrl: PLAY_STORE_URL,
},
updates: {
url: `https://u.expo.dev/${EAS_PROJECT_ID}`,
},
runtimeVersion: {
policy: 'appVersion',
},
extra: {
...customConfig,
eas: { projectId: EAS_PROJECT_ID },
},
plugins: [
'expo-router',
'expo-localization',
['expo-updates', { username: OWNER }],
[
'expo-font',
{
fonts: [
'./src/design-system/fonts/Inter-Bold.ttf',
'./src/design-system/fonts/Inter-Medium.ttf',
'./src/design-system/fonts/Inter-Regular.ttf',
'./src/design-system/fonts/Inter-SemiBold.ttf',
],
},
],
[
'expo-splash-screen',
{
image: customConfig.splashscreen,
imageWidth: 1000,
resizeMode: 'contain',
backgroundColor: customConfig.backgroundColor,
},
],
[
'react-native-permissions',
{
// Add setup_permissions to your Podfile
iosPermissions: [],
},
],
['./plugins/with-ios-settings', { teamId: 'EPATC4S9N2' }],
'react-native-edge-to-edge',
[
'expo-build-properties',
{ android: { extraProguardRules: getExtraProguardRules() } },
],
[
'@sentry/react-native/expo',
{
/**
* _[CUSTOMIZE]_
*
* Create a project in sentry and customize these to match the project.
*/
organization: OWNER,
project: 'react-native',
url: 'https://sentry.io/',
},
],
],
experiments: {
typedRoutes: true,
},
};
};
// NOTE: we can't inline this to the plugin definition because the indendation would be wrong
function getExtraProguardRules() {
return `
# react-native-date-picker
-keep public class net.time4j.android.ApplicationStarter
-keep public class net.time4j.PrettyTime
`;
}
/** Dynamically configure the app based on the environment. */
const getDynamicAppConfig = (environment: AppEnv): AppConfig => {
if (environment === 'production') {
return {
name: APP_NAME,
bundleIdentifier: BUNDLE_IDENTIFIER,
packageName: PACKAGE_NAME,
icon: ICON,
adaptiveIcon: ADAPTIVE_ICON,
backgroundColor: BACKGROUND_COLOR,
splashscreen: SPLASHSCREEN,
scheme: SCHEME,
appEnv: environment,
apiUrl: 'https://api.example.com',
};
}
if (environment === 'preview') {
return {
name: `(prev) ${APP_NAME}`,
bundleIdentifier: `${BUNDLE_IDENTIFIER}.preview`,
packageName: `${PACKAGE_NAME}.preview`,
icon: './src/design-system/assets/icon-test.png',
adaptiveIcon: './src/design-system/assets/adaptive-icon-test.png',
backgroundColor: BACKGROUND_COLOR,
splashscreen: SPLASHSCREEN,
scheme: `${SCHEME}-prev`,
appEnv: environment,
apiUrl: 'https://api.example.com',
};
}
return {
name: `(dev) ${APP_NAME}`,
bundleIdentifier: `${BUNDLE_IDENTIFIER}.dev`,
packageName: `${PACKAGE_NAME}.dev`,
icon: ICON,
adaptiveIcon: ADAPTIVE_ICON,
backgroundColor: BACKGROUND_COLOR,
splashscreen: SPLASHSCREEN,
scheme: `${SCHEME}-dev`,
appEnv: environment,
apiUrl: 'https://api.example.com',
};
};