fix(android): 修复 release 版无法联网(缺 INTERNET 权限);发布 v1.2.2
- 根因:Flutter 模板只在 debug/profile 清单中声明 INTERNET,release 包默认没有, 导致发布版「检查更新」与「AI 生成」全部无法联网 - 主清单补充 INTERNET 权限,并新增 network_security_config:仅对更新服务器 放行明文 HTTP(其余域名仍禁止) - UpdateService.check 支持传入模拟版本(自检用);新增 tool/check_update.dart 开发自检工具,可直接验证更新链路 - 版本号 1.2.2+14
This commit is contained in:
+1
-1
@@ -2124,7 +2124,7 @@ class HelpDialog extends StatelessWidget {
|
||||
Text('时序图设计 · Sequence Diagram Studio',
|
||||
style: TextStyle(color: t.text, fontSize: 15, fontWeight: FontWeight.w700)),
|
||||
const SizedBox(height: 4),
|
||||
Text('V1.2.1(${android ? '安卓版' : 'Windows 版'})',
|
||||
Text('V1.2.2(${android ? '安卓版' : 'Windows 版'})',
|
||||
style: TextStyle(color: t.dim, fontSize: 12)),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -86,10 +86,12 @@ class UpdateService {
|
||||
|
||||
/// 检查更新。
|
||||
///
|
||||
/// 远端版本高于 [kAppVersion] 且存在当前平台的安装包时返回 [UpdateInfo];
|
||||
/// [currentVersion] 为当前版本(缺省用 [kAppVersion];自检工具可传入模拟值)。
|
||||
/// 远端版本高于当前版本且存在当前平台的安装包时返回 [UpdateInfo];
|
||||
/// 无更新(或尚未发布任何版本)返回 null;网络 / 服务器异常抛出 [Exception],
|
||||
/// 由调用方决定是否静默。
|
||||
static Future<UpdateInfo?> check() async {
|
||||
static Future<UpdateInfo?> check({String? currentVersion}) async {
|
||||
final String current = currentVersion ?? kAppVersion;
|
||||
final HttpClient client = HttpClient()
|
||||
..connectionTimeout = const Duration(seconds: 8);
|
||||
try {
|
||||
@@ -103,7 +105,7 @@ class UpdateService {
|
||||
}
|
||||
final Map<String, dynamic> j = jsonDecode(text) as Map<String, dynamic>;
|
||||
final String tag = (j['tag_name'] as String?) ?? '';
|
||||
if (!isNewerVersion(tag, kAppVersion)) return null;
|
||||
if (!isNewerVersion(tag, current)) return null;
|
||||
final String notes = (j['body'] as String?) ?? '';
|
||||
// 选择当前平台的安装包:安卓取 .apk;Windows 优先 .zip(绿色版整包)。
|
||||
bool isTarget(String n) {
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@
|
||||
///
|
||||
/// 应用内更新检查用它判断服务器发布的版本是否更新;
|
||||
/// **每次发版必须与 pubspec 同步更新**(见 BUILD-NOTES 的发布流程)。
|
||||
const String kAppVersion = '1.2.1';
|
||||
const String kAppVersion = '1.2.2';
|
||||
|
||||
Reference in New Issue
Block a user