chore: release client-v1.1.12
Deploy Client / build-client-web (push) Successful in 5m19s
Deploy Client / build-macos (push) Successful in 7m36s
Deploy Client / build-android (push) Successful in 6m18s
Deploy Client / build-ios (push) Successful in 6m2s
Deploy Client / build-windows (push) Successful in 5m27s
Deploy Client / release-deploy-client (push) Successful in 10m49s

价签标签两栏布局改版 + 生产日期修复 + 模板预览接真实渲染 +
Windows/macOS 应用内更新进度条修复。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Bupi8Kdqkfx2N5acFsHTx5
This commit is contained in:
wangjia
2026-08-27 17:52:03 +08:00
parent eb7b0edc96
commit c3a127485f
11 changed files with 492 additions and 246 deletions
+12 -3
View File
@@ -26,13 +26,22 @@ Future<void> downloadAndInstall(
String url, void Function(double) onProgress) async {
final tmp = await getTemporaryDirectory();
final dio = Dio();
// 关键:显式拒绝 gzipAccept-Encoding: identity)。
// nginx 会对 application/octet-stream(.exe) 做即时 gzip,压缩响应走 chunked 传输、
// 不带 Content-Length,导致 onReceiveProgress 的 total 恒为 -1、进度卡在 0
//macOS 的 .zip 属 application/zip 不被 gzip,故一直正常)。
// identity 让服务端回传原始字节 + Content-Lengthtotal 才有效。
final dlOpts =
Options(headers: {HttpHeaders.acceptEncodingHeader: 'identity'});
void prog(int r, int t) {
if (t > 0) onProgress(r / t);
if (t > 0) onProgress((r / t).clamp(0.0, 1.0));
}
if (Platform.isWindows) {
final exe = '${tmp.path}\\jiu-update-setup.exe';
await dio.download(url, exe, onReceiveProgress: prog);
await dio.download(url, exe, onReceiveProgress: prog, options: dlOpts);
// 启动 Inno Setup 安装包后退出本应用,让其覆盖安装。
await Process.start(exe, const [], mode: ProcessStartMode.detached);
await Future<void>.delayed(AppConstants.updaterStepDelay);
@@ -41,7 +50,7 @@ Future<void> downloadAndInstall(
if (Platform.isMacOS) {
final zip = '${tmp.path}/jiu-update.zip';
await dio.download(url, zip, onReceiveProgress: prog);
await dio.download(url, zip, onReceiveProgress: prog, options: dlOpts);
final extractDir = '${tmp.path}/jiu-update';
await Process.run('/bin/rm', ['-rf', extractDir]);