fix(config): release 包固定公网接口地址,不再探测开发机
- release 默认地址固定为 publicBaseUrl(39.162.50.99:8081) - release 启动跳过环回/局域网探测,避免合并 develop 后请求到开发机 192.168 地址 - debug 行为不变,仍按环回/开发机探测并支持 dart-define 覆盖
This commit is contained in:
1 parent
d5d13549f5
commit
709972245f
1 file changed
+10
-2
@@ -51,9 +51,12 @@ class AppConfig {
|
|||||||
? _runtimeBaseUrl
|
? _runtimeBaseUrl
|
||||||
: (compiledBaseUrl.isNotEmpty ? compiledBaseUrl : defaultBaseUrl);
|
: (compiledBaseUrl.isNotEmpty ? compiledBaseUrl : defaultBaseUrl);
|
||||||
|
|
||||||
static final String _defaultBaseUrl = _runsOnDevMachine
|
/// 生产包固定走公网地址;仅 debug 才按平台默认到环回/开发机。
|
||||||
|
static final String _defaultBaseUrl = kReleaseMode
|
||||||
|
? publicBaseUrl
|
||||||
|
: (_runsOnDevMachine
|
||||||
? lanBaseUrl
|
? lanBaseUrl
|
||||||
: devHostBaseUrl;
|
: devHostBaseUrl);
|
||||||
|
|
||||||
/// 模拟器、桌面端与开发机同机,环回地址可用;iOS 真机不满足。
|
/// 模拟器、桌面端与开发机同机,环回地址可用;iOS 真机不满足。
|
||||||
/// Android 没有等价的探测方式,统一按真机处理(模拟器用
|
/// Android 没有等价的探测方式,统一按真机处理(模拟器用
|
||||||
@@ -93,6 +96,11 @@ class AppConfig {
|
|||||||
if (_runtimeBaseUrl.isEmpty) applyRuntimeBaseUrl(compiled);
|
if (_runtimeBaseUrl.isEmpty) applyRuntimeBaseUrl(compiled);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 生产包固定公网地址,不再探测环回/开发机局域网地址,避免请求到开发机。
|
||||||
|
if (kReleaseMode) {
|
||||||
|
if (_runtimeBaseUrl.isEmpty) applyRuntimeBaseUrl(publicBaseUrl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
final candidates = <String>[
|
final candidates = <String>[
|
||||||
if (_runtimeBaseUrl.isNotEmpty) _runtimeBaseUrl,
|
if (_runtimeBaseUrl.isNotEmpty) _runtimeBaseUrl,
|
||||||
for (final candidate in _probeCandidates)
|
for (final candidate in _probeCandidates)
|
||||||
|
|||||||
Reference in new issue
Block a user