Showing
14 changed files
with
38 additions
and
1034 deletions
InterQR-Internship.xcodeproj/xcuserdata/leyter.xcuserdatad/xcschemes/xcschememanagement.plist
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
3 | +<plist version="1.0"> | |
4 | +<dict> | |
5 | + <key>SchemeUserState</key> | |
6 | + <dict> | |
7 | + <key>InterQR-Internship.xcscheme_^#shared#^_</key> | |
8 | + <dict> | |
9 | + <key>orderHint</key> | |
10 | + <integer>2</integer> | |
11 | + </dict> | |
12 | + </dict> | |
13 | +</dict> | |
14 | +</plist> | ... | ... |
InterQR-Internship.xcworkspace/xcuserdata/leyter.xcuserdatad/UserInterfaceState.xcuserstate
0 → 100644
No preview for this file type
InterQR-Internship.xcworkspace/xcuserdata/leyter.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<Bucket | |
3 | + uuid = "369C53C4-55C8-4418-98C6-B9B8FCA67812" | |
4 | + type = "0" | |
5 | + version = "2.0"> | |
6 | + <Breakpoints> | |
7 | + <BreakpointProxy | |
8 | + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | |
9 | + <BreakpointContent | |
10 | + uuid = "24C8FE5B-99CC-430C-9B8A-90948FD44A96" | |
11 | + shouldBeEnabled = "No" | |
12 | + ignoreCount = "0" | |
13 | + continueAfterRunningActions = "No" | |
14 | + filePath = "InterQR-Internship/Modules/VerificationSceen/ViewController/VerificationViewController.swift" | |
15 | + startingColumnNumber = "9223372036854775807" | |
16 | + endingColumnNumber = "9223372036854775807" | |
17 | + startingLineNumber = "117" | |
18 | + endingLineNumber = "117" | |
19 | + landmarkName = "keyboardWillHide(notification:)" | |
20 | + landmarkType = "7"> | |
21 | + </BreakpointContent> | |
22 | + </BreakpointProxy> | |
23 | + </Breakpoints> | |
24 | +</Bucket> | ... | ... |
1 | -// | |
2 | -// CodeVerificationViewController.swift | |
3 | -// InterQR-Internship | |
4 | -// | |
5 | -// Created by Дмитрий Тимофеев on 03.06.2022. | |
6 | -// | |
7 | - | |
8 | -import UIKit | |
9 | - | |
10 | -class CodeVerificationViewController: UIViewController { | |
11 | - | |
12 | - private let codeView = CodeVerificationView() | |
13 | - | |
14 | - override func loadView() { | |
15 | - view = codeView | |
16 | - } | |
17 | - | |
18 | - override func viewDidLoad() { | |
19 | - initViewController() | |
20 | - } | |
21 | - | |
22 | - private func initViewController() { | |
23 | - codeView.firstTextField.delegate = self | |
24 | - codeView.backButton.addTarget(self, action: #selector(didDismissVC), for: .touchUpInside) | |
25 | - codeView.verifyButton.addTarget(self, action: #selector(didVerifyCode), for: .touchUpInside) | |
26 | - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil) | |
27 | - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) | |
28 | - } | |
29 | - | |
30 | -// deinit { | |
31 | -// NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil) | |
32 | -// NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil) | |
33 | -// } | |
34 | -} | |
35 | - | |
36 | -extension CodeVerificationViewController { | |
37 | - | |
38 | - @objc func didDismissVC() { | |
39 | - dismiss(animated: true, completion: nil) | |
40 | - } | |
41 | - | |
42 | - @objc func didVerifyCode() { | |
43 | - codeView.firstTextField.backgroundColor = UIColor(red: 255/255, green: 237/255, blue: 240/255, alpha: 1) | |
44 | - codeView.secondTextField.backgroundColor = UIColor(red: 255/255, green: 237/255, blue: 240/255, alpha: 1) | |
45 | - codeView.thirdTextField.backgroundColor = UIColor(red: 255/255, green: 237/255, blue: 240/255, alpha: 1) | |
46 | - codeView.fourthTextField.backgroundColor = UIColor(red: 255/255, green: 237/255, blue: 240/255, alpha: 1) | |
47 | - | |
48 | - codeView.firstTextField.textColor = UIColor(red: 255/255, green: 0/255, blue: 46/255, alpha: 1) | |
49 | - codeView.secondTextField.textColor = UIColor(red: 255/255, green: 0/255, blue: 46/255, alpha: 1) | |
50 | - codeView.thirdTextField.textColor = UIColor(red: 255/255, green: 0/255, blue: 46/255, alpha: 1) | |
51 | - codeView.fourthTextField.textColor = UIColor(red: 255/255, green: 0/255, blue: 46/255, alpha: 1) | |
52 | - | |
53 | - codeView.errorAlertLabel.isHidden = false | |
54 | - } | |
55 | - | |
56 | - @objc func keyboardWillShow(notification: NSNotification) { | |
57 | -// if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { | |
58 | -// let keyboardHeight = keyboardFrame.cgRectValue.height | |
59 | -// // let bottomSpace = | |
60 | -// if self.view.frame.origin.y == 0 { | |
61 | -// self.view.frame.origin.y -= keyboardFrame.height | |
62 | -// } | |
63 | - if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { | |
64 | - if self.view.frame.origin.y == 0 { | |
65 | -// self.view.frame.origin.y -= keyboardSize.height - 150 | |
66 | - codeView.containerView.frame.origin.y -= keyboardSize.height - 150 | |
67 | - codeView.shieldImage.frame.origin.x += view.frame.origin.x + 100 | |
68 | - } | |
69 | - } | |
70 | - } | |
71 | - | |
72 | - @objc func keyboardWillHide() { | |
73 | - if self.view.frame.origin.y != 0 { | |
74 | - self.view.frame.origin.y = 0 | |
75 | - } | |
76 | - } | |
77 | - | |
78 | -} | |
79 | - | |
80 | -extension CodeVerificationViewController: UITextFieldDelegate { | |
81 | - | |
82 | - func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { | |
83 | - | |
84 | - true | |
85 | - } | |
86 | -} |
1 | -// | |
2 | -// ViewController.swift | |
3 | -// InterQR-Internship | |
4 | -// | |
5 | -// Created by Дмитрий Тимофеев on 30.05.2022. | |
6 | -// | |
7 | - | |
8 | -import UIKit | |
9 | - | |
10 | -class VerificationViewController: UIViewController { | |
11 | - | |
12 | - var isKeyboardAppear = false | |
13 | - private let mainView = VerificationView() | |
14 | - | |
15 | - lazy var phonePickerModels: [PhonePickerModel] = { | |
16 | - var models: [PhonePickerModel] = [] | |
17 | - | |
18 | - for (code, value) in PhoneService.phones | |
19 | - { | |
20 | - models.append(.init(code: code, countryCode: value.1, title: value.0, icon: value.2)) | |
21 | - } | |
22 | - return models | |
23 | - }() | |
24 | - | |
25 | - override func loadView() { | |
26 | - view = mainView | |
27 | - } | |
28 | - override func viewDidLoad() { | |
29 | - super.viewDidLoad() | |
30 | - initViewController() | |
31 | - } | |
32 | - | |
33 | - | |
34 | - private func initViewController() { | |
35 | - mainView.phonePickerView.phoneNumberPicker.delegate = self | |
36 | - mainView.phonePickerView.phoneNumberPicker.dataSource = self | |
37 | - mainView.showPickerButton.addTarget(self, action: #selector(didshowPickerButtonTapped(_:)), for: .touchUpInside) | |
38 | - mainView.phonePickerView.selectButton.addTarget(self, action: #selector(didshowPickerButtonTapped(_:)), for: .touchUpInside) | |
39 | - mainView.phonePickerView.titleButton.addTarget(self, action: #selector(didshowPickerButtonTapped(_:)), for: .touchDragInside) | |
40 | - mainView.continueButton.addTarget(self, action: #selector(didShowCodeVerificationVC), for: .touchUpInside) | |
41 | - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil) | |
42 | - NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil) | |
43 | - } | |
44 | - | |
45 | -} | |
46 | - | |
47 | -//MARK: targets | |
48 | -extension VerificationViewController { | |
49 | - // @objc private func didRadioButtonTapped(_ sender: UIButton) { | |
50 | - // switch sender { | |
51 | - // case mainView.phoneNumberButton : | |
52 | - // mainView.emailButton.isSelected = false | |
53 | - // mainView.phoneNumberButton.isSelected = true | |
54 | - //// mainView.phonymberTextField.isHidden = false | |
55 | - //// mainView.emailTextField.isHidden = true | |
56 | - // case mainView.emailButton: | |
57 | - // mainView.emailButton.isSelected = true | |
58 | - // mainView.phoneNumberButton.isSelected = false | |
59 | - // default: | |
60 | - // return | |
61 | - // } | |
62 | - // } | |
63 | - | |
64 | - @objc private func didshowPickerButtonTapped(_ sender: UIButton) { | |
65 | - mainView.isShow ? mainView.showPickerView() : mainView.hidePicerView() | |
66 | - mainView.isShow.toggle() | |
67 | - } | |
68 | - | |
69 | - @objc private func didShowCodeVerificationVC() { | |
70 | - let vc = CodeVerificationViewController() | |
71 | - vc.modalPresentationStyle = .fullScreen | |
72 | - present(vc, animated: true) | |
73 | - } | |
74 | - | |
75 | - @objc func keyboardWillShow(notification: NSNotification) { | |
76 | - // if let keyboardFrame: NSValue = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue { | |
77 | - // let keyboardHeight = keyboardFrame.cgRectValue.height | |
78 | - // // let bottomSpace = | |
79 | - // if self.view.frame.origin.y == 0 { | |
80 | - // self.view.frame.origin.y -= keyboardFrame.height | |
81 | - // } | |
82 | - // if let keyboardSize = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue { | |
83 | - // if self.view.frame.origin.y == 0 { | |
84 | - // self.view.frame.origin.y -= keyboardSize.height - 150 | |
85 | - // mainView.phoneTextField.frame.origin.y -= 60 | |
86 | - // mainView.enterChosenAuthenticatorLabel.frame.origin.y -= 60 | |
87 | - // codeView.shieldImage.frame.origin.x += view.frame.origin.x + 100 | |
88 | - if !isKeyboardAppear { | |
89 | - | |
90 | - if mainView.phoneTextField.frame.origin.y == mainView.phoneTextField.frame.origin.y && mainView.enterChosenAuthenticatorLabel.frame.origin.y == mainView.enterChosenAuthenticatorLabel.frame.origin.y{ | |
91 | - mainView.phoneTextField.frame.origin.y -= 100 | |
92 | - mainView.emailTextField.frame.origin.y -= 100 | |
93 | - mainView.enterChosenAuthenticatorLabel.frame.origin.y -= 100 | |
94 | - mainView.chooseLabel.frame.origin.y -= 80 | |
95 | - mainView.emailButton.frame.origin.y -= 80 | |
96 | - mainView.phoneNumberButton.frame.origin.y -= 80 | |
97 | - mainView.dividingLineView.frame.origin.y -= 80 | |
98 | - } | |
99 | - | |
100 | - isKeyboardAppear = true | |
101 | - } | |
102 | - // } | |
103 | - // } | |
104 | - } | |
105 | - | |
106 | - @objc func keyboardWillHide(notification: NSNotification) { | |
107 | - | |
108 | - if isKeyboardAppear { | |
109 | - | |
110 | - if mainView.phoneTextField.frame.origin.y != 0 && mainView.enterChosenAuthenticatorLabel.frame.origin.y != 0{ | |
111 | - mainView.phoneTextField.frame.origin.y += 100 | |
112 | - mainView.emailTextField.frame.origin.y += 100 | |
113 | - mainView.enterChosenAuthenticatorLabel.frame.origin.y += 100 | |
114 | - mainView.chooseLabel.frame.origin.y += 80 | |
115 | - mainView.emailButton.frame.origin.y += 80 | |
116 | - mainView.phoneNumberButton.frame.origin.y += 80 | |
117 | - mainView.dividingLineView.frame.origin.y += 80 | |
118 | - } | |
119 | - | |
120 | - | |
121 | - isKeyboardAppear = false | |
122 | - } | |
123 | - // mainView.phoneTextField.frame.origin.y += 60 | |
124 | - // mainView.enterChosenAuthenticatorLabel.frame.origin.y += 60 | |
125 | - | |
126 | - } | |
127 | -} | |
128 | - | |
129 | -//MARK: table view delegate and datasource | |
130 | -extension VerificationViewController { | |
131 | - | |
132 | -} | |
133 | - | |
134 | -extension VerificationViewController: UIPickerViewDataSource, UIPickerViewDelegate { | |
135 | - | |
136 | - func numberOfComponents(in pickerView: UIPickerView) -> Int { return 1 } | |
137 | - | |
138 | - func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { | |
139 | - return phonePickerModels.count | |
140 | - | |
141 | - } | |
142 | - | |
143 | - func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { | |
144 | - 60 | |
145 | - } | |
146 | - | |
147 | - // func pickerView(_ pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat { | |
148 | - // return 130.0 | |
149 | - // } | |
150 | - | |
151 | - func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { | |
152 | - let model = phonePickerModels[row] | |
153 | - return PickerView.create(icon: model.icon, title: model.title, code: model.countryCode) | |
154 | - } | |
155 | - | |
156 | - func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { | |
157 | - pickerView.subviews[1].backgroundColor = .clear | |
158 | - let model = phonePickerModels[row] | |
159 | - mainView.phoneTextField.text = "\(model.countryCode)" | |
160 | - mainView.flagPickerView.image = model.icon | |
161 | - } | |
162 | -} | |
163 | - |
1 | -// | |
2 | -// CodeVerificationView.swift | |
3 | -// InterQR-Internship | |
4 | -// | |
5 | -// Created by Дмитрий Тимофеев on 03.06.2022. | |
6 | -// | |
7 | - | |
8 | -import UIKit | |
9 | - | |
10 | -class CodeVerificationView: UIView { | |
11 | - | |
12 | - var containerView: UIView = { | |
13 | - var obj = UIView() | |
14 | - return obj | |
15 | - }() | |
16 | - var backButton: UIButton = { | |
17 | - var obj = UIButton() | |
18 | - obj.setImage(UIImage(named: "BackPointer"), for: .normal) | |
19 | - obj.backgroundColor = .white | |
20 | - obj.layer.borderColor = UIColor(red: 224/255, green: 231/255, blue: 232/255, alpha: 1).cgColor | |
21 | - obj.layer.cornerRadius = 13 | |
22 | - obj.layer.borderWidth = 1 | |
23 | - return obj | |
24 | - }() | |
25 | - var logoImage: UIImageView = { | |
26 | - var obj = UIImageView() | |
27 | - obj.image = UIImage(named: "InterQR") | |
28 | - return obj | |
29 | - }() | |
30 | - var shieldImage: UIImageView = { | |
31 | - var obj = UIImageView() | |
32 | - obj.image = UIImage(named: "Lock") | |
33 | - return obj | |
34 | - }() | |
35 | - var descriptionLabel: UILabel = { | |
36 | - var obj = UILabel() | |
37 | - obj.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 35) | |
38 | - obj.text = "Enter your\nverification code" | |
39 | - obj.numberOfLines = 2 | |
40 | - return obj | |
41 | - }() | |
42 | - var firstTextField: UITextField = { | |
43 | - var obj = UITextField() | |
44 | - obj.backgroundColor = UIColor(red: 243/255, green: 243/255, blue: 243/255, alpha: 1) | |
45 | - obj.layer.cornerRadius = 15 | |
46 | - obj.keyboardType = .numberPad | |
47 | - obj.textAlignment = .center | |
48 | - obj.textContentType = .oneTimeCode | |
49 | - obj.becomeFirstResponder() | |
50 | - return obj | |
51 | - }() | |
52 | - var secondTextField: UITextField = { | |
53 | - var obj = UITextField() | |
54 | - obj.backgroundColor = UIColor(red: 243/255, green: 243/255, blue: 243/255, alpha: 1) | |
55 | - obj.layer.cornerRadius = 15 | |
56 | - obj.keyboardType = .numberPad | |
57 | - obj.textAlignment = .center | |
58 | - obj.textContentType = .oneTimeCode | |
59 | - obj.isEnabled = false | |
60 | - return obj | |
61 | - }() | |
62 | - var thirdTextField: UITextField = { | |
63 | - var obj = UITextField() | |
64 | - obj.backgroundColor = UIColor(red: 243/255, green: 243/255, blue: 243/255, alpha: 1) | |
65 | - obj.layer.cornerRadius = 15 | |
66 | - obj.keyboardType = .numberPad | |
67 | - obj.textAlignment = .center | |
68 | - obj.textContentType = .oneTimeCode | |
69 | - obj.isEnabled = false | |
70 | - return obj | |
71 | - }() | |
72 | - var fourthTextField: UITextField = { | |
73 | - var obj = UITextField() | |
74 | - obj.backgroundColor = UIColor(red: 243/255, green: 243/255, blue: 243/255, alpha: 1) | |
75 | - obj.layer.cornerRadius = 15 | |
76 | - obj.keyboardType = .numberPad | |
77 | - obj.textAlignment = .center | |
78 | - obj.textContentType = .oneTimeCode | |
79 | - obj.isEnabled = false | |
80 | - return obj | |
81 | - }() | |
82 | - var errorAlertLabel: UILabel = { | |
83 | - var obj = UILabel() | |
84 | - obj.text = "Please, enter valid verification code" | |
85 | - obj.font = UIFont(name: SkModernistFontType.regular.rawValue, size: 14) | |
86 | - obj.textColor = UIColor(red: 255/255, green: 0/255, blue: 46/255, alpha: 1) | |
87 | - obj.isHidden = true | |
88 | - return obj | |
89 | - }() | |
90 | - var verifyButton: UIButton = { | |
91 | - var obj = UIButton() | |
92 | - obj.setImage(UIImage(named: "RectangleWithShadow"), for: .normal) | |
93 | - return obj | |
94 | - }() | |
95 | - var verifyLabel: UILabel = { | |
96 | - var obj = UILabel() | |
97 | - obj.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 16) | |
98 | - obj.textColor = .white | |
99 | - obj.text = "Verify" | |
100 | - return obj | |
101 | - }() | |
102 | - var tickImage: UIImageView = { | |
103 | - var obj = UIImageView() | |
104 | - obj.image = UIImage(named: "Tick") | |
105 | - return obj | |
106 | - }() | |
107 | - override init(frame: CGRect) { | |
108 | - super.init(frame: frame) | |
109 | - layout() | |
110 | - } | |
111 | - | |
112 | - required init?(coder: NSCoder) { | |
113 | - fatalError("init(coder:) has not been implemented") | |
114 | - } | |
115 | - | |
116 | - func layout() { | |
117 | - backgroundColor = .white | |
118 | - addSubview(backButton) | |
119 | - addSubview(logoImage) | |
120 | - addSubview(shieldImage) | |
121 | - addSubview(containerView) | |
122 | - containerView.addSubview(descriptionLabel) | |
123 | - containerView.addSubview(firstTextField) | |
124 | - containerView.addSubview(secondTextField) | |
125 | - containerView.addSubview(thirdTextField) | |
126 | - containerView.addSubview(fourthTextField) | |
127 | - containerView.addSubview(errorAlertLabel) | |
128 | - containerView.addSubview(verifyButton) | |
129 | - verifyButton.addSubview(verifyLabel) | |
130 | - verifyButton.addSubview(tickImage) | |
131 | - | |
132 | - backButton.snp.makeConstraints { | |
133 | - $0.top.equalTo(snp.top).offset(66) | |
134 | - $0.leading.equalTo(snp.leading).offset(22) | |
135 | - $0.height.width.equalTo(45) | |
136 | - } | |
137 | - logoImage.snp.makeConstraints { | |
138 | - $0.leading.equalTo(backButton.snp.trailing).offset(20) | |
139 | - $0.centerY.equalTo(backButton) | |
140 | - } | |
141 | - shieldImage.snp.makeConstraints { | |
142 | - $0.top.equalTo(backButton.snp.bottom).offset(25) | |
143 | - $0.centerX.equalTo(snp.centerX) | |
144 | - } | |
145 | - containerView.snp.makeConstraints { | |
146 | - $0.top.equalTo(shieldImage.snp.bottom).offset(41) | |
147 | - $0.leading.trailing.equalToSuperview() | |
148 | - $0.height.equalTo(300) | |
149 | - } | |
150 | - descriptionLabel.snp.makeConstraints { | |
151 | - $0.leading.equalTo(containerView.snp.leading).offset(20) | |
152 | - $0.top.equalTo(containerView.snp.top) | |
153 | - } | |
154 | - firstTextField.snp.makeConstraints { | |
155 | - $0.leading.equalTo(containerView.snp.leading).offset(25) | |
156 | - $0.top.equalTo(descriptionLabel.snp.bottom).offset(28) | |
157 | - $0.height.equalTo(55) | |
158 | - } | |
159 | - secondTextField.snp.makeConstraints { | |
160 | - $0.leading.equalTo(firstTextField.snp.trailing).offset(12) | |
161 | - $0.centerY.equalTo(firstTextField) | |
162 | - $0.width.equalTo(firstTextField.snp.width) | |
163 | - $0.height.equalTo(55) | |
164 | - } | |
165 | - thirdTextField.snp.makeConstraints { | |
166 | - $0.leading.equalTo(secondTextField.snp.trailing).offset(12) | |
167 | - $0.centerY.equalTo(firstTextField) | |
168 | - $0.width.equalTo(firstTextField.snp.width) | |
169 | - $0.height.equalTo(55) | |
170 | - } | |
171 | - fourthTextField.snp.makeConstraints { | |
172 | - $0.leading.equalTo(thirdTextField.snp.trailing).offset(12) | |
173 | - $0.centerY.equalTo(firstTextField) | |
174 | - $0.trailing.equalTo(containerView.snp.trailing).offset(-25) | |
175 | - $0.width.equalTo(firstTextField.snp.width) | |
176 | - $0.height.equalTo(55) | |
177 | - } | |
178 | - errorAlertLabel.snp.makeConstraints { | |
179 | - $0.top.equalTo(firstTextField.snp.bottom).offset(8) | |
180 | - $0.leading.equalTo(firstTextField.snp.leading) | |
181 | - } | |
182 | - verifyButton.snp.makeConstraints { | |
183 | - $0.top.equalTo(firstTextField.snp.bottom).offset(67) | |
184 | - $0.left.right.equalToSuperview() | |
185 | - } | |
186 | - verifyLabel.snp.makeConstraints { | |
187 | - $0.left.equalToSuperview().offset(49) | |
188 | - $0.top.equalToSuperview().offset(22) | |
189 | - } | |
190 | - tickImage.snp.makeConstraints { | |
191 | - $0.right.equalToSuperview().offset(-47) | |
192 | - $0.centerY.equalTo(verifyLabel) | |
193 | - } | |
194 | - } | |
195 | -} |
1 | -// | |
2 | -// PhoneNumberView.swift | |
3 | -// InterQR-Internship | |
4 | -// | |
5 | -// Created by Дмитрий Тимофеев on 31.05.2022. | |
6 | -// | |
7 | - | |
8 | -import UIKit | |
9 | -import CoreTelephony | |
10 | - | |
11 | -class PhoneNumberView: UIView { | |
12 | - | |
13 | - var containerPickerView: UIView = { | |
14 | - var view = UIView() | |
15 | - view.backgroundColor = .systemRed | |
16 | - return view | |
17 | - }() | |
18 | - | |
19 | - var titleButton: UIButton = { | |
20 | - var obj = UIButton() | |
21 | - obj.setTitle("Select your country", for: .normal) | |
22 | - obj.setTitleColor(UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1), for: .normal) | |
23 | - obj.titleLabel?.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 18) | |
24 | - obj.titleLabel?.textAlignment = .center | |
25 | - return obj | |
26 | - }() | |
27 | - | |
28 | - var dividingLineView: UIView = { | |
29 | - var view = UIView() | |
30 | - view.backgroundColor = UIColor(red: 246/255, green: 246/255, blue: 246/255, alpha: 1) | |
31 | - return view | |
32 | - }() | |
33 | - | |
34 | - var phoneNumberPicker: UIPickerView = { | |
35 | - var picker = UIPickerView() | |
36 | - return picker | |
37 | - }() | |
38 | - | |
39 | - var selectButton: UIButton = { | |
40 | - var button = UIButton() | |
41 | - | |
42 | - button.backgroundColor = UIColor(red: 2/255, green: 115/255, blue: 185/255, alpha: 1) | |
43 | - button.clipsToBounds = true | |
44 | - | |
45 | - return button | |
46 | - }() | |
47 | - | |
48 | - var selectLabel: UILabel = { | |
49 | - var label = UILabel() | |
50 | - label.text = "Select" | |
51 | - label.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 16) | |
52 | - label.textColor = .white | |
53 | - return label | |
54 | - }() | |
55 | - | |
56 | - override init(frame: CGRect) { | |
57 | - super.init(frame: frame) | |
58 | - layout() | |
59 | - setup() | |
60 | - backgroundColor = .white | |
61 | - } | |
62 | - | |
63 | - required init?(coder: NSCoder) { | |
64 | - fatalError("init(coder:) has not been implemented") | |
65 | - } | |
66 | - | |
67 | - func layout() { | |
68 | - self.backgroundColor = .white | |
69 | - addSubview(titleButton) | |
70 | - addSubview(dividingLineView) | |
71 | - addSubview(phoneNumberPicker) | |
72 | - addSubview(selectButton) | |
73 | - | |
74 | - selectButton.addSubview(selectLabel) | |
75 | - | |
76 | - titleButton.snp.makeConstraints { make in | |
77 | - make.top.equalToSuperview().offset(20) | |
78 | - make.leading.trailing.equalToSuperview() | |
79 | - } | |
80 | - | |
81 | - dividingLineView.snp.makeConstraints { | |
82 | - $0.left.right.equalToSuperview() | |
83 | - $0.height.equalTo(1) | |
84 | - $0.top.equalTo(titleButton.snp.bottom).offset(22) | |
85 | - } | |
86 | - phoneNumberPicker.snp.makeConstraints { | |
87 | - $0.left.right.equalToSuperview().inset(5) | |
88 | - $0.top.equalTo(dividingLineView.snp.bottom).offset(20) | |
89 | - } | |
90 | - selectButton.snp.makeConstraints { | |
91 | - $0.right.equalToSuperview() | |
92 | - $0.left.equalToSuperview() | |
93 | - $0.bottom.equalToSuperview() | |
94 | - $0.height.equalTo(70) | |
95 | - $0.top.equalTo(phoneNumberPicker.snp.bottom).offset(20) | |
96 | - } | |
97 | - selectLabel.snp.makeConstraints { | |
98 | - $0.centerX.equalTo(selectButton.snp.centerX) | |
99 | - $0.top.equalTo(selectButton.snp.top).offset(20) | |
100 | - } | |
101 | - } | |
102 | -} | |
103 | - | |
104 | -extension PhoneNumberView { | |
105 | - | |
106 | - func setup() { | |
107 | - | |
108 | - let countryCode: String | |
109 | - if let carrier = CTTelephonyNetworkInfo().serviceSubscriberCellularProviders?.first?.value, | |
110 | - let code = carrier.isoCountryCode?.uppercased() { | |
111 | - countryCode = code | |
112 | - } else { | |
113 | - countryCode = "USA" | |
114 | - } | |
115 | - | |
116 | - phoneNumberPicker.selectRow(0, inComponent: 0, animated: true) | |
117 | - | |
118 | - phoneNumberPicker.subviews[1].backgroundColor = .clear | |
119 | - | |
120 | - } | |
121 | -} | |
122 | - |
1 | -// | |
2 | -// PickerView.swift | |
3 | -// InterQR-Internship | |
4 | -// | |
5 | -// Created by Дмитрий Тимофеев on 01.06.2022. | |
6 | -// | |
7 | - | |
8 | -import UIKit | |
9 | - | |
10 | -final class PickerView: UIView { | |
11 | - | |
12 | - private let iconView: UIImageView = { | |
13 | - var obj = UIImageView() | |
14 | - obj.contentMode = .scaleAspectFill | |
15 | - obj.layer.cornerRadius = 10 | |
16 | - return obj | |
17 | - }() | |
18 | - private let label: UILabel = { | |
19 | - var obj = UILabel() | |
20 | - obj.textColor = UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1) | |
21 | - obj.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 15) | |
22 | - return obj | |
23 | - }() | |
24 | - private let countryCode: UILabel = { | |
25 | - var obj = UILabel() | |
26 | - obj.textColor = UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1) | |
27 | - obj.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 15) | |
28 | - return obj | |
29 | - }() | |
30 | - override init(frame: CGRect) { | |
31 | - super.init(frame: frame) | |
32 | - layout() | |
33 | - } | |
34 | - | |
35 | - required init?(coder: NSCoder) { | |
36 | - super.init(coder: coder) | |
37 | - layout() | |
38 | - } | |
39 | - | |
40 | - private func layout() { | |
41 | - addSubview(iconView) | |
42 | - addSubview(label) | |
43 | - addSubview(countryCode) | |
44 | - | |
45 | - iconView.snp.makeConstraints { make in | |
46 | - make.leading.equalToSuperview().offset(25) | |
47 | - make.centerY.equalTo(snp.centerY) | |
48 | -// make.top.bottom.equalToSuperview() | |
49 | - make.height.width.equalTo(20) | |
50 | - } | |
51 | - | |
52 | - label.snp.makeConstraints { make in | |
53 | - make.leading.equalTo(iconView.snp.trailing).offset(20) | |
54 | - make.top.bottom.equalToSuperview() | |
55 | - } | |
56 | - | |
57 | - countryCode.snp.makeConstraints { make in | |
58 | - make.trailing.equalToSuperview().offset(-25) | |
59 | - make.top.bottom.equalToSuperview() | |
60 | - } | |
61 | - } | |
62 | - | |
63 | - static func create(icon: UIImage, title: String, code: String) -> PickerView { | |
64 | - let numberView = PickerView() | |
65 | - numberView.iconView.image = icon | |
66 | - numberView.label.text = title | |
67 | - numberView.countryCode.text = code | |
68 | - return numberView | |
69 | - } | |
70 | -} |
1 | -// | |
2 | -// TextFieldWithPadding.swift | |
3 | -// InterQR-Internship | |
4 | -// | |
5 | -// Created by Дмитрий Тимофеев on 01.06.2022. | |
6 | -// | |
7 | - | |
8 | -import UIKit | |
9 | - | |
10 | -class TextFieldWithPadding: UITextField { | |
11 | - | |
12 | - var textPaddingForEmail = UIEdgeInsets( | |
13 | - top: 0, | |
14 | - left: 22, | |
15 | - bottom: 0, | |
16 | - right: 22 | |
17 | - ) | |
18 | - var textPaddingForPhone = UIEdgeInsets( | |
19 | - top: 0, | |
20 | - left: 78, | |
21 | - bottom: 0, | |
22 | - right: 22 | |
23 | - ) | |
24 | - | |
25 | - override func textRect(forBounds bounds: CGRect) -> CGRect { | |
26 | - let rect = super.textRect(forBounds: bounds) | |
27 | - return rect.inset(by: textPaddingForPhone) | |
28 | - } | |
29 | - | |
30 | - override func editingRect(forBounds bounds: CGRect) -> CGRect { | |
31 | - let rect = super.editingRect(forBounds: bounds) | |
32 | - return rect.inset(by: textPaddingForPhone) | |
33 | - } | |
34 | -} |
1 | -// | |
2 | -// VerificationView.swift | |
3 | -// InterQR-Internship | |
4 | -// | |
5 | -// Created by Дмитрий Тимофеев on 30.05.2022. | |
6 | -// | |
7 | - | |
8 | -import Foundation | |
9 | -import UIKit | |
10 | - | |
11 | -class VerificationView: UIView { | |
12 | - | |
13 | - var isShow: Bool = false | |
14 | - | |
15 | - var logoImage: UIImageView = { | |
16 | - var view = UIImageView() | |
17 | - view.image = UIImage(named: "InterQR") | |
18 | - return view | |
19 | - }() | |
20 | - var greetingsLabel: UILabel = { | |
21 | - var label = UILabel() | |
22 | - label.text = "Hello" | |
23 | - label.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 35) | |
24 | - return label | |
25 | - }() | |
26 | - var verifyLabel: UILabel = { | |
27 | - var label = UILabel() | |
28 | - label.text = "Lets verify your \naccount" | |
29 | - label.numberOfLines = 2 | |
30 | - label.font = UIFont(name: SkModernistFontType.regular.rawValue, size: 28) | |
31 | - return label | |
32 | - }() | |
33 | - var shieldImage: UIImageView = { | |
34 | - var view = UIImageView() | |
35 | - view.image = UIImage(named: "Shield") | |
36 | - return view | |
37 | - }() | |
38 | - var chooseLabel: UILabel = { | |
39 | - var label = UILabel() | |
40 | - label.text = "Choose what to start with" | |
41 | - label.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 16) | |
42 | - label.font = .systemFont(ofSize: 16, weight: .bold) | |
43 | - return label | |
44 | - }() | |
45 | - var emailButton: UIButton = { | |
46 | - var button = UIButton() | |
47 | - button.setTitle("Email", for: .normal) | |
48 | - button.setTitleColor(UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1), for: .normal) | |
49 | - button.setTitleColor(UIColor(red: 185/255, green: 185/255, blue: 185/255, alpha: 1), for: .disabled) | |
50 | - button.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 14) | |
51 | - button.titleEdgeInsets = UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 0) | |
52 | - button.setImage(UIImage(named: "OnIndicator"), for: .normal) | |
53 | - button.setImage(UIImage(named: "OffIndicator"), for: .selected) | |
54 | - button.contentMode = .left | |
55 | - return button | |
56 | - }() | |
57 | -// var emailIndicatorImage: UIImageView = { | |
58 | -// var image = UIImageView() | |
59 | -// image.image = UIImage(named: "OnIndicator") | |
60 | -// return image | |
61 | -// }() | |
62 | - var phoneNumberButton: UIButton = { | |
63 | - var button = UIButton() | |
64 | - button.setTitle("Phone Number", for: .normal) | |
65 | - button.setTitleColor(UIColor(red: 50/255, green: 55/255, blue: 85/255, alpha: 1), for: .normal) | |
66 | - button.setTitleColor(UIColor(red: 185/255, green: 185/255, blue: 185/255, alpha: 1), for: .disabled) | |
67 | - button.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 14) | |
68 | - button.titleEdgeInsets = UIEdgeInsets(top: 0, left: 14, bottom: 0, right: 10) | |
69 | - button.setImage(UIImage(named: "OnIndicator"), for: .selected) | |
70 | - button.setImage(UIImage(named: "OffIndicator"), for: .normal) | |
71 | - return button | |
72 | - }() | |
73 | -// var phoneNumberIndicatorImage: UIImageView = { | |
74 | -// var image = UIImageView() | |
75 | -// image.image = UIImage(named: "OffIndicator") | |
76 | -// return image | |
77 | -// }() | |
78 | -// var pickEmailLabel: UILabel = { | |
79 | -// var label = UILabel() | |
80 | -// label.text = "Email" | |
81 | -// label.font = UIFont(name: SkModernistFontType.regular.rawValue, size: 15) | |
82 | -// return label | |
83 | -// }() | |
84 | -// var pickPhoneLabel: UILabel = { | |
85 | -// var label = UILabel() | |
86 | -// label.text = "Phone Number" | |
87 | -// label.textColor = UIColor(red: 185/255, green: 185/255, blue: 185/255, alpha: 1) | |
88 | -// label.font = UIFont(name: SkModernistFontType.regular.rawValue, size: 15) | |
89 | -// return label | |
90 | -// }() | |
91 | - var dividingLineView: UIView = { | |
92 | - var view = UIView() | |
93 | - view.backgroundColor = UIColor(red: 246/255, green: 246/255, blue: 246/255, alpha: 1) | |
94 | - return view | |
95 | - }() | |
96 | - var enterChosenAuthenticatorLabel: UILabel = { | |
97 | - var label = UILabel() | |
98 | - label.text = "Enter your email address" | |
99 | - label.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 16) | |
100 | - return label | |
101 | - }() | |
102 | - var emailTextField: UITextField = { | |
103 | - var textField = UITextField() | |
104 | - textField.backgroundColor = UIColor(red: 243/255, green: 243/255, blue: 243/255, alpha: 1) | |
105 | - textField.textAlignment = .left | |
106 | - textField.layer.cornerRadius = 15 | |
107 | - textField.keyboardType = .emailAddress | |
108 | - textField.placeholder = "Example: john.doe@gmail.com" | |
109 | - textField.font = UIFont(name: SkModernistFontType.regular.rawValue, size: 15) | |
110 | - textField.layer.masksToBounds = true | |
111 | - textField.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 22, height: textField.frame.height)) | |
112 | - textField.leftViewMode = .always | |
113 | - return textField | |
114 | - }() | |
115 | - var phoneTextField: TextFieldWithPadding = { | |
116 | - var textField = TextFieldWithPadding() | |
117 | - textField.backgroundColor = UIColor(red: 243/255, green: 243/255, blue: 243/255, alpha: 1) | |
118 | - textField.textAlignment = .left | |
119 | - textField.layer.cornerRadius = 15 | |
120 | - textField.keyboardType = .numberPad | |
121 | - textField.text = "+1" | |
122 | - textField.font = UIFont(name: SkModernistFontType.regular.rawValue, size: 15) | |
123 | - textField.layer.masksToBounds = true | |
124 | - textField.isHidden = true | |
125 | - return textField | |
126 | - }() | |
127 | - var verificationDescriptionLabel: UILabel = { | |
128 | - var label = UILabel() | |
129 | - label.numberOfLines = 0 | |
130 | - label.text = "Verification code will be sent to your e-mail" | |
131 | - label.font = UIFont(name: "Sk-Modernist", size: 14) | |
132 | - label.font = .systemFont(ofSize: 14, weight: .regular) | |
133 | - return label | |
134 | - }() | |
135 | - var continueButton: UIButton = { | |
136 | - var button = UIButton() | |
137 | - button.setImage(UIImage(named: "RectangleWithShadow"), for: .normal) | |
138 | - button.clipsToBounds = true | |
139 | - button.contentMode = .scaleAspectFit | |
140 | - button.layer.cornerRadius = 15 | |
141 | - return button | |
142 | - }() | |
143 | - var continueLabel: UILabel = { | |
144 | - var label = UILabel() | |
145 | - label.text = "Continue" | |
146 | - label.font = UIFont(name: SkModernistFontType.bold.rawValue, size: 16) | |
147 | - label.textColor = .white | |
148 | - return label | |
149 | - }() | |
150 | - var pointerImage: UIImageView = { | |
151 | - var image = UIImageView() | |
152 | - image.image = UIImage(named: "Pointer") | |
153 | - return image | |
154 | - }() | |
155 | - var phonePickerView: PhoneNumberView = { | |
156 | - var view = PhoneNumberView() | |
157 | - view.isUserInteractionEnabled = true | |
158 | - return view | |
159 | - }() | |
160 | - var showPickerButton: UIButton = { | |
161 | - var button = UIButton() | |
162 | - button.isHidden = true | |
163 | - return button | |
164 | - }() | |
165 | - var flagPickerView: UIImageView = { | |
166 | - var image = UIImageView() | |
167 | - image.image = UIImage(named: "USA") | |
168 | - image.layer.cornerRadius = 11 | |
169 | - image.contentMode = .scaleAspectFit | |
170 | - return image | |
171 | - }() | |
172 | - var flagPointerView: UIImageView = { | |
173 | - var image = UIImageView() | |
174 | - image.image = UIImage(named: "FlagPointer") | |
175 | - return image | |
176 | - }() | |
177 | - | |
178 | - override init(frame: CGRect) { | |
179 | - super.init(frame: frame) | |
180 | - backgroundColor = .white | |
181 | - layout() | |
182 | - phoneNumberButton.addTarget(self, action: #selector(choosePhoneCode), for: .touchUpInside) | |
183 | - emailButton.addTarget(self, action: #selector(chooseEmail), for: .touchUpInside) | |
184 | - } | |
185 | - | |
186 | - required init?(coder: NSCoder) { | |
187 | - fatalError("init(coder:) has not been implemented") | |
188 | - } | |
189 | - | |
190 | - func layout() { | |
191 | - | |
192 | - addSubview(logoImage) | |
193 | - addSubview(greetingsLabel) | |
194 | - addSubview(verifyLabel) | |
195 | - addSubview(shieldImage) | |
196 | - | |
197 | - addSubview(chooseLabel) | |
198 | - addSubview(emailButton) | |
199 | - addSubview(phoneNumberButton) | |
200 | -// phoneNumberButton.addSubview(pickPhoneLabel) | |
201 | -// phoneNumberButton.addSubview(phoneNumberIndicatorImage) | |
202 | - addSubview(dividingLineView) | |
203 | - | |
204 | - addSubview(enterChosenAuthenticatorLabel) | |
205 | - addSubview(emailTextField) | |
206 | - addSubview(phoneTextField) | |
207 | - addSubview(verificationDescriptionLabel) | |
208 | - phoneTextField.addSubview(showPickerButton) | |
209 | - | |
210 | - showPickerButton.addSubview(flagPickerView) | |
211 | - showPickerButton.addSubview(flagPointerView) | |
212 | - | |
213 | - addSubview(continueButton) | |
214 | - continueButton.addSubview(continueLabel) | |
215 | - continueButton.addSubview(pointerImage) | |
216 | - | |
217 | - addSubview(phonePickerView) | |
218 | - | |
219 | - logoImage.snp.makeConstraints { | |
220 | - $0.top.equalTo(snp.top).offset(80) | |
221 | - $0.left.equalTo(snp.left).offset(27) | |
222 | - } | |
223 | - greetingsLabel.snp.makeConstraints { | |
224 | - $0.top.equalTo(logoImage.snp.bottom).offset(42) | |
225 | - $0.left.equalTo(snp.left).offset(24) | |
226 | - } | |
227 | - shieldImage.snp.makeConstraints { | |
228 | - $0.right.equalToSuperview() | |
229 | - $0.top.equalTo(logoImage.snp.bottom).offset(27) | |
230 | - } | |
231 | - verifyLabel.snp.makeConstraints { | |
232 | - $0.left.equalTo(27) | |
233 | - $0.top.equalTo(greetingsLabel.snp.bottom).offset(10) | |
234 | - } | |
235 | - chooseLabel.snp.makeConstraints { | |
236 | - $0.top.equalTo(shieldImage.snp.bottom).offset(52) | |
237 | - $0.left.equalTo(snp.left).offset(27) | |
238 | - } | |
239 | - emailButton.snp.makeConstraints { | |
240 | - $0.left.equalTo(snp.left).offset(27) | |
241 | - $0.top.equalTo(chooseLabel.snp.bottom).offset(29) | |
242 | - $0.height.equalTo(20) | |
243 | - } | |
244 | - phoneNumberButton.snp.makeConstraints { | |
245 | - $0.top.equalTo(emailButton.snp.top) | |
246 | - $0.height.equalTo(20) | |
247 | - $0.left.equalTo(snp.left).offset(144) | |
248 | - } | |
249 | - dividingLineView.snp.makeConstraints { | |
250 | - $0.left.right.equalToSuperview() | |
251 | - $0.top.equalTo(emailButton.snp.bottom).offset(41) | |
252 | - $0.height.equalTo(1) | |
253 | - } | |
254 | - enterChosenAuthenticatorLabel.snp.makeConstraints { | |
255 | - $0.top.equalTo(dividingLineView.snp.bottom).offset(39) | |
256 | - $0.left.equalTo(logoImage.snp.left) | |
257 | - } | |
258 | - emailTextField.snp.makeConstraints { | |
259 | - $0.left.equalTo(logoImage.snp.left) | |
260 | - $0.right.equalTo(snp.right).offset(-27) | |
261 | - $0.top.equalTo(enterChosenAuthenticatorLabel.snp.bottom).offset(23) | |
262 | - $0.height.equalTo(57) | |
263 | - } | |
264 | - phoneTextField.snp.makeConstraints { | |
265 | - $0.left.equalTo(logoImage.snp.left) | |
266 | - $0.right.equalTo(snp.right).offset(-27) | |
267 | - $0.top.equalTo(enterChosenAuthenticatorLabel.snp.bottom).offset(23) | |
268 | - $0.height.equalTo(57) | |
269 | - } | |
270 | - verificationDescriptionLabel.snp.makeConstraints { | |
271 | - $0.top.equalTo(emailTextField.snp.bottom).offset(8) | |
272 | - $0.left.equalTo(snp.left).offset(46) | |
273 | - $0.right.equalTo(snp.right).offset(-22) | |
274 | - } | |
275 | - continueButton.snp.makeConstraints { | |
276 | - $0.left.equalTo(snp.left) | |
277 | - $0.right.equalTo(snp.right) | |
278 | - $0.top.equalTo(emailTextField.snp.bottom).offset(90) | |
279 | - $0.height.equalTo(125) | |
280 | - } | |
281 | - continueLabel.snp.makeConstraints { | |
282 | - $0.left.equalTo(snp.left).offset(48) | |
283 | - $0.top.equalTo(continueButton.snp.top).offset(33) | |
284 | - } | |
285 | - pointerImage.snp.makeConstraints { | |
286 | - $0.top.equalTo(continueButton.snp.top).offset(31) | |
287 | - $0.right.equalTo(snp.right).offset(-51.5) | |
288 | - } | |
289 | - phonePickerView.snp.makeConstraints { make in | |
290 | - make.leading.trailing.equalToSuperview() | |
291 | - make.height.equalTo(390) | |
292 | - make.top.equalTo(self.snp.bottom) | |
293 | - } | |
294 | - showPickerButton.snp.makeConstraints { | |
295 | - $0.height.equalTo(22) | |
296 | - $0.width.equalTo(50) | |
297 | - $0.left.equalTo(emailTextField.snp.left).offset(22) | |
298 | - $0.top.equalTo(emailTextField.snp.top).offset(18) | |
299 | - } | |
300 | - flagPickerView.snp.makeConstraints { | |
301 | - $0.left.equalToSuperview() | |
302 | - $0.top.equalToSuperview() | |
303 | - $0.height.width.equalTo(20) | |
304 | - $0.centerY.equalTo(showPickerButton.snp.centerY) | |
305 | - } | |
306 | - flagPointerView.snp.makeConstraints { | |
307 | - $0.left.equalTo(flagPickerView.snp.right).offset(10) | |
308 | - $0.centerYWithinMargins.equalTo(flagPickerView.snp.centerYWithinMargins) | |
309 | - } | |
310 | - } | |
311 | - | |
312 | - @objc func choosePhoneCode() { | |
313 | - emailTextField.isHidden = true | |
314 | - phoneTextField.isHidden = false | |
315 | - phoneNumberButton.isSelected = true | |
316 | - emailButton.isSelected = true | |
317 | -// phoneNumberButton.setImage(UIImage(named: "OnIndicator"), for: .normal) | |
318 | -// emailButton.setImage(UIImage(named: "OffIndicator"), for: .normal) | |
319 | - phoneNumberButton.image(for: .normal) | |
320 | - verificationDescriptionLabel.text = "Verification code will be sent to\nyour phone number" | |
321 | - enterChosenAuthenticatorLabel.text = "Enter your phone number" | |
322 | - emailTextField.text = "+1" | |
323 | - showPickerButton.isHidden = false | |
324 | - emailTextField.keyboardType = .numberPad | |
325 | - } | |
326 | - | |
327 | - @objc func chooseEmail() { | |
328 | - emailTextField.isHidden = false | |
329 | - phoneTextField.isHidden = true | |
330 | - phoneNumberButton.isSelected = false | |
331 | - emailButton.isSelected = false | |
332 | - verificationDescriptionLabel.text = "Verification code will be sent to your e-mail" | |
333 | - enterChosenAuthenticatorLabel.text = "Enter your email address" | |
334 | - emailTextField.text = "" | |
335 | - emailTextField.placeholder = "Example: john.doe@gmail.com" | |
336 | - showPickerButton.isHidden = true | |
337 | - } | |
338 | - | |
339 | - func showPickerView() { | |
340 | - UIView.animate(withDuration: 0.3) { | |
341 | - self.phonePickerView.snp.updateConstraints { make in | |
342 | - make.top.equalTo(self.snp.bottom).offset(-390) | |
343 | - | |
344 | - } | |
345 | - self.layoutIfNeeded() | |
346 | - } | |
347 | - | |
348 | - } | |
349 | - | |
350 | - func hidePicerView() { | |
351 | - UIView.animate(withDuration: 0.3) { | |
352 | - self.phonePickerView.snp.updateConstraints { make in | |
353 | - make.top.equalTo(self.snp.bottom).offset(0) | |
354 | - } | |
355 | - self.layoutIfNeeded() | |
356 | - } | |
357 | - } | |
358 | -} |
Please
register
or
login
to post a comment