Phase 4.A:登录+分享 stub + QQ 改走 URL Scheme 不依 SDK

按用户约定调整 Phase 4 方向:微信继续走 SDK(等项目方提供),QQ 分享
改用 URL Scheme 直接调起 QQ app,**不依赖 SDK**。

调研 daoqi/msext/Class/Utils/QQShareManager.m 发现已有完整的 URL Scheme
fallback 路径:
  - line 14: __has_include(<TencentOpenAPI/QQApiInterface.h>) 条件编译
  - line 231 注释: "Fallback: 使用 URL Scheme (mqqapi://) - 无需 SDK,
    直接调起 (Legacy)"
  - mqqapi://share/to_fri / mqqapi://share/to_qzone / mqqopensdkfriend://share
    等 schema 实现见 line 733/786/789

新增 handler stub(让 H5 启动 / 业务期调登录 / 分享不报 "no handler"):
  - Source/Bridge/Handlers/AccreditLoginHandler.swift
    accreditlogin cb "Response from accreditlogin"
    完整实现需 Phase 4.B 微信 SDK + WeChatManager.authorize() + WeChatAuth.exchangeForUser
    + bridge.call("sharelogin", 7 字段含大写 Province) 反向 callback
  - Source/Bridge/Handlers/FriendsShareHandler.swift
    friendsSharetypeUrlToptitleDescript cb "sharefriend"
    完整实现需 ShareCenter 策略分发 + sharesuccess 反向 callback

WebContainer.registerBridgeHandlers 接入。

文档调整:
  - Plan §2.3 阻塞表:QQ OpenSDK 标"不需要",改 URL Scheme 路径
  - Plan §5 Phase 4 前置:去掉 QQ OpenSDK 一行
  - Plan §5 Phase 4.2:完整改写为 URL Scheme 方案,含 LSApplicationQueriesSchemes
    清单 + URL 构造样例 + "调起即 success" 乐观策略说明
  - Plan §8 进度追踪:4.2 QQ SDK Vendor 标"不需要"
  - Plan §6.4 里程碑加 3 行(前两轮 commit hash 补 + 本次)
  - CLAUDE.md 依赖管理段加 "不接入 QQ SDK" 约定(与"不引入 CocoaPods"
    并列的负面清单)
  - Verification-Checklist Phase 4 章节:E.19/E.20 stub + K/L 待 4.B/4.C
    完整后填充验证项

BuildProject 通过

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
joywayer
2026-06-22 19:19:23 +08:00
co-authored by Claude Opus 4.7
parent 0602b9d4b6
commit aa80aec18c
6 changed files with 108 additions and 11 deletions
@@ -0,0 +1,31 @@
//
// AccreditLoginHandler.swift
// ylgamehall
//
// H5 Native handler stubaccreditlogin
// docs/H5-Native-Contract.md §3.1 1 + §3.2 10sharelogin
//
// Phase 4.A stub cb Phase 4.B SDK + AppID +
// Universal Links + /wechat/login fallback
//
// Phase 4.B
// 1. WeChatManager.shared.authorize() WXAuthCodestate UUID
// 2. WeChatAuth.exchangeForUser(code:) /wechat/login
// sns/oauth2/access_token + sns/userinfo
// 3. bridge.call("sharelogin", data: 7 ) callback
// 1:1 Province Pcity danbian:
//
import Foundation
public enum AccreditLoginHandler {
public static func register(on bridge: any BridgeProtocol) {
// 1accreditlogin
// cb: "Response from accreditlogin"
// sharelogin callbackPhase 4.B
bridge.register("accreditlogin") { _, callback in
callback?(.string("Response from accreditlogin"))
}
}
}
@@ -0,0 +1,38 @@
//
// FriendsShareHandler.swift
// ylgamehall
//
// H5 Native handler stubfriendsSharetypeUrlToptitleDescript
// docs/H5-Native-Contract.md §3.1 2 + §3.2 11sharesuccess
//
// Phase 4.A stub cb Phase 4.B SDK + Phase 4.C
// QQ URL Scheme
//
//
// 1. sharefriend (1= / 2=) + sharetype (1= / 2= /
// 3= §3.1 2) + type (1= / 2= / 3=) + url +
// title + description
// 2. ShareCenter.dispatch(req)
// - sharetype = 3 NoopSharePlatform
// - WeChatSharePhase 4.B SDK
// 3. bridge.call("sharesuccess", { success: "2", type: <sharefriend > })
//
// QQ ** SDK** URL Schememqq://share/to_fri
// mqqapi://share/to_qzone daoqi/msext QQShareManager.m fallback
// Phase 4.C
//
import Foundation
public enum FriendsShareHandler {
public static func register(on bridge: any BridgeProtocol) {
// 2friendsSharetypeUrlToptitleDescript
// sharefriend / sharetype / type / url / title / description
// cb: "sharefriend"msext 沿
// sharesuccess callbackPhase 4.B/4.C
bridge.register("friendsSharetypeUrlToptitleDescript") { _, callback in
callback?(.string("sharefriend"))
}
}
}
@@ -71,6 +71,10 @@ public final class WebContainerViewController: UIViewController {
// Phase 3.A + 3.C/3.D stub
LocalAudioHandler.register(on: bridge) // §3.1 3srcIsloop
RemoteAudioHandler.register(on: bridge) // §3.1 45Phase 3.B/3.C/3.D stub
// Phase 4.A + stubPhase 4.B SDK / Phase 4.C QQ URL Scheme
AccreditLoginHandler.register(on: bridge) // §3.1 1Phase 4.B
FriendsShareHandler.register(on: bridge) // §3.1 2Phase 4.B/4.C
}
// MARK: -