微信授权链路诊断 print 清理
授权链路已跑通(commit 625f504),撤掉 a060f29 加的临时诊断 print
+ 本次 shim 的 install 成功日志。AccreditLoginHandler / WeChatManager /
WXOpenURLShim 三处共 13 行 print 一次性清干净,行为不变。
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
625f504b85
commit
053232ed26
@@ -21,14 +21,12 @@ public enum AccreditLoginHandler {
|
||||
|
||||
public static func register(on bridge: any BridgeProtocol) {
|
||||
bridge.register("accreditlogin") { _, callback in
|
||||
print("[Bridge] accreditlogin H5 调用命中 ✅")
|
||||
callback?(.string("Response from accreditlogin"))
|
||||
|
||||
// 拉起微信授权 → 拿 7 字段 → 反向 callback sharelogin
|
||||
Task { @MainActor in
|
||||
do {
|
||||
let user = try await WeChatAuth.authorize()
|
||||
print("[Bridge] accreditlogin 拿到 user,发 sharelogin 反向 callback")
|
||||
bridge.call("sharelogin", data: .object([
|
||||
// 字段名严格 1:1 contract §3.2 表 [10] / msext NewRootVC.m:2428
|
||||
"openid": .string(user.openid),
|
||||
@@ -40,10 +38,8 @@ public enum AccreditLoginHandler {
|
||||
"unionid": .string(user.unionid)
|
||||
]), callback: nil)
|
||||
} catch WeChatAuthError.userCancelled {
|
||||
print("[Bridge] accreditlogin 用户取消授权(errCode -2)")
|
||||
// msext 行为:用户取消不弹 alert、不触发 sharelogin
|
||||
} catch {
|
||||
print("[Bridge] accreditlogin 失败:\(error)")
|
||||
// 其它失败也吞下(msext 同款乐观策略:不反向通知 H5)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user