Files
youle_app_ios_v2/ylgamehall/Source/Bridge/Handlers/SwitchOverGameHandler.swift
T
joywayerandClaude Opus 4.7 68cf7140d7 Phase 6/7 stub:SwitchOverGameData + OpenurlTitleData
补齐 H5 桥 §3.1 [15][17]两个 stub handler,让 H5 调子游戏切换 / 弹层
入口时不再报 "no handler registered",避免业务流程卡住。完整流程留
Phase 6 / Phase 7 实施。

新增:
  - Source/Bridge/Handlers/SwitchOverGameHandler.swift §3.1 [17]stub
    cb "SwitchOverGameData"(驼峰首字母大写沿用 msext 字面)
    完整实现需 AppCoordinator + SubGameViewController + SubGameDownloader
    (Phase 6.4 落地)
  - Source/Bridge/Handlers/OpenurlTitleDataHandler.swift §3.1 [15]stub
    cb "OpenurlTitleData"
    完整实现需 OverlayViewController + window.settings polyfill + 3s 节流
    (Phase 7 落地);注意契约硬约束 "title " 末尾空格已在注释提示

WebContainer.registerBridgeHandlers 接入。

至此 H5 桥 §3.1 大厅可调的全部 16 项 handler(除 backgameData / createRoom
等子游戏专属 §H 4 项)都已注册(含完整实现 / stub 两种状态),
H5 启动 / 业务期任何 handler 调用都不会报 "no handler"。

BuildProject 通过

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-22 20:14:31 +08:00

27 lines
972 B
Swift
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// SwitchOverGameHandler.swift
// ylgamehall
//
// H5 → Native handler stubSwitchOverGameData — 切换到子游戏
// 契约:docs/H5-Native-Contract.md §3.1 17
//
// Phase 6.4 完整实现需要 AppCoordinator + SubGameViewController +
// SubGameDownloader(子游戏 zip 下载解压)。当前为 stub(仅 cb 维持契约),
// 让 H5 调时不报 "no handler",避免业务流程卡住。
//
import Foundation
public enum SwitchOverGameHandler {
public static func register(on bridge: any BridgeProtocol) {
// 【17】SwitchOverGameData
// 入参 type / Gamedirectory / gamedownloadurl / data
// cb: "SwitchOverGameData"(驼峰首字母大写,沿用 msext 字面)
// 完整实现需 push SubGameViewController + zip 下载解压 + 加载子游戏 H5
bridge.register("SwitchOverGameData") { _, callback in
callback?(.string("SwitchOverGameData"))
}
}
}