Phase 1.14.c:LobbyZipUpgrader 加 0…1 progress 回调

- upgradeIfNeeded 新增 onProgress: @escaping @Sendable (Double) -> Void 参数,
  默认 no-op 兼容仅做版本对比的烟雾测试
- 新增文件内私有 DownloadProgressDelegate(URLSessionDownloadDelegate
  + @unchecked Sendable),在 didWriteData 回调里把 totalBytesWritten /
  totalBytesExpectedToWrite 换算成 0…1 上报,clamp 到 [0,1]
- 通过 session.download(from:delegate:) 注入;下载完成后兜底报 1.0
  (部分 server 不发 Content-Length 或末尾片段晚到,避免进度条停在 99%)
- RootViewController 烟雾测试用 ProgressTicker 把回调节流到 10% 阶梯打印,
  避免几百行刷屏(NSLock 保护单 Int 状态,@unchecked Sendable)
- BuildProject 通过

Plan 进度已勾选(§5 Phase 1.14.c + §8)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
joywayer
2026-06-22 02:46:11 +08:00
co-authored by Claude Opus 4.7
parent ba34854133
commit f3c66b670d
3 changed files with 86 additions and 10 deletions
+6 -4
View File
@@ -289,9 +289,11 @@ Contract Design Plan(本文档)
- [x] **1.14.a** AppIcon:从 `docs/res/Images.xcassets/AppIcon-1.appiconset` 拷贝 9 个 png + Contents.json 到 `ylgamehall/Assets.xcassets/AppIcon.appiconset`,替换 Xcode 默认空模板。已实测 BuildProject 通过。actool 3 个 warningiPad 76 / 83.5 / 1024 缺失)暂不处理,iPad 会自动用 iPhone 缩放,1024 是 App Store 上架要求(企业签不强制);待 Phase 10 上线前 polish 时补齐
- [x] **1.14.b** LaunchScreen:把 `docs/res/Res/Default-568h@2x~iphone.png` 拷到 `ylgamehall/Assets.xcassets/SplashImage.imageset`universal idiom,仅 @2x 物理文件 29708 字节 640×1136 竖图);改写 `LaunchScreen.storyboard` 为单一 UIImageView 全屏铺满(contentMode = .scaleAspectFill,背景 .black,四边约束到 superview)。注:竖图在横屏设备上会被 aspectFill 裁剪上下,启动只显示 0.x s 接受此折衷,Phase 10 polish 时再考虑出一张专门的横屏素材。BuildProject 通过
- [ ] **1.14.c** `LobbyZipUpgrader` 加 progress 回调
- `upgradeIfNeeded(resolved:onProgress:) async throws -> Outcome``onProgress: @Sendable (Double) -> Void` 报告 0.0…1.0
- `URLSession.download``URLSessionTaskDelegate.urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)` 上报
- [x] **1.14.c** `LobbyZipUpgrader` 加 progress 回调
- `upgradeIfNeeded(resolved:onProgress:) async throws -> Outcome``onProgress: @escaping @Sendable (Double) -> Void` 默认 no-op 报告 0.0…1.0
- 文件内私有 `DownloadProgressDelegate: URLSessionDownloadDelegate, @unchecked Sendable`,实现 `didWriteData:totalBytesWritten:totalBytesExpectedToWrite:`;通过 `session.download(from:delegate:)` 注入
- 完成时兜底报 1.0(部分 server 不发 Content-Length 或末尾片段晚到,避免进度条停在 99%)
- RootViewController 烟雾测试用 `ProgressTicker` 节流到 10% 阶梯打印;BuildProject 通过
- [ ] **1.14.d** 实现 `Source/WebView/WebContainerViewController.swift`(基类)
- 持有 `BridgedWebView` + `BridgeBus`
- 16:9 比例布局:屏幕比 < 16:9 用宽度撑满上下黑边;屏幕比 > 16:9 用高度撑满左右黑边
@@ -796,7 +798,7 @@ H5 调 `OpenurlTitleData` 打开弹层 WebView,弹层内 H5 用 `window.settin
- [x] 1.13 LobbyZipUpgraderactor,原子 rename 升级;端到端实测 260→261)
- [x] 1.14.a AppIcon 替换 Xcode 默认空模板(iPad / 1024 缺失留 Phase 10 polish
- [x] 1.14.b LaunchScreen 改启动图(SplashImage 全屏 scaleAspectFill,竖图横屏裁剪折衷)
- [ ] 1.14.c LobbyZipUpgrader 加 progress 回调
- [x] 1.14.c LobbyZipUpgrader 加 progress 回调URLSessionDownloadDelegate0.0…1.0
- [ ] 1.14.d WebContainerViewController(含 splash UI 状态层 + 16:9 letterbox + 启动流水线串接)
- [ ] 1.14.e WebView didFinish 后淡出 splash
- [ ] 1.15 VibratorHandler