add staging ios app build script
This commit is contained in:
@@ -12,11 +12,21 @@ function resolveAppVariant(): AppVariant {
|
||||
if (__DEV__) {
|
||||
return 'development';
|
||||
}
|
||||
// Release 包若 env 未写入 APP_VARIANT(例如仅复制了 env/staging 到 .env 但变量缺失),
|
||||
// 仍按 API 是否为 http 推断预发,避免关于页误隐藏后端地址。
|
||||
const apiUrl = process.env.EXPO_PUBLIC_API_URL ?? '';
|
||||
if (apiUrl.startsWith('http://')) {
|
||||
return 'staging';
|
||||
}
|
||||
return 'production';
|
||||
}
|
||||
|
||||
/** Shown on About screen for dev/staging builds only. */
|
||||
/** Shown on About screen for dev/staging builds only (never production Release). */
|
||||
export function shouldShowAboutBackendUrl(variant: AppVariant = appVariant): boolean {
|
||||
// Metro / 调试包:始终显示,避免 .env 误用 production variant 时看不到实际 API
|
||||
if (__DEV__) {
|
||||
return true;
|
||||
}
|
||||
return variant === 'development' || variant === 'staging';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user