feat(client/update): 启动自动检查 + App 内下载安装(不走浏览器)
Deploy Client / build-windows (push) Successful in 2m2s
Deploy Client / build-android (push) Successful in 2m13s
Deploy Client / build-macos (push) Successful in 3m45s
Deploy Client / build-ios (push) Successful in 3m58s
Deploy Client / release-deploy (push) Successful in 2m1s

参照 jiu 补齐,但比 jiu 多做了 Android 原生安装(jiu 的 App 内下载仅 Win/mac):
- 启动自动检查:update_provider 改 AsyncNotifier,build() 延迟 3s 首查 + 每小时
  轮询;home_shell watch 拉起、listen 弹更新框;_dismissed 防反复弹(轮询重置);
  强制更新走不可关闭弹窗。设置页「检查更新」改 forceCheck()。
- App 内下载(core/update/app_updater.dart,http 流式带进度框,不再 launchUrl):
  · Android:下 APK → open_filex 拉起系统安装器(+ REQUEST_INSTALL_PACKAGES)
  · Windows:下 exe → Process.start(detached) → exit(0) 覆盖安装
  · macOS :下 zip → open 解压 + 访达显示,提示手动拖入(带系统扩展不自动 swap)
  · iOS   :降级外链(TestFlight/App Store)
  失败降级浏览器下载。新增 6 语更新进度/失败/提示文案。
- 依赖 open_filex;flutter analyze 仅 2 个既有 withOpacity info。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
This commit is contained in:
wangjia
2026-07-07 17:09:29 +08:00
parent 617b43083d
commit c723bdd53e
8 changed files with 438 additions and 30 deletions
+108
View File
@@ -200,6 +200,114 @@ extension AppLangMisc on AppLang {
return 'hace $days d';
}
}
/// 更新下载进度:「正在下载 X%」。
String updateDownloadingPercent(int pct) {
switch (this) {
case AppLang.zh:
return '正在下载 $pct%';
case AppLang.en:
return 'Downloading $pct%';
case AppLang.ja:
return 'ダウンロード中 $pct%';
case AppLang.ko:
return '다운로드 중 $pct%';
case AppLang.ru:
return 'Загрузка $pct%';
case AppLang.es:
return 'Descargando $pct%';
}
}
/// 下载完成、正在安装。
String get updateInstalling {
switch (this) {
case AppLang.zh:
return '下载完成,正在安装…';
case AppLang.en:
return 'Downloaded, installing…';
case AppLang.ja:
return 'ダウンロード完了、インストール中…';
case AppLang.ko:
return '다운로드 완료, 설치 중…';
case AppLang.ru:
return 'Загружено, установка…';
case AppLang.es:
return 'Descargado, instalando…';
}
}
/// 下载失败。
String get updateDownloadFailed {
switch (this) {
case AppLang.zh:
return '下载失败,请重试或改用浏览器下载。';
case AppLang.en:
return 'Download failed. Retry or download in your browser.';
case AppLang.ja:
return 'ダウンロードに失敗しました。再試行するかブラウザでダウンロードしてください。';
case AppLang.ko:
return '다운로드에 실패했습니다. 다시 시도하거나 브라우저로 다운로드하세요.';
case AppLang.ru:
return 'Не удалось загрузить. Повторите или скачайте в браузере.';
case AppLang.es:
return 'Error de descarga. Reintenta o descarga en el navegador.';
}
}
/// macOS:已下载,提示手动拖入应用程序。
String get updateMacReveal {
switch (this) {
case AppLang.zh:
return '已下载并解压。请在访达中将 Pangolin 拖入「应用程序」文件夹替换旧版,然后重新打开。';
case AppLang.en:
return 'Downloaded and extracted. In Finder, drag Pangolin into your Applications folder to replace the old version, then reopen.';
case AppLang.ja:
return 'ダウンロードと展開が完了しました。Finder で Pangolin を「アプリケーション」フォルダにドラッグして置き換え、再度開いてください。';
case AppLang.ko:
return '다운로드 및 압축 해제 완료. Finder에서 Pangolin을 「응용 프로그램」 폴더로 드래그해 이전 버전을 교체한 뒤 다시 여세요.';
case AppLang.ru:
return 'Загружено и распаковано. В Finder перетащите Pangolin в папку «Программы», заменив старую версию, затем откройте заново.';
case AppLang.es:
return 'Descargado y extraído. En Finder, arrastra Pangolin a tu carpeta de Aplicaciones para reemplazar la versión anterior y vuelve a abrir.';
}
}
/// 失败对话框:改用浏览器下载。
String get updateOpenBrowser {
switch (this) {
case AppLang.zh:
return '浏览器下载';
case AppLang.en:
return 'Open in browser';
case AppLang.ja:
return 'ブラウザで開く';
case AppLang.ko:
return '브라우저에서 열기';
case AppLang.ru:
return 'Открыть в браузере';
case AppLang.es:
return 'Abrir en el navegador';
}
}
/// 通用「取消」。
String get updateCancelBtn {
switch (this) {
case AppLang.zh:
return '取消';
case AppLang.en:
return 'Cancel';
case AppLang.ja:
return 'キャンセル';
case AppLang.ko:
return '취소';
case AppLang.ru:
return 'Отмена';
case AppLang.es:
return 'Cancelar';
}
}
}
/// 全部界面文案的抽象契约。zh / en 各实现一份。