Commit 264fd5ef authored by Steven杜宇's avatar Steven杜宇

// 一键登录

parent 1c7ecce8
...@@ -22,8 +22,11 @@ extension YHLoginMethodManager { ...@@ -22,8 +22,11 @@ extension YHLoginMethodManager {
if !support { if !support {
YHHUD.flash(message: "不支持一键登录") YHHUD.flash(message: "不支持一键登录")
// 跳转APP自定义登录界面 // 跳转APP自定义登录界面
let vc = YHOtherLoginViewController()
UIViewController.current?.navigationController?.pushViewController(vc, animated:true)
return return
} }
// 支持一键登录
YHLoginMethodManager.shared.enterAutoLoginPage() YHLoginMethodManager.shared.enterAutoLoginPage()
} }
} }
...@@ -80,30 +83,7 @@ extension YHLoginMethodManager { ...@@ -80,30 +83,7 @@ extension YHLoginMethodManager {
return return
} }
if code == PNSCodeLoginControllerPresentSuccess { if code == PNSCodeSuccess {
printLog("弹起授权页成功")
} else if code == PNSCodeLoginControllerClickCancel {
printLog("点击了授权页的返回")
} else if code == PNSCodeLoginControllerClickChangeBtn {
printLog("点击切换其他登录方式按钮")
} else if code == PNSCodeLoginControllerClickLoginBtn {
if let isChecked = dict["isChecked"] as? Bool, isChecked == true {
printLog("点击了登录按钮,check box选中,SDK内部接着会去获取登录Token")
} else {
printLog("点击了登录按钮,check box未选中,SDK内部不会去获取登录Token")
}
} else if code == PNSCodeLoginControllerClickCheckBoxBtn {
printLog("点击了check box")
} else if code == PNSCodeLoginControllerClickProtocol {
printLog("点击了协议富文本")
} else if code == PNSCodeSuccess {
// 点击登录按钮获取登录Token成功回调 // 点击登录按钮获取登录Token成功回调
let token = dict["token"] as? String let token = dict["token"] as? String
...@@ -127,6 +107,34 @@ extension YHLoginMethodManager { ...@@ -127,6 +107,34 @@ extension YHLoginMethodManager {
*/ */
return
}
// 以下是处理一键登录异常
if code == PNSCodeLoginControllerPresentSuccess {
printLog("弹起授权页成功")
} else if code == PNSCodeLoginControllerClickCancel {
printLog("点击了授权页的返回")
} else if code == PNSCodeLoginControllerClickChangeBtn {
printLog("点击切换其他登录方式按钮")
} else if code == PNSCodeLoginControllerClickLoginBtn {
if let isChecked = dict["isChecked"] as? Bool, isChecked == true {
printLog("点击了登录按钮,check box选中,SDK内部接着会去获取登录Token")
} else {
printLog("点击了登录按钮,check box未选中,SDK内部不会去获取登录Token")
}
} else if code == PNSCodeLoginControllerClickCheckBoxBtn {
printLog("点击了check box")
} else if code == PNSCodeLoginControllerClickProtocol {
printLog("点击了协议富文本")
} else { } else {
printLog("获取登录Token失败") printLog("获取登录Token失败")
} }
...@@ -193,10 +201,9 @@ extension YHLoginMethodManager { ...@@ -193,10 +201,9 @@ extension YHLoginMethodManager {
videoBgView.closeBlock = { videoBgView.closeBlock = {
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
} }
// 改变登录方式
videoBgView.changeLoginBlock = { videoBgView.changeLoginBlock = {
// let vc = UINavigationController(rootVC: YHPhoneLoginWithVideoBkgViewController()) let vc = YHOtherLoginViewController()
let vc = YHPhoneLoginWithVideoBkgViewController()
// vc.modalPresentationStyle = .custom
UIViewController.current?.navigationController?.pushViewController(vc, animated:true) UIViewController.current?.navigationController?.pushViewController(vc, animated:true)
} }
model.customViewBlock = { model.customViewBlock = {
......
...@@ -319,8 +319,10 @@ class YHOtherLoginViewController: YHBaseViewController { ...@@ -319,8 +319,10 @@ class YHOtherLoginViewController: YHBaseViewController {
@objc func appleLogin() { @objc func appleLogin() {
//第一次appid登录跳转逻辑 //第一次appid登录跳转逻辑
let vc = YHOtherLoginViewController() // let vc = YHOtherLoginViewController()
vc.type = .apple // vc.type = .apple
navigationController?.pushViewController(vc) // navigationController?.pushViewController(vc)
YHAppleLoginManager.shared.appleLogin()
} }
} }
...@@ -99,7 +99,8 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget { ...@@ -99,7 +99,8 @@ class YHMyViewController: YHBaseViewController, ConstraintRelatableTarget {
view.avatarClickBlock = { view.avatarClickBlock = {
[weak self] in [weak self] in
guard let self = self else { return } guard let self = self else { return }
if !checkLogin() { return } // if !checkLogin() { return }
YHLoginMethodManager.shared.autoLogin()
} }
view.nickNameClickBlock = { view.nickNameClickBlock = {
[weak self] in [weak self] in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment