implement staging workflow
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
# 仅 API/WS 基址;TTS 每轮开关由运行时 WS payload 与服务端 ENABLE_TTS 控制(见 api/.env.example)。
|
||||
EXPO_PUBLIC_API_URL=https://staging.lifecho.worldsplats.com
|
||||
EXPO_PUBLIC_WS_URL=wss://staging.lifecho.worldsplats.com
|
||||
EXPO_PUBLIC_API_URL=http://1.15.29.57:8000
|
||||
EXPO_PUBLIC_WS_URL=ws://1.15.29.57:8000
|
||||
|
||||
@@ -28,6 +28,8 @@ 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 PERMISSION_FALLBACKS: Record<PermissionKey, string> = {
|
||||
microphone: 'Allow $(PRODUCT_NAME) to access your microphone.',
|
||||
@@ -149,6 +151,10 @@ export default ({ config }: ConfigContext): ExpoConfig => {
|
||||
plugins: [
|
||||
// CI/local release: android/app/keystore.properties + store file → release signing; -PversionName/-PversionCode
|
||||
'./plugins/withAndroidReleaseSigning',
|
||||
[
|
||||
'./plugins/withAndroidCleartextTraffic',
|
||||
{ enabled: ALLOW_ANDROID_CLEARTEXT_TRAFFIC },
|
||||
],
|
||||
'expo-router',
|
||||
[
|
||||
'expo-splash-screen',
|
||||
|
||||
32
app-expo/plugins/withAndroidCleartextTraffic.js
Normal file
32
app-expo/plugins/withAndroidCleartextTraffic.js
Normal file
@@ -0,0 +1,32 @@
|
||||
// @ts-check
|
||||
/**
|
||||
* Toggle Android cleartext HTTP traffic from Expo env.
|
||||
*
|
||||
* Staging may use an IP:port HTTP endpoint while production remains HTTPS.
|
||||
*/
|
||||
const { withAndroidManifest } = require('@expo/config-plugins');
|
||||
|
||||
/**
|
||||
* @param {import('expo/config').ExpoConfig} config
|
||||
* @param {{ enabled?: boolean }} props
|
||||
*/
|
||||
function withAndroidCleartextTraffic(config, props = {}) {
|
||||
return withAndroidManifest(config, (mod) => {
|
||||
const mainApplication = mod.modResults.manifest.application?.[0];
|
||||
|
||||
if (!mainApplication) {
|
||||
throw new Error(
|
||||
'[withAndroidCleartextTraffic] Main application not found in AndroidManifest.xml.',
|
||||
);
|
||||
}
|
||||
|
||||
mainApplication.$ = mainApplication.$ ?? {};
|
||||
mainApplication.$['android:usesCleartextTraffic'] = props.enabled
|
||||
? 'true'
|
||||
: 'false';
|
||||
|
||||
return mod;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = withAndroidCleartextTraffic;
|
||||
Reference in New Issue
Block a user