Commit 1c9b4d04 authored by pete谢兆麟's avatar pete谢兆麟

隐私协议逻辑

parent 114c97e2
......@@ -11,6 +11,7 @@
0468D4222B493A5E00CFB916 /* YHPhoneMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */; };
0468D4242B494BEA00CFB916 /* YHCodeResultViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */; };
0468D4262B495A5400CFB916 /* YHPickPhoneAddressViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4252B495A5400CFB916 /* YHPickPhoneAddressViewController.swift */; };
0468D4282B50D4AF00CFB916 /* YHPrivacyAlertView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0468D4272B50D4AF00CFB916 /* YHPrivacyAlertView.swift */; };
04808C062B4686510056D53C /* ATAuthSDK.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 04808C042B4686510056D53C /* ATAuthSDK.bundle */; };
04808C082B4686C10056D53C /* ATAuthSDK_D.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04808C032B4686510056D53C /* ATAuthSDK_D.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
049A48A82B49417300D0C641 /* YHAboutUsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */; };
......@@ -119,6 +120,7 @@
0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPhoneMessageView.swift; sourceTree = "<group>"; };
0468D4232B494BEA00CFB916 /* YHCodeResultViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCodeResultViewController.swift; sourceTree = "<group>"; };
0468D4252B495A5400CFB916 /* YHPickPhoneAddressViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPickPhoneAddressViewController.swift; sourceTree = "<group>"; };
0468D4272B50D4AF00CFB916 /* YHPrivacyAlertView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHPrivacyAlertView.swift; sourceTree = "<group>"; };
04808C032B4686510056D53C /* ATAuthSDK_D.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ATAuthSDK_D.framework; sourceTree = "<group>"; };
04808C042B4686510056D53C /* ATAuthSDK.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = ATAuthSDK.bundle; sourceTree = "<group>"; };
049A48A72B49417300D0C641 /* YHAboutUsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHAboutUsViewController.swift; sourceTree = "<group>"; };
......@@ -354,6 +356,7 @@
A5ACE8E52B4564F7002C94D2 /* YHLoginPrivacyView.swift */,
A5ACE8E62B4564F7002C94D2 /* YHValidateCodeInputView.swift */,
0468D4212B493A5E00CFB916 /* YHPhoneMessageView.swift */,
0468D4272B50D4AF00CFB916 /* YHPrivacyAlertView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -807,6 +810,7 @@
A5ACE9512B4564F7002C94D2 /* YhConstant.swift in Sources */,
A5ACE94A2B4564F7002C94D2 /* BsHUDProgressView.swift in Sources */,
A5ACE9442B4564F7002C94D2 /* Array+Extension.swift in Sources */,
0468D4282B50D4AF00CFB916 /* YHPrivacyAlertView.swift in Sources */,
A5ACE9522B4564F7002C94D2 /* YHIntelligentServiceViewController.swift in Sources */,
A5ACE9462B4564F7002C94D2 /* BsHUDSquareBaseView.swift in Sources */,
A5551FFE2B4C26CE00510980 /* YHBaseViewModel.swift in Sources */,
......
......@@ -194,8 +194,14 @@ class YHLoginViewController: YHBaseViewController {
}
@objc func messageLogin() {
let vc = YHVerificationCodeLoginController()
self.navigationController?.pushViewController(vc)
if privacyView.isAgree {
let vc = YHVerificationCodeLoginController()
self.navigationController?.pushViewController(vc)
} else {
let view = YHPrivacyAlertView(frame: view.bounds)
let window = UIApplication.shared.yhKeyWindow()
window?.addSubview(view)
}
}
}
......
......@@ -14,6 +14,7 @@ class YHLoginPrivacyView: UIView {
var serviceButton: UIButton!
var andLabel: UILabel!
var privacyButton: UIButton!
var isAgree: Bool = false
override init(frame: CGRect) {
super.init(frame: frame)
......@@ -29,6 +30,7 @@ class YHLoginPrivacyView: UIView {
let button = UIButton(type: .custom)
button.setBackgroundImage(UIImage(named: "login_privacy_disagree"), for: .normal)
button.setBackgroundImage(UIImage(named: "login_privacy_agree"), for: .selected)
button.addTarget(self, action: #selector(agreeClick), for: .touchUpInside)
return button
}()
addSubview(agreeButton)
......@@ -97,4 +99,9 @@ class YHLoginPrivacyView: UIView {
make.width.equalTo(96)
}
}
@objc func agreeClick() {
agreeButton.isSelected = !agreeButton.isSelected
isAgree = agreeButton.isSelected
}
}
//
// YHPrivacyAlertView.swift
// galaxy
//
// Created by EDY on 2024/1/12.
// Copyright © 2024 www.davidhuang.com. All rights reserved.
//
import UIKit
import RxSwift
class YHPrivacyAlertView: UIView {
typealias Block = () -> ()
var block: Block?
var centerView: UIView!
var titleLabel: UILabel!
var messageLabel: UILabel!
var agreeButton: UIButton!
var disAgressButton: UIButton!
override init(frame: CGRect) {
super.init(frame: frame)
backgroundColor = UIColor(white: 0.5, alpha: 0.1)
let tap = UITapGestureRecognizer(target: self, action: #selector(handleTap))
tap.delegate = self
addGestureRecognizer(tap)
setView()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func setView() {
centerView = {
let view = UIView()
view.backgroundColor = .white
view.layer.cornerRadius = 12
return view
}()
addSubview(centerView)
centerView.snp.makeConstraints { make in
make.center.equalToSuperview()
make.width.equalTo(299)
make.height.equalTo(187)
}
titleLabel = {
let label = UILabel()
label.text = "同意隐私协议"
label.font = kFont(size: 16)
label.textColor = UIColor(hex:0x222222)
label.textAlignment = .center
return label
}()
centerView.addSubview(titleLabel)
titleLabel.snp.makeConstraints { make in
make.left.right.equalToSuperview()
make.height.equalTo(19)
make.top.equalTo(27)
}
messageLabel = {
let label = UILabel()
label.text = "登录注册需要您阅读并同意我们的《银河服务条款》和《银河隐私政策》"
label.font = kFont(size: 14)
label.textColor = UIColor(hex:0x222222)
label.textAlignment = .left
label.numberOfLines = 0
return label
}()
centerView.addSubview(messageLabel)
messageLabel.snp.makeConstraints { make in
make.left.equalTo(22)
make.right.equalTo(-22)
make.height.equalTo(42)
make.top.equalTo(63)
}
disAgressButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0xffffff)
button.titleLabel?.font = kBoldFont(size: 15)
button.contentHorizontalAlignment = .center
button.setTitle("不同意", for: .normal)
button.setTitleColor( UIColor(hex:0x3c86f8), for: .normal)
button.layer.cornerRadius = 8
button.layer.borderWidth = 1
button.layer.borderColor = UIColor(hex: 0x3c86f8).cgColor
button.addTarget(self, action: #selector(disagree), for: .touchUpInside)
return button
}()
centerView.addSubview(disAgressButton)
disAgressButton.snp.makeConstraints { make in
make.left.equalTo(16)
make.bottom.equalTo(-21)
make.width.equalTo(128)
make.height.equalTo(45)
}
agreeButton = {
let button = UIButton(type: .custom)
button.backgroundColor = UIColor(hex:0x3c86f8)
button.titleLabel?.font = kBoldFont(size: 15)
button.contentHorizontalAlignment = .center
button.setTitle("同意", for: .normal)
button.setTitleColor( UIColor(hex:0xffffff), for: .normal)
button.layer.cornerRadius = 8
button.addTarget(self, action: #selector(agree), for: .touchUpInside)
return button
}()
centerView.addSubview(agreeButton)
agreeButton.snp.makeConstraints { make in
make.right.equalTo(-16)
make.bottom.equalTo(-21)
make.width.equalTo(128)
make.height.equalTo(45)
}
}
@objc func agree() {
if let block = block {
block()
dismiss()
}
}
@objc private func handleTap(_ sender: AnyObject?) {
print("处理点击手势")
dismiss()
}
@objc func disagree() {
dismiss()
}
func dismiss() {
removeFromSuperview()
}
}
extension YHPrivacyAlertView: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer:UIGestureRecognizer, shouldReceive touch:UITouch) -> Bool {
if touch.view == self {
return true
}
return false
}
}
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