Commit 5c18623b authored by pete谢兆麟's avatar pete谢兆麟

增加隐私协议弹窗前置

parent 7e714463
...@@ -326,76 +326,115 @@ class YHOtherLoginViewController: YHBaseViewController { ...@@ -326,76 +326,115 @@ class YHOtherLoginViewController: YHBaseViewController {
} }
@objc func wechatLogin() { @objc func wechatLogin() {
let login = YHShareManager.shared if privacyView.isAgree {
login.sendLogin() let login = YHShareManager.shared
login.success = { [weak self] unionId in login.sendLogin()
guard let self = self else { return } login.success = { [weak self] unionId in
self.viewModel.wxlogin(unionId: unionId, phone: "", code: "") {[weak self] success, error in
guard let self = self else { return } guard let self = self else { return }
if success { self.viewModel.wxlogin(unionId: unionId, phone: "", code: "") {[weak self] success, error in
YHLoginManager.shared.loginSuccessActionBlock?() guard let self = self else { return }
YHHUD.flash(message: "登录成功") if success {
self.dismiss(animated: true) YHLoginManager.shared.loginSuccessActionBlock?()
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) YHHUD.flash(message: "登录成功")
self.navigationController?.popToRootViewController(animated: true) self.dismiss(animated: true)
} else { TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
if error?.errorCode == 30001 { self.navigationController?.popToRootViewController(animated: true)
//第一次微信登录跳转逻辑
let vc = YHOtherLoginViewController()
vc.type = .wechat
vc.token = unionId
navigationController?.pushViewController(vc)
} else { } else {
YHHUD.flash(message: error?.errorMsg ?? "") if error?.errorCode == 30001 {
//第一次微信登录跳转逻辑
let vc = YHOtherLoginViewController()
vc.type = .wechat
vc.token = unionId
navigationController?.pushViewController(vc)
} else {
YHHUD.flash(message: error?.errorMsg ?? "")
}
} }
} }
} }
} else {
let view = YHPrivacyAlertView(frame: view.bounds)
view.urlBlock = { [weak self] (type,url) in
guard let self = self else { return }
let vc = YHWebViewViewController()
vc.url = url
if type == 0 {
vc.navTitle = "银河港生活隐私政策"
} else if type == 1 {
vc.navTitle = "银河港生活用户条款"
}
self.navigationController?.pushViewController(vc)
}
view.agreeBlock = { [weak self] in
guard let self = self else { return }
self.privacyView.isAgree = true
self.wechatLogin()
}
self.view.addSubview(view)
} }
} }
@objc func appleLogin() { @objc func appleLogin() {
//第一次appid登录跳转逻辑 if privacyView.isAgree {
// let vc = YHOtherLoginViewController() YHAppleLoginManager.shared.success = {
// vc.type = .apple dict in
// navigationController?.pushViewController(vc)
YHAppleLoginManager.shared.success = {
dict in
YHHUD.flash(message: "登录中...")
self.appleLoginViewModel.appleLogin(params: dict) {
success, error in
YHHUD.hide() YHHUD.flash(message: "登录中...")
if success { self.appleLoginViewModel.appleLogin(params: dict) {
YHLoginManager.shared.loginSuccessActionBlock?() success, error in
YHHUD.flash(message: "登录成功")
self.dismiss(animated: true) YHHUD.hide()
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true) if success {
self.navigationController?.popToRootViewController(animated: true) YHLoginManager.shared.loginSuccessActionBlock?()
return YHHUD.flash(message: "登录成功")
} self.dismiss(animated: true)
TXCommonHandler.sharedInstance().cancelLoginVC(animated: true)
if let err = error { self.navigationController?.popToRootViewController(animated: true)
var msg = err.errorMsg return
if msg.isEmpty {
msg = "登录失败"
} }
YHHUD.flash(message: msg)
if err.errorCode == 30001 { if let err = error {
// 首次登录,没有传电话号码和验证码返回错误码:30001 var msg = err.errorMsg
// 进入手机绑定页面 if msg.isEmpty {
let bindVC = YHOtherLoginViewController() msg = "登录失败"
bindVC.type = .apple }
bindVC.appleLoginParams = dict YHHUD.flash(message: msg)
UIViewController.current?.navigationController?.pushViewController(bindVC)
return if err.errorCode == 30001 {
// 首次登录,没有传电话号码和验证码返回错误码:30001
// 进入手机绑定页面
let bindVC = YHOtherLoginViewController()
bindVC.type = .apple
bindVC.appleLoginParams = dict
UIViewController.current?.navigationController?.pushViewController(bindVC)
return
}
} }
} }
} }
YHAppleLoginManager.shared.appleLogin()
} else {
let view = YHPrivacyAlertView(frame: view.bounds)
view.urlBlock = { [weak self] (type,url) in
guard let self = self else { return }
let vc = YHWebViewViewController()
vc.url = url
if type == 0 {
vc.navTitle = "银河港生活隐私政策"
} else if type == 1 {
vc.navTitle = "银河港生活用户条款"
}
self.navigationController?.pushViewController(vc)
}
view.agreeBlock = { [weak self] in
guard let self = self else { return }
self.privacyView.isAgree = true
self.appleLogin()
}
self.view.addSubview(view)
} }
YHAppleLoginManager.shared.appleLogin()
} }
} }
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