forked from blue-10/Blue10-MobileApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.config.ts
140 lines (130 loc) · 3.51 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
import type { ExpoConfig } from '@expo/config-types';
// load .env
import * as dotenv from 'dotenv';
import { parse } from 'semver';
dotenv.config();
const getPackageVersion = (): string => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageJson = require('./package.json');
return packageJson.version || '0.0.0';
};
const getVersion = (): string => {
if (process.env.RELEASE_TYPE === 'production') {
return getPackageVersion();
} else {
return `${getPackageVersion()}-${process.env.EAS_BUILD_PROFILE ?? 'develop'}`;
}
};
const getBuildNumber = (version: string): string => {
const semver = parse(version);
if (semver) {
let suffix = '';
if (semver.prerelease.length > 1) {
const preReleaseName = semver.prerelease[0];
const preReleaseVersion = semver.prerelease[1];
switch (preReleaseName) {
case 'develop':
suffix = `.1${preReleaseVersion}`;
break;
case 'staging':
case 'acceptance':
case 'release':
suffix = `.2${preReleaseVersion}`;
break;
}
}
return `${semver.major}.${semver.minor}.${semver.patch}${suffix}`;
}
return version;
};
const getVersionCode = (version: string): number => {
const semver = parse(version);
if (semver) {
const isProduction = semver.prerelease.length === 0;
// starting with 2 means production/alpha/beta app
// starting with 1 means development app
return (
(isProduction ? 2 : 1) * 10000000 +
semver.major * 1000000 +
semver.minor * 10000 +
semver.patch * 100 +
(semver.prerelease.length > 1 ? Number(semver.prerelease[1]) : 0)
);
}
return 1;
};
const version = getVersion();
const config: ExpoConfig = {
android: {
adaptiveIcon: {
backgroundColor: '#c4d600',
foregroundImage: './assets/adaptive-icon.png',
},
package: 'builders.are.we.blue10',
versionCode: getVersionCode(version),
},
assetBundlePatterns: ['**/*'],
developmentClient: {
silentLaunch: true,
},
extra: {
authLoginPage: process.env.AUTH_LOGIN_PAGE,
eas: {
projectId: 'eb428ba3-923b-4b72-bdcd-7ab92d0e0321',
},
},
icon: './assets/icon.png',
ios: {
buildNumber: getBuildNumber(version),
bundleIdentifier: 'com.blue10.Scanner',
config: {
usesNonExemptEncryption: false,
},
infoPlist: {
CFBundleLocalizations: ['en', 'nl'],
},
supportsTablet: true,
},
name: 'Blue10',
orientation: 'portrait',
owner: 'blue10',
plugins: [
'expo-localization',
// disabled for now, this uploads the execution symbols to sentry. this not needed for now.
// [
// '@sentry/react-native/expo',
// {
// organization: 'sentry',
// project: 'blue10-mobile-app',
// url: 'https://sentry.wecreatesolutions.nl/',
// },
// ],
'expo-secure-store',
[
'react-native-document-scanner-plugin',
{
cameraPermission: 'To scan documents, camera access is required.',
},
],
[
'expo-media-library',
{
isAccessMediaLocationEnabled: true,
photosPermission: 'Allow $(PRODUCT_NAME) to access your photos.',
savePhotosPermission: 'Allow $(PRODUCT_NAME) to save photos.',
},
],
],
slug: 'blue10-app',
splash: {
backgroundColor: '#333333',
image: './assets/splash.png',
resizeMode: 'contain',
},
updates: {
fallbackToCacheTimeout: 0,
},
userInterfaceStyle: 'light',
version: getPackageVersion(),
};
export default config;