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

@@ -2,6 +2,26 @@ function trimTrailingSlashes(value: string): string {
return value.replace(/\/+$/, '');
}
export type AppVariant = 'development' | 'staging' | 'production';
function resolveAppVariant(): AppVariant {
const raw = process.env.EXPO_PUBLIC_APP_VARIANT;
if (raw === 'development' || raw === 'staging' || raw === 'production') {
return raw;
}
if (__DEV__) {
return 'development';
}
return 'production';
}
/** Shown on About screen for dev/staging builds only. */
export function shouldShowAboutBackendUrl(variant: AppVariant = appVariant): boolean {
return variant === 'development' || variant === 'staging';
}
export const appVariant = resolveAppVariant();
export const config = {
apiBaseUrl: trimTrailingSlashes(
process.env.EXPO_PUBLIC_API_URL ?? 'http://192.168.10.151:8000',
@@ -10,6 +30,8 @@ export const config = {
process.env.EXPO_PUBLIC_WS_URL ?? 'ws://192.168.10.151:8000',
),
isDebugMode: __DEV__,
appVariant,
showAboutBackendUrl: shouldShowAboutBackendUrl(),
api: {
timeoutMs: 30_000,