Phase 6 commit B:SubGameDownloader zip 下载 + 解压

- 新增 Source/Resource/SubGameDownloader.swift(actor):URLSession + ZIPFoundation,
  缓存命中直接复用(看 {Caches}/{gameDir}/{gameStart}/index.html 是否存在),
  未命中下载 → staging 解压 → 原子 rename(与 LobbyZipUpgrader 同思路;
  msext gameController.m:1340-1401 等价,以 staging 替代 msext 直接覆盖避免半残留)
- SubGameViewController.runBootPipelineSteps:接入 ensureReady,splash 实时更新下载进度,
  移除 commit A 占位的 SubGameBootError
- DownloadProgressDelegate 与 LobbyZipUpgrader 同款就地复制(两处用不抽公共,
  三处出现时再合并)
- Plan §5.6.7 / §8 进度已勾选

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
joywayer
2026-06-22 21:01:53 +08:00
co-authored by Claude Opus 4.7
parent 7a5644053d
commit a9eaf86c63
3 changed files with 178 additions and 27 deletions
+8 -5
View File
@@ -594,9 +594,12 @@ Contract Design Plan(本文档)
- [x] **SceneDelegate**:以 `UINavigationController` 承载大厅,`AppCoordinator.shared.navigationController` 持引;导航栏隐藏 + 禁用边缘 pop 手势
- [ ] **6.5** `backgameData` handler(仅子游戏注册):停 audio → 发 `.subGameDidReturn` 通知 → coordinator.popSubGame
- [ ] **6.6** 大厅监听 `.subGameDidReturn``bridge.call("getWebdata", data)`
- [ ] **6.7** 子游戏 zip 下载 / 解压(H5 端通过 SwitchOverGameData 传 `gamedownloadurl`
- `Source/Resource/SubGameDownloader.swift`URLSession + ZIPFoundation
- 缓存策略:`Library/Caches/{Gamedirectory}/` 已存在则跳过
- [x] **6.7** 子游戏 zip 下载 / 解压(H5 端通过 SwitchOverGameData 传 `gamedownloadurl`
- `Source/Resource/SubGameDownloader.swift`actor 单例,URLSession + ZIPFoundation
- 缓存策略:`{Caches}/{gameDir}/{gameStart}/index.html` 已存在 → `.alreadyExists` 直接复用;
未命中 → 下载 → staging 解压 → 原子 rename(与 LobbyZipUpgrader 同思路;
msext gameController.m:1340-1401 行为等价,本项目以 staging 替代 msext 直接覆盖避免半残留)
- SubGameViewController.runBootPipelineSteps 接入:splash 实时更新下载进度
#### 验收
@@ -920,12 +923,12 @@ H5 调 `OpenurlTitleData` 打开弹层 WebView,弹层内 H5 用 `window.settin
### Phase 6 子游戏
- [x] 6.1 AppCoordinator 栈深节流(2s + viewControllers.count < 2
- [x] 6.2 SubGameViewController 框架(commit A:H5 未安装则抛错,待 6.7 接入
- [x] 6.2 SubGameViewController 框架(commit B 接入 SubGameDownloader 后真实下载/缓存命中
- [ ] 6.3 SubGameHandlersbackgameData 留待 commit C
- [x] 6.4 SwitchOverGameData → AppCoordinator.showSubGame
- [ ] 6.5 backgameData
- [ ] 6.6 getWebdata 通知链
- [ ] 6.7 SubGameDownloader
- [x] 6.7 SubGameDownloaderactorURLSession + ZIPFoundation + staging + 原子 rename
### Phase 7 弹层
- [ ] 7.1 OverlayViewController + 私有 dataStore