feat(app-expo): env variants, local iOS prebuild, and About diagnostics

Align staging/production builds with APP_VARIANT bundle IDs, allow staging HTTP on iOS, add ios-prebuild scripts for TestFlight, and show connected API URL on About for non-production builds.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kevin
2026-05-19 15:43:16 +08:00
parent 3921c5ec24
commit 6d281c92a5
13 changed files with 275 additions and 18 deletions

View File

@@ -29,7 +29,28 @@ const LOCALES: Record<string, LocaleMessages> = {
const SUPPORTED_LOCALES = ['zh', 'en'] as const;
const PRIMARY_LOCALE = process.env.EXPO_PUBLIC_PRIMARY_LOCALE ?? 'zh';
const API_BASE_URL = process.env.EXPO_PUBLIC_API_URL ?? '';
const ALLOW_ANDROID_CLEARTEXT_TRAFFIC = API_BASE_URL.startsWith('http://');
const ALLOW_INSECURE_HTTP = API_BASE_URL.startsWith('http://');
const APP_VARIANT =
process.env.APP_VARIANT ??
process.env.EXPO_PUBLIC_APP_VARIANT ??
'development';
const IS_STAGING = APP_VARIANT === 'staging';
const IS_PRODUCTION = APP_VARIANT === 'production';
const IOS_BUNDLE_IDENTIFIER = IS_STAGING
? 'org.brighteng.lifecho.staging'
: IS_PRODUCTION
? 'org.brighteng.lifecho'
: 'com.anonymous.app-expo';
const ANDROID_PACKAGE = IS_STAGING
? 'org.brighteng.lifecho.staging'
: IS_PRODUCTION
? 'org.brighteng.lifecho'
: 'com.anonymous.appexpo';
const APP_DISPLAY_NAME = IS_STAGING ? 'Life Echo (Staging)' : 'Life Echo';
const PERMISSION_FALLBACKS: Record<PermissionKey, string> = {
microphone: 'Allow $(PRODUCT_NAME) to access your microphone.',
@@ -106,7 +127,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
return {
...config,
name: 'Life Echo',
name: APP_DISPLAY_NAME,
slug: 'life-echo',
version: '1.2.0',
orientation: 'portrait',
@@ -116,7 +137,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
ios: {
...config?.ios,
icon: './assets/images/icon.png',
bundleIdentifier: 'com.anonymous.app-expo',
bundleIdentifier: IOS_BUNDLE_IDENTIFIER,
config: {
usesNonExemptEncryption: false,
},
@@ -140,7 +161,7 @@ export default ({ config }: ConfigContext): ExpoConfig => {
*/
softwareKeyboardLayoutMode: 'resize',
// Reverse-DNS; no hyphens (Android package name rules). Matches iOS bundle id intent.
package: 'com.anonymous.appexpo',
package: ANDROID_PACKAGE,
adaptiveIcon: {
backgroundColor: '#E6F4FE',
foregroundImage: './assets/images/android-icon-foreground.png',
@@ -153,8 +174,9 @@ export default ({ config }: ConfigContext): ExpoConfig => {
'./plugins/withAndroidReleaseSigning',
[
'./plugins/withAndroidCleartextTraffic',
{ enabled: ALLOW_ANDROID_CLEARTEXT_TRAFFIC },
{ enabled: ALLOW_INSECURE_HTTP },
],
['./plugins/withIosInsecureHttp', { enabled: ALLOW_INSECURE_HTTP }],
'expo-router',
[
'expo-splash-screen',