feat(update): 应用内更新(检查/下载/安装)与发版流程;版本 1.2.0
- 工具栏新增检查更新按钮:启动静默检查,发现新版本时显示红色角标; 未检测到新版本或安装包时弹窗提示「当前已是最新版本」 - 更新源:Gitea Releases(说明 = Release 正文 Markdown;安装包 = 附件, 不进入 git 历史,仓库保持精简) - 安卓:下载 APK → FileProvider + 系统安装器直接覆盖安装(签名一致) - Windows:下载绿色版 zip → 解压 → 生成替换脚本,主程序退出后原地覆盖并自动重启 - 新增 lib/update/update_service.dart、lib/ui/update_dialog.dart、lib/version.dart - 安卓侧:REQUEST_INSTALL_PACKAGES + FileProvider + installApk/getCacheDir 通道 + androidx.core - 发版工具:scripts/publish_release.ps1(打包 dist、创建 Release、上传附件) - 测试:test/update_version_test.dart(版本比较 4 组);启动检查在测试环境自动跳过 - 版本号 1.2.0+12;BUILD-NOTES 补充应用内更新与发版流程
This commit is contained in:
+29
-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.1.0_release.apk`(**本地保留,不入库**;exe 的 `dist\` 同理)。
|
||||
- 发布包归档:`release\sequence_diagram_android_v1.2.0_release.apk`(**本地保留,不入库**;exe 的 `dist\` 同理)。
|
||||
- 上架应用商店时建议在 `android\app\build.gradle.kts` 配置正式签名后再构建 AAB:
|
||||
`flutter build appbundle --release`。
|
||||
- 应用名「时序图设计」、包名 `cc.sincos.sequence_diagram`、launcher 图标由
|
||||
@@ -183,3 +183,31 @@ flutter build apk --release # 产物:build\app\outputs\flutter-apk\app-
|
||||
flutter test test\tablet_layout_test.dart # 7 种分辨率无溢出回归
|
||||
flutter test --update-goldens test\tablet_screenshots_test.dart # 重新生成 demo/tablet-*.png
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 应用内更新与发版流程
|
||||
|
||||
**客户端逻辑**(`lib/update/update_service.dart`、`lib/ui/update_dialog.dart`):
|
||||
|
||||
- 启动后静默检查 + 工具栏「检查更新」按钮(有新版本时显示红色角标);
|
||||
- 更新源 = Gitea 仓库的「发布(Releases)」:`GET /api/v1/repos/admin/Sequence-Diagram/releases/latest`(公开只读);
|
||||
- 更新说明 = Release 正文(Markdown);安装包 = Release 附件(安卓 `.apk`,Windows `.zip` 绿色版整包);
|
||||
- 安卓:下载 APK → FileProvider + 系统安装器安装(签名一致可直接覆盖安装);
|
||||
- Windows:下载 zip → 解压 → 生成替换脚本,等主程序退出后原地覆盖并自动重启(无需安装);
|
||||
- 版本判定使用 `lib/version.dart` 的 `kAppVersion`(**每次发版必须与 pubspec 的 version 同步**);
|
||||
- 未检测到新版本或安装包时,弹窗提示「当前已是最新版本」。
|
||||
|
||||
**发版流程**(版本号 V,形如 `1.2.0`):
|
||||
|
||||
1. 同步版本号:`pubspec.yaml` 的 `version: V+build` 与 `lib/version.dart` 的 `kAppVersion`;
|
||||
2. 构建:`flutter build apk --release`、`flutter build windows --release --no-tree-shake-icons`;
|
||||
3. 归档:APK → `release\sequence_diagram_android_vV_release.apk`;绿色版 → `dist\`;
|
||||
4. 写更新说明:`release\RELEASE_NOTES_vV.md`(用户可见的更新内容);
|
||||
5. 发布到服务器(创建 Release + 上传 APK 与绿色版 zip 附件):
|
||||
|
||||
```powershell
|
||||
powershell -File scripts\publish_release.ps1 -Version V -NotesFile release\RELEASE_NOTES_vV.md
|
||||
```
|
||||
|
||||
安装包以 Release 附件形式存放在服务器,**不进入 git 历史**,仓库保持精简。
|
||||
@@ -9,7 +9,7 @@
|
||||
- **深色 / 浅色双主题**:右上角 ☀ / ☾ 一键切换,语义颜色不变,导出 SVG 与屏幕一致
|
||||
- **导出 SVG**:矢量、分层、带语义 `id` / `data-*` 元数据,可直接进工艺卡与 MES
|
||||
|
||||
## 正式版 V1.1.0
|
||||
## 正式版 V1.2.0
|
||||
|
||||
**可运行的 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.1.0_release.apk
|
||||
flutter build apk --release # 产物 → release/sequence_diagram_android_v1.2.0_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.1.0
|
||||
- **版本**:V1.2.0
|
||||
- **版权**:Copyright © 2026 呆头鹅。保留所有权利。
|
||||
- **架构文档**:[`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) · **使用帮助**:[`docs/HELP.md`](docs/HELP.md)
|
||||
|
||||
@@ -72,3 +72,8 @@ kotlin {
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// 应用内更新:FileProvider(把缓存中的新版本 APK 以 content:// 提供给系统安装器)。
|
||||
implementation("androidx.core:core-ktx:1.13.1")
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="28" />
|
||||
<!-- 应用内更新:允许拉起系统安装器安装新版本 APK(Android 8.0+)。 -->
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<application
|
||||
android:label="时序图设计"
|
||||
android:name="${applicationName}"
|
||||
@@ -29,6 +31,16 @@
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- 应用内更新:把缓存目录中的新版本 APK 以 content:// 提供给系统安装器。 -->
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.provider.MediaStore
|
||||
import androidx.core.content.FileProvider
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
@@ -81,6 +82,22 @@ class MainActivity : FlutterActivity() {
|
||||
}
|
||||
}
|
||||
}
|
||||
"getCacheDir" -> {
|
||||
result.success(cacheDir.absolutePath)
|
||||
}
|
||||
"installApk" -> {
|
||||
val path = call.argument<String>("path")
|
||||
if (path == null) {
|
||||
result.error("ARGS", "path required", null)
|
||||
} else {
|
||||
try {
|
||||
installApk(path)
|
||||
result.success(true)
|
||||
} catch (e: Exception) {
|
||||
result.error("INSTALL", e.message, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
else -> result.notImplemented()
|
||||
}
|
||||
}
|
||||
@@ -200,4 +217,17 @@ class MainActivity : FlutterActivity() {
|
||||
)
|
||||
return if (f.exists()) f.readBytes() else null
|
||||
}
|
||||
|
||||
/** 应用内更新:拉起系统安装器安装缓存目录中的新版本 APK。 */
|
||||
private fun installApk(path: String) {
|
||||
val file = File(path)
|
||||
if (!file.exists()) throw IllegalStateException("APK not found: $path")
|
||||
val uri = FileProvider.getUriForFile(this, "$packageName.fileprovider", file)
|
||||
val intent = Intent(Intent.ACTION_VIEW).apply {
|
||||
setDataAndType(uri, "application/vnd.android.package-archive")
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 应用内更新:FileProvider 暴露缓存目录中的新版本 APK,供系统安装器读取。 -->
|
||||
<paths>
|
||||
<cache-path name="cache" path="." />
|
||||
<files-path name="files" path="." />
|
||||
<external-files-path name="external" path="." />
|
||||
</paths>
|
||||
+69
-1
@@ -22,11 +22,14 @@ import '../model/units.dart';
|
||||
import '../persistence/android_docs.dart';
|
||||
import '../state/app_controller.dart';
|
||||
import '../theme/tokens.dart';
|
||||
import '../update/update_service.dart';
|
||||
import '../version.dart';
|
||||
import 'ai_dialog.dart';
|
||||
import 'app_logo.dart';
|
||||
import 'canvas_overlays.dart';
|
||||
import 'canvas_view.dart';
|
||||
import 'dialogs.dart';
|
||||
import 'update_dialog.dart';
|
||||
|
||||
/// 应用外壳组件:承载主界面布局与文件/侧栏等交互逻辑。
|
||||
class AppShell extends StatefulWidget {
|
||||
@@ -94,13 +97,21 @@ class _AppShellState extends State<AppShell> {
|
||||
/// 右侧栏是否收起为贴边轨道。
|
||||
bool get _rightRail => !_rightDocked && !_rightFloat;
|
||||
|
||||
/// 订阅控制器变化以便刷新界面。
|
||||
/// 订阅控制器变化以便刷新界面;启动后延迟静默检查更新。
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
c.addListener(_onChange);
|
||||
// 延迟几秒再检查,避免与启动渲染争资源。
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _autoCheckUpdate());
|
||||
}
|
||||
|
||||
// ---- 应用内更新状态 ----
|
||||
/// 检测到的新版本信息;为空表示暂无更新(或尚未检查 / 检查失败)。
|
||||
UpdateInfo? _update;
|
||||
/// 是否正在手动检查更新(防止重复点击)。
|
||||
bool _checkingUpdate = false;
|
||||
|
||||
/// 是否已完成一次按平台 / 屏幕宽度的默认布局初始化。
|
||||
bool _layoutInited = false;
|
||||
|
||||
@@ -431,6 +442,61 @@ class _AppShellState extends State<AppShell> {
|
||||
);
|
||||
}
|
||||
|
||||
// ===================== 应用内更新 =====================
|
||||
|
||||
/// 启动后静默检查更新:发现新版本时在工具栏按钮上显示红色角标。
|
||||
Future<void> _autoCheckUpdate() async {
|
||||
// 测试环境不发起网络检查(避免 pending timer 与真实请求)。
|
||||
if (Platform.environment['FLUTTER_TEST'] == 'true') return;
|
||||
await Future<void>.delayed(const Duration(seconds: 3));
|
||||
if (!mounted || _update != null) return;
|
||||
try {
|
||||
final UpdateInfo? info = await UpdateService.check();
|
||||
if (mounted && info != null) setState(() => _update = info);
|
||||
} catch (_) {
|
||||
// 静默失败:不打扰用户
|
||||
}
|
||||
}
|
||||
|
||||
/// 更新检查按钮:检测到新版本时叠加红色角标。
|
||||
Widget _updateBtn(Tokens t) {
|
||||
final UpdateInfo? info = _update;
|
||||
final Widget btn = _iconBtn(t, Icons.system_update_alt, _openUpdate,
|
||||
tooltip: info == null ? '检查更新' : '发现新版本 v${info.version}');
|
||||
if (info == null) return btn;
|
||||
return Badge(backgroundColor: t.danger, smallSize: 8, child: btn);
|
||||
}
|
||||
|
||||
/// 打开更新对话框:已有检测结果时直接弹出,否则先检查一次。
|
||||
Future<void> _openUpdate() async {
|
||||
if (_checkingUpdate) return;
|
||||
UpdateInfo? info = _update;
|
||||
if (info == null) {
|
||||
_checkingUpdate = true;
|
||||
c.setStatus('正在检查更新…');
|
||||
try {
|
||||
info = await UpdateService.check();
|
||||
} catch (e) {
|
||||
if (mounted) c.setStatus('检查更新失败:$e');
|
||||
} finally {
|
||||
_checkingUpdate = false;
|
||||
}
|
||||
if (!mounted) return;
|
||||
if (info == null) {
|
||||
// 没有更新的说明与安装包:明确提示当前已是最新版本。
|
||||
c.setStatus('已是最新版本(v$kAppVersion)');
|
||||
await showMessage(context, '检查更新', '当前已是最新版本(v$kAppVersion)。');
|
||||
return;
|
||||
}
|
||||
setState(() => _update = info);
|
||||
}
|
||||
if (!mounted) return;
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => UpdateDialog(controller: c, info: info!),
|
||||
);
|
||||
}
|
||||
|
||||
// ===================== 工具栏(自适应 / 紧凑) =====================
|
||||
|
||||
/// 构建顶部工具栏:左侧为品牌与文件/编辑操作,右侧为导出、缩放、
|
||||
@@ -522,6 +588,7 @@ class _AppShellState extends State<AppShell> {
|
||||
sideToggleRight,
|
||||
_iconBtn(t, Icons.help_outline, () =>
|
||||
showDialog<void>(context: context, builder: (_) => const HelpDialog()), tooltip: '帮助 F1'),
|
||||
_updateBtn(t),
|
||||
_themeToggle(t),
|
||||
];
|
||||
} else {
|
||||
@@ -561,6 +628,7 @@ class _AppShellState extends State<AppShell> {
|
||||
sideToggleRight,
|
||||
_iconBtn(t, Icons.help_outline, () =>
|
||||
showDialog<void>(context: context, builder: (_) => const HelpDialog()), tooltip: '帮助 F1'),
|
||||
_updateBtn(t),
|
||||
_themeToggle(t),
|
||||
];
|
||||
}
|
||||
|
||||
+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.1.0(${android ? '安卓版' : 'Windows 版'})',
|
||||
Text('V1.2.0(${android ? '安卓版' : 'Windows 版'})',
|
||||
style: TextStyle(color: t.dim, fontSize: 12)),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -0,0 +1,319 @@
|
||||
/// 应用内更新对话框。
|
||||
///
|
||||
/// 展示新版本号、更新说明(Release 正文即为 Markdown 文本)与安装包信息;
|
||||
/// 底部提供「立即更新」按钮与下载进度条:
|
||||
/// - Android:下载 APK 到应用缓存目录,经 FileProvider 交给系统安装程序;
|
||||
/// - Windows:下载绿色版整包(zip),解压后生成替换脚本——等待本程序退出、
|
||||
/// 原地覆盖 dist 目录并自动重启,无需安装。
|
||||
library;
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../state/app_controller.dart';
|
||||
import '../theme/tokens.dart';
|
||||
import '../update/update_service.dart';
|
||||
import '../version.dart';
|
||||
import 'dialogs.dart';
|
||||
|
||||
/// 应用内更新对话框。
|
||||
class UpdateDialog extends StatefulWidget {
|
||||
/// 构造;[info] 为本次检测到的更新信息。
|
||||
const UpdateDialog({super.key, required this.controller, required this.info});
|
||||
|
||||
/// 全局应用控制器(用于状态栏提示)。
|
||||
final AppController controller;
|
||||
|
||||
/// 更新信息。
|
||||
final UpdateInfo info;
|
||||
|
||||
@override
|
||||
State<UpdateDialog> createState() => _UpdateDialogState();
|
||||
}
|
||||
|
||||
class _UpdateDialogState extends State<UpdateDialog> {
|
||||
/// 与安卓原生桥接(复用现有 `seqstudio/docs` 通道)。
|
||||
static const MethodChannel _channel = MethodChannel('seqstudio/docs');
|
||||
|
||||
bool _busy = false;
|
||||
bool _cancelled = false;
|
||||
bool _done = false;
|
||||
double _progress = -1;
|
||||
int _received = 0;
|
||||
String _status = '';
|
||||
String? _error;
|
||||
|
||||
/// 「立即更新」:按平台执行下载与安装 / 覆盖更新。
|
||||
Future<void> _start() async {
|
||||
setState(() {
|
||||
_busy = true;
|
||||
_error = null;
|
||||
_cancelled = false;
|
||||
_done = false;
|
||||
_progress = -1;
|
||||
_received = 0;
|
||||
_status = '正在下载更新包…';
|
||||
});
|
||||
try {
|
||||
if (Platform.isAndroid) {
|
||||
await _updateAndroid();
|
||||
} else if (Platform.isWindows) {
|
||||
await _updateWindows();
|
||||
} else {
|
||||
throw Exception('当前平台暂不支持应用内更新');
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_error = '$e';
|
||||
_busy = false;
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (mounted) setState(() => _busy = false);
|
||||
}
|
||||
|
||||
/// 安卓:下载 APK → 交给系统安装程序。
|
||||
Future<void> _updateAndroid() async {
|
||||
final String? dir = await _channel.invokeMethod<String>('getCacheDir');
|
||||
if (dir == null || dir.isEmpty) throw Exception('无法获取应用缓存目录');
|
||||
final String dest = '$dir${Platform.pathSeparator}${widget.info.assetName}';
|
||||
await UpdateService.download(
|
||||
url: widget.info.assetUrl,
|
||||
destPath: dest,
|
||||
isCancelled: () => _cancelled,
|
||||
onProgress: _onProgress,
|
||||
);
|
||||
if (_cancelled) throw Exception('已取消');
|
||||
if (mounted) setState(() => _status = '正在启动系统安装程序…');
|
||||
await _channel.invokeMethod<bool>('installApk', <String, dynamic>{'path': dest});
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_status = '已交给系统安装程序,请在弹出的界面完成安装。';
|
||||
_done = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Windows:下载绿色版整包 → 解压 → 生成替换脚本 → 退出并自动重启。
|
||||
Future<void> _updateWindows() async {
|
||||
final Directory tmp = await Directory.systemTemp.createTemp('seq_update_');
|
||||
final String zipPath = '${tmp.path}\\update.zip';
|
||||
await UpdateService.download(
|
||||
url: widget.info.assetUrl,
|
||||
destPath: zipPath,
|
||||
isCancelled: () => _cancelled,
|
||||
onProgress: _onProgress,
|
||||
);
|
||||
if (_cancelled) throw Exception('已取消');
|
||||
|
||||
if (mounted) setState(() => _status = '正在解压更新包…');
|
||||
final String extractDir = '${tmp.path}\\app';
|
||||
await Directory(extractDir).create(recursive: true);
|
||||
final ProcessResult r =
|
||||
await Process.run('tar', <String>['-xf', zipPath, '-C', extractDir]);
|
||||
if (r.exitCode != 0) throw Exception('解压失败:${r.stderr}');
|
||||
|
||||
// 兼容两种打包方式:zip 根目录即程序文件,或多包一层 dist/。
|
||||
String srcDir = extractDir;
|
||||
if (!File('$extractDir\\sequence_diagram.exe').existsSync()) {
|
||||
if (File('$extractDir\\dist\\sequence_diagram.exe').existsSync()) {
|
||||
srcDir = '$extractDir\\dist';
|
||||
} else {
|
||||
throw Exception('更新包内容不完整(未找到 sequence_diagram.exe)');
|
||||
}
|
||||
}
|
||||
|
||||
if (mounted) setState(() => _status = '正在准备覆盖更新…');
|
||||
final String appDir = File(Platform.resolvedExecutable).parent.path;
|
||||
final String batPath = '${tmp.path}\\apply_update.bat';
|
||||
// 生成替换脚本:等待本程序退出 → 原地覆盖 → 重新启动。
|
||||
// 内容保持纯 ASCII,源/目标路径通过参数传入(cmd 以 UTF-16 接收参数,
|
||||
// 中文安装路径也能正确处理);脚本文件本身不包含路径,避免编码问题。
|
||||
File(batPath).writeAsStringSync(
|
||||
'@echo off\r\n'
|
||||
':wait\r\n'
|
||||
'tasklist /fi "IMAGENAME eq sequence_diagram.exe" | find /i "sequence_diagram.exe" >nul\r\n'
|
||||
'if not errorlevel 1 (\r\n'
|
||||
' ping -n 1 -w 600 127.0.0.1 >nul\r\n'
|
||||
' goto wait\r\n'
|
||||
')\r\n'
|
||||
'xcopy /e /i /y /q "%~1\\*" "%~2\\"\r\n'
|
||||
'start "" "%~2\\sequence_diagram.exe"\r\n'
|
||||
'del "%~f0"\r\n',
|
||||
flush: true,
|
||||
);
|
||||
await Process.start(
|
||||
'cmd',
|
||||
<String>['/c', batPath, srcDir, appDir],
|
||||
mode: ProcessStartMode.detached,
|
||||
);
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_status = '更新就绪,软件即将重启完成覆盖…';
|
||||
_done = true;
|
||||
});
|
||||
}
|
||||
await Future<void>.delayed(const Duration(milliseconds: 900));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/// 下载进度回调:刷新进度条与状态文本。
|
||||
void _onProgress(double progress, int received) {
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_progress = progress;
|
||||
_received = received;
|
||||
});
|
||||
}
|
||||
|
||||
/// 取消 / 关闭按钮:下载中先中断下载。
|
||||
void _cancel() {
|
||||
_cancelled = true;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Tokens t = context.tok;
|
||||
final UpdateInfo info = widget.info;
|
||||
final String sizeText = info.assetSize > 0
|
||||
? '${(info.assetSize / 1048576).toStringAsFixed(1)} MB'
|
||||
: '';
|
||||
return Dialog(
|
||||
backgroundColor: t.dialog,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
||||
child: scaledDialogBox(
|
||||
context,
|
||||
620,
|
||||
560,
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(18),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
// 标题
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Icon(Icons.system_update_alt, size: 21, color: t.accent),
|
||||
const SizedBox(width: 8),
|
||||
Text('发现新版本 v${info.version}',
|
||||
style: TextStyle(color: t.text, fontSize: 17, fontWeight: FontWeight.w700)),
|
||||
const Spacer(),
|
||||
Text('当前 v$kAppVersion', style: TextStyle(color: t.dim, fontSize: 11.5)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'安装包:${info.assetName}${sizeText.isEmpty ? '' : '($sizeText)'}',
|
||||
style: TextStyle(color: t.dim, fontSize: 11),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const Divider(height: 20),
|
||||
|
||||
// 更新说明(Release 正文)
|
||||
Text('更新内容', style: TextStyle(color: t.sub, fontSize: 12.5, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 6),
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: t.panel2,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: t.line2),
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: SelectableText(
|
||||
info.notes.trim().isEmpty ? '(本次更新未提供说明)' : info.notes,
|
||||
style: TextStyle(color: t.text, fontSize: 12.5, height: 1.7),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// 进度 / 状态 / 错误
|
||||
if (_busy || _done) ...<Widget>[
|
||||
const SizedBox(height: 12),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
child: LinearProgressIndicator(
|
||||
value: _done ? 1 : (_progress >= 0 ? _progress : null),
|
||||
minHeight: 5,
|
||||
color: t.accent2,
|
||||
backgroundColor: t.line2,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(_status, style: TextStyle(color: t.sub, fontSize: 12)),
|
||||
),
|
||||
if (_busy && _progress >= 0)
|
||||
Text('${(_progress * 100).clamp(0, 100).toStringAsFixed(0)}% · '
|
||||
'${(_received / 1048576).toStringAsFixed(1)} MB',
|
||||
style: TextStyle(color: t.dim, fontSize: 11)),
|
||||
],
|
||||
),
|
||||
],
|
||||
if (_error != null) ...<Widget>[
|
||||
const SizedBox(height: 10),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: _error == '已取消' ? t.panel2 : t.danger.withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: _error == '已取消' ? t.line2 : t.danger.withValues(alpha: 0.5)),
|
||||
),
|
||||
child: Text(_error!,
|
||||
style: TextStyle(
|
||||
color: _error == '已取消' ? t.sub : t.danger,
|
||||
fontSize: 12,
|
||||
height: 1.5)),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 14),
|
||||
|
||||
// 操作按钮
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
Platform.isAndroid ? '下载后由系统安装程序完成安装(签名一致可直接覆盖)' : '绿色版原地覆盖,软件会自动重启',
|
||||
style: TextStyle(color: t.dim, fontSize: 11),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
if (_busy) _cancel();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(_busy ? '取消下载' : '关闭'),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
FilledButton.icon(
|
||||
onPressed: _busy || _done ? null : _start,
|
||||
icon: const Icon(Icons.download, size: 16),
|
||||
label: Text(_done ? '已完成' : '立即更新'),
|
||||
style: FilledButton.styleFrom(
|
||||
backgroundColor: t.accent2,
|
||||
foregroundColor: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(9)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 12),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
/// 应用内更新服务:从 Gitea 仓库的「发布(Releases)」检查新版本并下载更新包。
|
||||
///
|
||||
/// 服务器约定(当前仓库 http://124.220.63.9:30000/admin/Sequence-Diagram):
|
||||
/// - 检查:`GET /api/v1/repos/{owner}/{repo}/releases/latest`(公开仓库,无需鉴权);
|
||||
/// - 更新说明:使用 Release 的正文(Markdown);
|
||||
/// - 安装包:使用 Release 附件——安卓为 `.apk`,Windows 为 `.zip`(绿色版整包)。
|
||||
///
|
||||
/// 采用 Release 附件而不是把安装包提交进 git:仓库历史不会被大文件撑大,
|
||||
/// 客户端仍可通过稳定的下载地址获取(Gitea 会 302 到附件实际存储位置)。
|
||||
library;
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import '../version.dart';
|
||||
|
||||
/// Gitea 服务器与仓库定位。
|
||||
class UpdateServer {
|
||||
/// 服务器根地址。
|
||||
static const String host = 'http://124.220.63.9:30000';
|
||||
/// 仓库拥有者。
|
||||
static const String owner = 'admin';
|
||||
/// 仓库名称。
|
||||
static const String repo = 'Sequence-Diagram';
|
||||
|
||||
/// 版本检查接口(最新正式发布)。
|
||||
static String get latestReleaseApi =>
|
||||
'$host/api/v1/repos/$owner/$repo/releases/latest';
|
||||
}
|
||||
|
||||
/// 一次可用的更新。
|
||||
class UpdateInfo {
|
||||
/// 构造。
|
||||
const UpdateInfo({
|
||||
required this.version,
|
||||
required this.notes,
|
||||
required this.assetName,
|
||||
required this.assetUrl,
|
||||
required this.assetSize,
|
||||
});
|
||||
|
||||
/// 远端版本号(已去掉 `v` 前缀,如 `1.2.1`)。
|
||||
final String version;
|
||||
|
||||
/// 更新说明(Markdown 文本)。
|
||||
final String notes;
|
||||
|
||||
/// 安装包文件名(如 `sequence_diagram_android_v1.2.1_release.apk`)。
|
||||
final String assetName;
|
||||
|
||||
/// 安装包下载地址。
|
||||
final String assetUrl;
|
||||
|
||||
/// 安装包大小(字节;未知为 0)。
|
||||
final int assetSize;
|
||||
}
|
||||
|
||||
/// 版本比较:[remote] 是否比 [current] 更新。
|
||||
///
|
||||
/// 按点分数字段逐段比较,容忍 `v` 前缀与 `-` / `+` 后缀(如 `v1.2.1-rc1`)。
|
||||
bool isNewerVersion(String remote, String current) {
|
||||
List<int> parse(String v) {
|
||||
final String core =
|
||||
v.trim().replaceAll(RegExp(r'^[vV]'), '').split(RegExp(r'[-+]')).first;
|
||||
final List<int> parts = <int>[];
|
||||
for (final String s in core.split('.')) {
|
||||
parts.add(int.tryParse(s) ?? 0);
|
||||
}
|
||||
return parts;
|
||||
}
|
||||
|
||||
final List<int> a = parse(remote);
|
||||
final List<int> b = parse(current);
|
||||
final int n = a.length > b.length ? a.length : b.length;
|
||||
for (int i = 0; i < n; i++) {
|
||||
final int x = i < a.length ? a[i] : 0;
|
||||
final int y = i < b.length ? b[i] : 0;
|
||||
if (x != y) return x > y;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 更新服务:检查 + 下载。
|
||||
class UpdateService {
|
||||
UpdateService._();
|
||||
|
||||
/// 检查更新。
|
||||
///
|
||||
/// 远端版本高于 [kAppVersion] 且存在当前平台的安装包时返回 [UpdateInfo];
|
||||
/// 无更新(或尚未发布任何版本)返回 null;网络 / 服务器异常抛出 [Exception],
|
||||
/// 由调用方决定是否静默。
|
||||
static Future<UpdateInfo?> check() async {
|
||||
final HttpClient client = HttpClient()
|
||||
..connectionTimeout = const Duration(seconds: 8);
|
||||
try {
|
||||
final HttpClientRequest req =
|
||||
await client.getUrl(Uri.parse(UpdateServer.latestReleaseApi));
|
||||
final HttpClientResponse res = await req.close();
|
||||
if (res.statusCode == 404) return null; // 还没有任何发布
|
||||
final String text = await res.transform(utf8.decoder).join();
|
||||
if (res.statusCode != 200) {
|
||||
throw Exception('服务器返回 ${res.statusCode}');
|
||||
}
|
||||
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;
|
||||
final String notes = (j['body'] as String?) ?? '';
|
||||
// 选择当前平台的安装包:安卓取 .apk;Windows 优先 .zip(绿色版整包)。
|
||||
bool isTarget(String n) {
|
||||
final String l = n.toLowerCase();
|
||||
if (Platform.isAndroid) return l.endsWith('.apk');
|
||||
return l.endsWith('.zip');
|
||||
}
|
||||
|
||||
final List<dynamic> assets =
|
||||
(j['assets'] as List<dynamic>?) ?? const <dynamic>[];
|
||||
String name = '';
|
||||
String url = '';
|
||||
int size = 0;
|
||||
for (final dynamic a in assets) {
|
||||
final Map<String, dynamic> m = a as Map<String, dynamic>;
|
||||
final String an = (m['name'] as String?) ?? '';
|
||||
if (an.isEmpty || !isTarget(an)) continue;
|
||||
name = an;
|
||||
url = (m['browser_download_url'] as String?) ?? '';
|
||||
size = (m['size'] as num?)?.toInt() ?? 0;
|
||||
break;
|
||||
}
|
||||
if (name.isEmpty || url.isEmpty) return null;
|
||||
return UpdateInfo(
|
||||
version: tag.trim().replaceAll(RegExp(r'^[vV]'), ''),
|
||||
notes: notes,
|
||||
assetName: name,
|
||||
assetUrl: url,
|
||||
assetSize: size,
|
||||
);
|
||||
} finally {
|
||||
client.close(force: true);
|
||||
}
|
||||
}
|
||||
|
||||
/// 流式下载 [url] 到 [destPath]。
|
||||
///
|
||||
/// [onProgress] 回调 `(0..1 进度, 已接收字节)`;总长未知时进度为 -1。
|
||||
/// [isCancelled] 返回 true 时中断下载并抛出「已取消」。
|
||||
static Future<void> download({
|
||||
required String url,
|
||||
required String destPath,
|
||||
void Function(double progress, int received)? onProgress,
|
||||
bool Function()? isCancelled,
|
||||
}) async {
|
||||
final HttpClient client = HttpClient()
|
||||
..connectionTimeout = const Duration(seconds: 15);
|
||||
IOSink? sink;
|
||||
try {
|
||||
final HttpClientRequest req = await client.getUrl(Uri.parse(url));
|
||||
final HttpClientResponse res = await req.close();
|
||||
if (res.statusCode != 200) {
|
||||
throw Exception('下载失败:服务器返回 ${res.statusCode}');
|
||||
}
|
||||
final int total = res.contentLength; // -1 表示未知
|
||||
final File f = File(destPath);
|
||||
await f.parent.create(recursive: true);
|
||||
sink = f.openWrite();
|
||||
int received = 0;
|
||||
await for (final List<int> chunk in res) {
|
||||
if (isCancelled?.call() ?? false) throw Exception('已取消');
|
||||
sink.add(chunk);
|
||||
received += chunk.length;
|
||||
onProgress?.call(total > 0 ? received / total : -1, received);
|
||||
}
|
||||
await sink.flush();
|
||||
await sink.close();
|
||||
sink = null;
|
||||
} finally {
|
||||
if (sink != null) {
|
||||
try {
|
||||
await sink.close();
|
||||
} catch (_) {}
|
||||
}
|
||||
client.close(force: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
/// 应用版本号(与 `pubspec.yaml` 的 version 保持一致)。
|
||||
///
|
||||
/// 应用内更新检查用它判断服务器发布的版本是否更新;
|
||||
/// **每次发版必须与 pubspec 同步更新**(见 BUILD-NOTES 的发布流程)。
|
||||
const String kAppVersion = '1.2.0';
|
||||
+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.1.0+11
|
||||
version: 1.2.0+12
|
||||
|
||||
environment:
|
||||
sdk: ^3.13.3
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# V1.2.0 更新内容
|
||||
|
||||
## 新增:应用内更新
|
||||
|
||||
- 工具栏新增「检查更新」按钮,启动后自动静默检查服务器版本
|
||||
- 检测到新版本时按钮出现**红色角标**,点击即可查看更新说明并一键更新
|
||||
- 安卓:下载新版本 APK 后直接拉起系统安装器(签名一致,可直接覆盖安装)
|
||||
- Windows:下载绿色版整包后自动覆盖并重启,无需安装
|
||||
- 没有检测到新版本(或安装包)时,会明确提示「当前已是最新版本」
|
||||
|
||||
## AI 自然语言生成强化
|
||||
|
||||
- **流式输出**:生成过程实时显示已用时、思考与输出字数,可随时取消
|
||||
- **超时保护**:长时间无响应自动中断并给出提示
|
||||
- **增量修改**:新增「修改当前工程」模式——在现有时序图上增删改,不再只能整图重画
|
||||
- **自动纠错**:模型输出格式有误时自动修复重试;结果自动清洗(非法时长、无效依赖、层号归一化)
|
||||
- **分层优化**:按并行资源智能分层,避免层数爆炸
|
||||
|
||||
## 交互与界面
|
||||
|
||||
- 条形 / 圆周视图的编辑工具栏统一为 7 个按钮(添加 / 编辑 / 复制 / 删除 / 层+ / 层− / 对齐),
|
||||
按钮缩小到 60%,条形在左下角、圆周在右上角,不再遮挡预览
|
||||
- 右下角预览卡缩小,减少对画布的遮挡
|
||||
- **换泳道更顺畅**:拖拽动作到其它泳道不再回弹,可同时前后滑移
|
||||
- **手写笔兼容改善**:拖拽端点改时长更稳定,精确点在把手上也能直接拖拽
|
||||
- 依赖标签(FS / SS 等)字号缩小、自动避让排布,不再相互压盖;去掉五角星标记
|
||||
|
||||
## 修复
|
||||
|
||||
- 修复应用图标:圆环缺口方向修正到正上方(与软件内标志一致),并消除缺口内的残留细线
|
||||
- 版本信息统一为「时序图设计」V1.2.0
|
||||
@@ -0,0 +1,82 @@
|
||||
# ============================================================
|
||||
# 发布新版本到 Gitea Releases(更新说明 + 安装包附件)
|
||||
#
|
||||
# 用法(在仓库根目录或任意位置):
|
||||
# powershell -File scripts\publish_release.ps1 -Version 1.2.1 `
|
||||
# -NotesFile release\RELEASE_NOTES_v1.2.1.md
|
||||
#
|
||||
# 说明:
|
||||
# - 更新说明写入 Release 正文(Markdown),客户端「检查更新」时读取展示;
|
||||
# - 安卓 APK:默认取 release\sequence_diagram_android_v<版本>_release.apk;
|
||||
# - Windows 绿色版:默认把 dist\ 打包为 zip 后上传(客户端下载后原地覆盖);
|
||||
# - 安装包作为 Release 附件保存,不进入 git 历史,仓库保持精简。
|
||||
# ============================================================
|
||||
param(
|
||||
[Parameter(Mandatory = $true)][string]$Version,
|
||||
[Parameter(Mandatory = $true)][string]$NotesFile,
|
||||
[string]$ApkPath = "",
|
||||
[string]$WindowsZipPath = "",
|
||||
[string]$Server = "http://124.220.63.9:30000",
|
||||
[string]$Owner = "admin",
|
||||
[string]$Repo = "Sequence-Diagram",
|
||||
[string]$Auth = "liuyu65@126.com:ds3317210"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$root = Split-Path -Parent $PSScriptRoot # 仓库根目录(scripts 的上一级)
|
||||
|
||||
# ---- 1) 定位安装包 ----
|
||||
if ($ApkPath -eq "") {
|
||||
$ApkPath = Join-Path $root "release\sequence_diagram_android_v${Version}_release.apk"
|
||||
}
|
||||
if (!(Test-Path $ApkPath)) {
|
||||
throw "找不到 APK:$ApkPath(先执行 flutter build apk --release 并归档到 release\)"
|
||||
}
|
||||
|
||||
if ($WindowsZipPath -eq "") {
|
||||
$WindowsZipPath = Join-Path $env:TEMP "sequence_diagram_windows_v${Version}.zip"
|
||||
}
|
||||
if (!(Test-Path $WindowsZipPath) -or (Get-Item $WindowsZipPath).Length -lt 1048576) {
|
||||
$dist = Join-Path $root "dist"
|
||||
if (!(Test-Path (Join-Path $dist "sequence_diagram.exe"))) {
|
||||
throw "找不到 dist\sequence_diagram.exe(先执行 flutter build windows --release 并同步到 dist\)"
|
||||
}
|
||||
Write-Host "打包 Windows 绿色版:$WindowsZipPath"
|
||||
if (Test-Path $WindowsZipPath) { Remove-Item $WindowsZipPath -Force }
|
||||
& tar.exe -a -cf $WindowsZipPath -C $dist .
|
||||
if ($LASTEXITCODE -ne 0) { throw "打包失败" }
|
||||
}
|
||||
|
||||
if (!(Test-Path $NotesFile)) { throw "找不到更新说明文件:$NotesFile" }
|
||||
$notes = [System.IO.File]::ReadAllText($NotesFile, [System.Text.Encoding]::UTF8)
|
||||
|
||||
# ---- 2) 创建 Release(正文 = 更新说明) ----
|
||||
$payload = @{
|
||||
tag_name = "v$Version"
|
||||
name = "v$Version"
|
||||
body = $notes
|
||||
draft = $false
|
||||
prerelease = $false
|
||||
} | ConvertTo-Json -Compress
|
||||
$tmp = Join-Path $env:TEMP "seq_release.json"
|
||||
[System.IO.File]::WriteAllText($tmp, $payload, (New-Object System.Text.UTF8Encoding($false)))
|
||||
Write-Host "创建 Release v$Version ..."
|
||||
$resp = curl.exe -s -X POST -H "Content-Type: application/json" --data-binary "@$tmp" -u $Auth "$Server/api/v1/repos/$Owner/$Repo/releases"
|
||||
$rel = $resp | ConvertFrom-Json
|
||||
if (-not $rel.id) { throw "创建 Release 失败:$resp" }
|
||||
Write-Host "Release id = $($rel.id)"
|
||||
|
||||
# ---- 3) 上传附件 ----
|
||||
function Upload-Asset([string]$path) {
|
||||
$name = Split-Path $path -Leaf
|
||||
Write-Host "上传附件:$name ..."
|
||||
$r = curl.exe -s -X POST -F "attachment=@$path" -u $Auth "$Server/api/v1/repos/$Owner/$Repo/releases/$($rel.id)/assets?name=$name"
|
||||
$asset = $r | ConvertFrom-Json
|
||||
if (-not $asset.name) { throw "上传失败:$r" }
|
||||
Write-Host " 完成:$($asset.browser_download_url)"
|
||||
}
|
||||
Upload-Asset $ApkPath
|
||||
Upload-Asset $WindowsZipPath
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "发布完成!客户端下次启动即可检查到 v$Version($Server/$Owner/$Repo/releases)"
|
||||
@@ -0,0 +1,36 @@
|
||||
// 版本号比较测试:应用内更新用它判断服务器版本是否比本机新。
|
||||
//
|
||||
// 运行:flutter test test\update_version_test.dart
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:sequence_diagram/update/update_service.dart';
|
||||
|
||||
void main() {
|
||||
group('isNewerVersion', () {
|
||||
test('基本递增判定', () {
|
||||
expect(isNewerVersion('1.2.1', '1.2.0'), isTrue);
|
||||
expect(isNewerVersion('1.3.0', '1.2.9'), isTrue);
|
||||
expect(isNewerVersion('2.0.0', '1.9.9'), isTrue);
|
||||
expect(isNewerVersion('1.2.0', '1.2.0'), isFalse);
|
||||
expect(isNewerVersion('1.1.9', '1.2.0'), isFalse);
|
||||
});
|
||||
|
||||
test('容忍 v 前缀与后缀', () {
|
||||
expect(isNewerVersion('v1.2.1', '1.2.0'), isTrue);
|
||||
expect(isNewerVersion('V1.2.1', '1.2.0'), isTrue);
|
||||
expect(isNewerVersion('v1.2.1-rc1', '1.2.0'), isTrue);
|
||||
expect(isNewerVersion('1.2.0+5', '1.2.0'), isFalse);
|
||||
});
|
||||
|
||||
test('段数不一致时按缺省 0 处理', () {
|
||||
expect(isNewerVersion('1.2', '1.2.0'), isFalse);
|
||||
expect(isNewerVersion('1.2.1', '1.2'), isTrue);
|
||||
expect(isNewerVersion('1.0.0.1', '1.0.0'), isTrue);
|
||||
});
|
||||
|
||||
test('非法内容按 0 处理,不抛异常', () {
|
||||
expect(isNewerVersion('', '1.0.0'), isFalse);
|
||||
expect(isNewerVersion('abc', '1.0.0'), isFalse);
|
||||
expect(isNewerVersion('1.x.0', '1.0.0'), isFalse);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user