按用户约定调整 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>
39 lines
1.6 KiB
Swift
39 lines
1.6 KiB
Swift
//
|
||
// FriendsShareHandler.swift
|
||
// ylgamehall
|
||
//
|
||
// H5 → Native handler stub:friendsSharetypeUrlToptitleDescript — 分享
|
||
// 契约:docs/H5-Native-Contract.md §3.1 [2] + §3.2 [11]sharesuccess
|
||
//
|
||
// 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(暂未集成)
|
||
// - 否则 → WeChatShare(Phase 4.B SDK 接入)
|
||
// 3. 分享完成 → bridge.call("sharesuccess", { success: "2", type: <sharefriend 原值> })
|
||
//
|
||
// ⚠️ QQ 分享按用户约定**不依赖 SDK**,走 URL Scheme(mqq://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) {
|
||
// 【2】friendsSharetypeUrlToptitleDescript
|
||
// 入参:sharefriend / sharetype / type / url / title / description
|
||
// cb: "sharefriend"(msext 字面,沿用)
|
||
// 完整实现需触发 sharesuccess 反向 callback(Phase 4.B/4.C)
|
||
bridge.register("friendsSharetypeUrlToptitleDescript") { _, callback in
|
||
callback?(.string("sharefriend"))
|
||
}
|
||
}
|
||
}
|