Phase 1.14.d:WebContainerViewController(16:9 letterbox + Splash + 启动流水线)
新增 ylgamehall/Source/WebView/WebContainerViewController.swift:
- 持有 BridgedWebView(间接持 BridgeBus)+ 文件内私有 SplashOverlay
- 16:9 letterbox 布局:required(aspect 16:9 + width/height ≤ superview)
+ low(width/height = superview) + center{X,Y} 居中。屏幕比 < 16:9 → 上下
黑边,> 16:9 → 左右黑边。Auto Layout 自动选短边贴边、长边居中
- SplashOverlay:SplashImage(scaleAspectFill) + UIProgressView + UILabel;
update(text:progress:) 切换状态机
- runBootPipeline 串:ensureReady → "拉取配置中..." → RemoteConfigClient.fetch
→ 分支(.shortText / .parsed → showmessage / IPA 升级 / LobbyZipUpgrader
with onProgress hop 到 MainActor) → "加载大厅..." → loadFileURL(lobbyIndex,
allowingReadAccessTo: lobbyRoot)
- 三种 alert:showBlockingAlert(短文本/showmessage,永停)/
showIPAUpgradeAlert(确定→openURL,永停)/ showFatalAlert(重试→重跑 pipeline)
- WKNavigationDelegate.didFinish 暂用 splash.isHidden = true(1.14.e 改为
0.3s 淡出动画)
- 横屏锁定 + statusBar 显示(与 RootViewController 一致)
不接 SceneDelegate,1.16 才换 rootViewController;本次仅落地容器代码。
BuildProject 通过
Plan 进度已勾选(§5 Phase 1.14.d + §8)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
f3c66b670d
commit
f247b81d6d
@@ -294,13 +294,15 @@ Contract Design Plan(本文档)
|
||||
- 文件内私有 `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 用高度撑满左右黑边
|
||||
- **Splash 状态层**:与 LaunchScreen 同款启动图 + UIProgressView + 状态文字标签("拼命启动中..." / "下载更新中 XX%" / "网络异常重试中")
|
||||
- `viewDidLoad` 内串:`ResourceUnzipper.ensureReady() → RemoteConfigClient.fetch → VersionResolver.resolve → LobbyZipUpgrader.upgradeIfNeeded(onProgress: 更新 UIProgressView) → loadFileURL(lobbyIndex)`
|
||||
- 无升级路径走快路(< 200 ms),有升级路径显示 progress UI
|
||||
- 实现 `webViewWebContentProcessDidTerminate:` 退避 reload(Design §3.6)
|
||||
- [x] **1.14.d** 实现 `Source/WebView/WebContainerViewController.swift`(基类)
|
||||
- 持有 `BridgedWebView`(通过其再持有 `BridgeBus`)+ 文件内私有 `SplashOverlay`
|
||||
- 16:9 letterbox:aspectRatio(16:9) + widthMax/heightMax required + widthFill/heightFill .defaultLow + centerXY 居中。屏幕比 < 16:9 → 上下黑边;> 16:9 → 左右黑边
|
||||
- **SplashOverlay**:UIImageView(SplashImage, scaleAspectFill) + UIProgressView + UILabel;`update(text:progress:)` 切换状态机
|
||||
- 启动流水线 `runBootPipeline()`:ensureReady → "拉取配置中..." → RemoteConfigClient.fetch → 分支(.shortText / .parsed → showmessage / IPA 升级 / LobbyZipUpgrader.upgradeIfNeeded with onProgress hop 到 MainActor)→ "加载大厅..." → `loadFileURL(SandboxPaths.lobbyIndex, allowingReadAccessTo: lobbyRoot)`
|
||||
- 终态弹窗:`showBlockingAlert`(短文本 / showmessage,永停)/ `showIPAUpgradeAlert`(确定 → openURL,永停)/ `showFatalAlert`(重试 → 重跑 pipeline)
|
||||
- 横屏锁定 + statusBar 显示,与契约 §4.2 一致
|
||||
- **暂不实现**:`webViewWebContentProcessDidTerminate:` 退避 reload(移到 Phase 3 网络层时一并处理)
|
||||
- BuildProject 通过
|
||||
- [ ] **1.14.e** WebView 加载完成后淡出 splash
|
||||
- `webView(_:didFinish:)` 内 `UIView.animate(duration: 0.3)` splash.alpha = 0 → `removeFromSuperview`
|
||||
- 期间 webView 已渲染好 H5 大厅,无白屏闪烁
|
||||
@@ -799,7 +801,7 @@ H5 调 `OpenurlTitleData` 打开弹层 WebView,弹层内 H5 用 `window.settin
|
||||
- [x] 1.14.a AppIcon 替换 Xcode 默认空模板(iPad / 1024 缺失留 Phase 10 polish)
|
||||
- [x] 1.14.b LaunchScreen 改启动图(SplashImage 全屏 scaleAspectFill,竖图横屏裁剪折衷)
|
||||
- [x] 1.14.c LobbyZipUpgrader 加 progress 回调(URLSessionDownloadDelegate,0.0…1.0)
|
||||
- [ ] 1.14.d WebContainerViewController(含 splash UI 状态层 + 16:9 letterbox + 启动流水线串接)
|
||||
- [x] 1.14.d WebContainerViewController(SplashOverlay + 16:9 letterbox + 启动流水线 + 三种 alert)
|
||||
- [ ] 1.14.e WebView didFinish 后淡出 splash
|
||||
- [ ] 1.15 VibratorHandler
|
||||
- [ ] 1.16 SceneDelegate → WebContainerViewController
|
||||
|
||||
Reference in New Issue
Block a user