refactor(config): 服务地址改为 dev/prod 配置文件与单个环境开关

启动时按环回、局域网、公网顺序探测地址,换网络后会静默切到别处,排查
困难。改为代码内一个布尔开关选择环境,地址分别放在 dev_config.dart 与
prod_config.dart,不再探测;调试条改地址后直接重载,不再重新探测。
release 构建若仍是开发开关会启动即报错,避免线上包连开发机。
This commit is contained in:
Zhou Weidong authored and trae-solo-agent committed 2026-10-29 10:44:50 +08:00
1 parent 57f84c45bd
commit a6d6b66d31
13 files changed
+101 -382

No files matched your search

@@ -15,12 +15,11 @@ const String _invalid = '请输入合法地址,例如 http://192.168.1.10:8081
const String _saveFailed = '服务地址保存失败';
const String _localNetworkHint = '手机需与电脑同一 Wi-Fi,并在 iOS 设置-隐私与安全性-本地网络 中允许本应用';
/// Debug 下编辑服务地址,保存后重新探测并加载目录。
/// Debug 下编辑服务地址,保存后立即按新地址重新加载目录。
Future<void> showCatalogEndpointEditor(
BuildContext context, {
required Future<void> Function() reload,
Future<bool> Function(String value)? save,
Future<void> Function()? probe,
}) async {
if (!kDebugMode) return;
final value = await showDialog<String>(
@@ -37,7 +36,6 @@ Future<void> showCatalogEndpointEditor(
}
return;
}
await (probe ?? () => AppConfig.probeAndApplyBaseUrl())();
await reload();
}