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
@@ -127,7 +127,7 @@ flutter pub get
|
||||
flutter build apk --release # 产物:build\app\outputs\flutter-apk\app-release.apk
|
||||
```
|
||||
|
||||
- 发布包归档:`release\sequence_diagram_android_v1.2.1_release.apk`(**本地保留,不入库**;exe 的 `dist\` 同理)。
|
||||
- 发布包归档:`release\sequence_diagram_android_v1.2.2_release.apk`(**本地保留,不入库**;exe 的 `dist\` 同理)。
|
||||
- 上架应用商店时建议在 `android\app\build.gradle.kts` 配置正式签名后再构建 AAB:
|
||||
`flutter build appbundle --release`。
|
||||
- 应用名「时序图设计」、包名 `cc.sincos.sequence_diagram`、launcher 图标由
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
- **深色 / 浅色双主题**:右上角 ☀ / ☾ 一键切换,语义颜色不变,导出 SVG 与屏幕一致
|
||||
- **导出 SVG**:矢量、分层、带语义 `id` / `data-*` 元数据,可直接进工艺卡与 MES
|
||||
|
||||
## 正式版 V1.2.1
|
||||
## 正式版 V1.2.2
|
||||
|
||||
**可运行的 Flutter Windows 桌面正式版**(源码在 `lib/`),设计人:呆头鹅。
|
||||
|
||||
@@ -97,7 +97,7 @@ Flutter 3.29+(Desktop) · CustomPainter 自绘 · Riverpod · 不可变模
|
||||
- **正式签名**:release 用独立 keystore 签名(`android/key/release.jks`,见 `BUILD-NOTES.md`),更新安装无需卸载重装;
|
||||
- **构建**:JDK 17 + Android SDK 36(详见 `BUILD-NOTES.md`),Gradle 与 Maven 已配置国内镜像:
|
||||
```bash
|
||||
flutter build apk --release # 产物 → release/sequence_diagram_android_v1.2.1_release.apk
|
||||
flutter build apk --release # 产物 → release/sequence_diagram_android_v1.2.2_release.apk
|
||||
```
|
||||
- **自测**:`test/tablet_layout_test.dart` 覆盖 1280×800、2560×1600、960×600、800×480、竖屏 800×1280、600×960 等 7 种分辨率的无溢出回归;
|
||||
- **demo 图**:`demo/tablet-*.png`(由 `test/tablet_screenshots_test.dart` 生成)。
|
||||
@@ -113,6 +113,6 @@ Flutter 3.29+(Desktop) · CustomPainter 自绘 · Riverpod · 不可变模
|
||||
|
||||
- **软件**:时序图设计 · Sequence Diagram Studio
|
||||
- **设计人**:呆头鹅
|
||||
- **版本**:V1.2.1
|
||||
- **版本**:V1.2.2
|
||||
- **版权**:Copyright © 2026 呆头鹅。保留所有权利。
|
||||
- **架构文档**:[`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) · **使用帮助**:[`docs/HELP.md`](docs/HELP.md)
|
||||
|
||||
@@ -3,9 +3,12 @@
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="28" />
|
||||
<!-- 应用内更新 / AI 生成:网络访问(release 包必须显式声明,否则无法联网)。 -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<!-- 应用内更新:允许拉起系统安装器安装新版本 APK(Android 8.0+)。 -->
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<application
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:label="时序图设计"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 应用内更新:仅对本项目更新服务器的明文 HTTP 放行(其余域名仍禁止明文)。 -->
|
||||
<network-security-config>
|
||||
<domain-config cleartextTrafficPermitted="true">
|
||||
<domain includeSubdomains="false">124.220.63.9</domain>
|
||||
</domain-config>
|
||||
</network-security-config>
|
||||
+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';
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.2.1+13
|
||||
version: 1.2.2+14
|
||||
|
||||
environment:
|
||||
sdk: ^3.13.3
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# V1.2.2 更新内容
|
||||
|
||||
- **修复发布版无法联网的问题**:补充网络访问权限(INTERNET),并为更新服务器
|
||||
配置明文 HTTP 白名单——应用内「检查更新」恢复正常(此前 release 版收不到更新提示)
|
||||
- AI 自然语言生成在发布版中同样恢复可用
|
||||
@@ -0,0 +1,29 @@
|
||||
// 开发自检工具:直接调用应用内更新服务,检查服务器上的最新版本。
|
||||
//
|
||||
// 用途:验证更新链路(网络可达 / 接口解析 / 版本判定 / 附件匹配)。
|
||||
// 运行:
|
||||
// dart run tool\check_update.dart
|
||||
//
|
||||
// 说明:使用的是与客户端完全相同的 lib/update/update_service.dart。
|
||||
import '../lib/update/update_service.dart';
|
||||
import '../lib/version.dart';
|
||||
|
||||
Future<void> main(List<String> args) async {
|
||||
// 可传入一个版本号模拟旧安装(如 `dart run tool\check_update.dart 1.2.1`)。
|
||||
final String current = args.isNotEmpty ? args.first : kAppVersion;
|
||||
print('当前版本(模拟): $current');
|
||||
try {
|
||||
final UpdateInfo? info = await UpdateService.check(currentVersion: current);
|
||||
if (info == null) {
|
||||
print('结果: 已是最新版本(服务器无更高版本或缺少当前平台的安装包)');
|
||||
return;
|
||||
}
|
||||
print('结果: 发现新版本 v${info.version}');
|
||||
print('安装包: ${info.assetName} ${(info.assetSize / 1048576).toStringAsFixed(1)} MB');
|
||||
print('下载地址: ${info.assetUrl}');
|
||||
print('---- 更新说明 ----');
|
||||
print(info.notes.trim());
|
||||
} catch (e) {
|
||||
print('检查失败: $e');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user