Files
youle_app_ios_v2/ylgamehall/Source/Bridge/Handlers/AccreditLoginHandler.swift
T
joywayerandClaude Opus 4.7 aa80aec18c 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>
2026-06-22 19:19:23 +08:00

32 lines
1.2 KiB
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.
//
// 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 大写 P、city 经 danbian: 去单引号
//
import Foundation
public enum AccreditLoginHandler {
public static func register(on bridge: any BridgeProtocol) {
// 【1】accreditlogin
// 入参忽略;cb: "Response from accreditlogin"
// 完整实现需触发 sharelogin 反向 callbackPhase 4.B
bridge.register("accreditlogin") { _, callback in
callback?(.string("Response from accreditlogin"))
}
}
}