fix(config): align UAT endpoint and iOS video player
flutter-ci / test (push) Failing after 19m53s

This commit is contained in:
Zhou Weidong committed 2026-11-18 17:41:55 +08:00
1 parent 925a9be18e
commit ca85b66e87
5 files changed
+85 -52

No files matched your search

+6 -4
View File
@@ -2,9 +2,11 @@
/// 开发环境配置。
///
/// 本机联调用:模拟器与桌面端可直接用回环地址,但 iOS/Android 真机必须用
/// 开发机的局域网 IP(真机上的 127.0.0.1 指向手机自己)。地址不要带结尾斜杠。
/// UAT Debug 默认地址。
///
/// `uat` 分支的 Debug 包也应访问 UAT 服务,不应回落到开发机局域网地址。
/// 地址不要带结尾斜杠。
abstract final class DevConfig {
/// 开发机后端地址(Mac 当前 Wi-Fi 地址,换网络后需要同步修改)。
static const String baseUrl = 'http://192.168.31.120:8081';
/// UAT 客户端 API 地址。
static const String baseUrl = 'https://drama-api.frostgiant.vip';
}
+11 -1
View File
@@ -10,6 +10,9 @@ abstract final class ServerEndpoint {
/// Preference key used for the runtime server address.
static const String preferenceKey = 'dev.api_base_url';
/// 地址迁移前的开发机默认值;UAT 启动时不能继续使用它。
static const String legacyLocalBaseUrl = 'http://192.168.31.120:8081';
/// Returns a normalized http(s) URL, or null for invalid input.
static String? normalize(String? raw) {
final value = raw?.trim() ?? '';
@@ -38,8 +41,15 @@ abstract final class ServerEndpoint {
try {
final prefs = preferences ?? SharedPreferencesAsync();
final stored = await prefs.getString(preferenceKey);
final normalizedStored = normalize(stored);
if (normalizedStored == legacyLocalBaseUrl &&
normalize(AppConfig.baseUrl) != legacyLocalBaseUrl) {
await prefs.remove(preferenceKey);
AppConfig.clearRuntimeBaseUrl();
return;
}
AppConfig.applyRuntimeBaseUrl(
resolve(stored: stored, fallback: AppConfig.baseUrl),
resolve(stored: normalizedStored, fallback: AppConfig.baseUrl),
);
} catch (_) {
AppConfig.clearRuntimeBaseUrl();