feat(ota): OTA APK 下载更新模块

REQ-20260430-0041

新增 UpdateManager:
- POST newAppVersion/queryWatch 检查版本(5分钟最小间隔)
- OkHttp 下载 APK(进度回调,独立超时配置)
- FileProvider + Intent ACTION_VIEW 触发系统安装
- 非 .apk 链接自动跳过

新增 UpdateDialogView:
- 全屏覆盖弹窗,三种状态(发现新版本/下载中/下载失败)
- 进度条支持百分比和未知大小两种模式

配置变更:
- AndroidManifest: REQUEST_INSTALL_PACKAGES + FileProvider
- CommonApi.checkVersion: GET→POST,传 version 参数

集成点:
- HomeFragment.onResume → MainActivity.checkForUpdate()
- MainActivity 管理弹窗交互和下载流程
- 更新时停止蓝牙扫描 + 保持屏幕常亮

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dongliang
2026-04-30 21:20:06 +09:30
parent 76997f4830
commit 6e8b210f8e
9 changed files with 521 additions and 3 deletions

View File

@@ -33,4 +33,11 @@
android:layout_height="match_parent"
android:visibility="gone" />
<!-- Layer 4: OTA 更新弹窗(最顶层,全屏覆盖,默认隐藏) -->
<com.xiaoqu.watch.ui.widget.UpdateDialogView
android:id="@+id/updateDialog"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
</FrameLayout>