Commit cc1ae95ceebb8235057740ed54f25ded88594d05

Authored by Dmitriy Tymofyeyev
1 parent 2bd7cbf5

18.07

... ... @@ -36,37 +36,5 @@
36 36 landmarkType = "7">
37 37 </BreakpointContent>
38 38 </BreakpointProxy>
39   - <BreakpointProxy
40   - BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
41   - <BreakpointContent
42   - uuid = "B21C0B63-1820-47D9-863A-585E52771DA2"
43   - shouldBeEnabled = "Yes"
44   - ignoreCount = "0"
45   - continueAfterRunningActions = "No"
46   - filePath = "InterQR-Internship/Modules/OneTimePasswordScreen/View/OTPView.swift"
47   - startingColumnNumber = "9223372036854775807"
48   - endingColumnNumber = "9223372036854775807"
49   - startingLineNumber = "94"
50   - endingLineNumber = "94"
51   - landmarkName = "didTextFieldChanged(_:)"
52   - landmarkType = "7">
53   - </BreakpointContent>
54   - </BreakpointProxy>
55   - <BreakpointProxy
56   - BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
57   - <BreakpointContent
58   - uuid = "7B1AC08C-6FFC-42BD-8C5C-4D6CE5CBD70C"
59   - shouldBeEnabled = "Yes"
60   - ignoreCount = "0"
61   - continueAfterRunningActions = "No"
62   - filePath = "InterQR-Internship/Modules/OneTimePasswordScreen/ViewController/CodeVerificationViewController.swift"
63   - startingColumnNumber = "9223372036854775807"
64   - endingColumnNumber = "9223372036854775807"
65   - startingLineNumber = "145"
66   - endingLineNumber = "145"
67   - landmarkName = "didFullCodeCompletion(_:)"
68   - landmarkType = "7">
69   - </BreakpointContent>
70   - </BreakpointProxy>
71 39 </Breakpoints>
72 40 </Bucket>
... ...
... ... @@ -9,7 +9,10 @@ import Foundation
9 9 import Alamofire
10 10
11 11 class AuthService {
12   - static let share = AuthService()
  12 + static let shared = AuthService()
  13 +
  14 + private init() {
  15 + }
13 16
14 17 var networkToken: String? {
15 18 get {
... ... @@ -87,10 +90,11 @@ class AuthService {
87 90 }
88 91
89 92 func loginRequest(model: LoginRequestModel, success: @escaping LoginWebServiceResponse, fail: @escaping FailedHandler) {
90   - let headers = ["Authorization": "Bearer \(self.networkToken ?? "")"]
  93 + let interceptor = InterQrRequestInterceptor()
  94 +
91 95 let params = ["device_uuid": model.deviceUUID] as [String: Any]
92 96
93   - AF.request(Constants.baseURL + APIRoutes.loginURL.urlString, method: .post, parameters: params, encoding: JSONEncoding.default, headers: HTTPHeaders(headers), interceptor: nil).responseDecodable(of: LoginResponseModel.self ) { response in
  97 + AF.request(Constants.baseURL + APIRoutes.loginURL.urlString, method: .post, parameters: params, encoding: JSONEncoding.default, interceptor: interceptor).responseDecodable(of: LoginResponseModel.self ) { response in
94 98
95 99 switch response.result {
96 100 case .failure(let error) :
... ... @@ -102,10 +106,10 @@ class AuthService {
102 106 }
103 107
104 108 func logoutRequest(model: LogoutRequestModel, completion: @escaping LogoutWebServiceResponse, fail: @escaping FailedHandler) {
105   - let headers = ["Authorization": "Bearer \(self.networkToken ?? "")"]
  109 + let interceptor = InterQrRequestInterceptor()
106 110 let params = ["device_uuid": model.deviceUUID] as [String: Any]
107 111
108   - AF.request(Constants.baseURL + APIRoutes.logoutURL.urlString, method: .post, parameters: params, encoding: JSONEncoding.default, headers: HTTPHeaders(headers), interceptor: nil).responseDecodable(of: LogoutResponseModel.self ) { response in
  112 + AF.request(Constants.baseURL + APIRoutes.logoutURL.urlString, method: .post, parameters: params, encoding: JSONEncoding.default, interceptor: interceptor).responseDecodable(of: LogoutResponseModel.self ) { response in
109 113
110 114 if let error = response.error {
111 115 fail(error)
... ... @@ -117,3 +121,16 @@ class AuthService {
117 121 }
118 122 }
119 123 }
  124 +
  125 +class InterQrRequestInterceptor: RequestInterceptor {
  126 + func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {
  127 + var urlRequest = urlRequest
  128 +// let headers = ["Authorization": "Bearer \(self.networkToken ?? "")"]
  129 +// let params = ["device_uuid": model.deviceUUID] as [String: Any]
  130 + if let token = AuthService.shared.networkToken {
  131 + urlRequest.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
  132 + }
  133 +// if let deviceUUID =
  134 + completion(.success(urlRequest))
  135 + }
  136 +}
... ...
... ... @@ -11,11 +11,8 @@ import ContactsUI
11 11 class AddResidentsViewController: UIViewController {
12 12 var isKeyboardAppear = false
13 13
14   - weak var delegate: ResidentSavable?
15   -
16   - var contact = ContactPickerViewController()
17 14 var mainView = AddResidentsView()
18   -
  15 + weak var delegate: ResidentSavable?
19 16 var closeTap: UITapGestureRecognizer?
20 17
21 18 override func loadView() {
... ...
... ... @@ -41,7 +41,6 @@ extension HomeViewController: UITableViewDelegate, UITableViewDataSource {
41 41
42 42 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
43 43 guard let cell = tableView.dequeueReusableCell(withIdentifier: HomeTableViewCell.id, for: indexPath) as? HomeTableViewCell else { return UITableViewCell() }
44   -// cell.configureWithItem(doors[indexPath.row])
45 44 return cell
46 45 }
47 46
... ...
... ... @@ -80,7 +80,6 @@ class CodeVerificationView: UIView {
80 80 let spinner: UIActivityIndicatorView = {
81 81 var obj = UIActivityIndicatorView(style: .large)
82 82 obj.hidesWhenStopped = true
83   -
84 83 return obj
85 84 }()
86 85
... ...
... ... @@ -9,9 +9,8 @@ import UIKit
9 9
10 10 class CodeVerificationViewController: UIViewController {
11 11 var isKeyboardAppear = false
12   -
  12 + var verifyMessage: String?
13 13 private let mainView = CodeVerificationView()
14   - private let networkManager = AuthService()
15 14
16 15 override func loadView() {
17 16 view = mainView
... ... @@ -23,7 +22,7 @@ class CodeVerificationViewController: UIViewController {
23 22
24 23 private func initViewController() {
25 24 mainView.otpView.delegate = self
26   - mainView.backButton.addTarget(self, action: #selector(didDismissVC), for: .touchUpInside)
  25 + mainView.backButton.addTarget(self, action: #selector(didTapBackButton), for: .touchUpInside)
27 26 mainView.verifyButton.addTarget(self, action: #selector(didTapVerifyButton), for: .touchUpInside)
28 27
29 28 NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil)
... ... @@ -35,36 +34,40 @@ class CodeVerificationViewController: UIViewController {
35 34 NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)
36 35 }
37 36
38   - func networkingVerify() {
39   - guard let verifyModel = verifyModelFilling() else { return }
40   - AuthService.share.verifyRequest(model: verifyModel) { response in
  37 + func verificationRequestProcessing() {
  38 + self.mainView.spinner.startAnimating()
  39 + guard let verifyModel = getVerifyModel() else { return }
  40 + AuthService.shared.verifyRequest(model: verifyModel) { response in
41 41 print("3️⃣✅\(response.data)")
42 42 print("\(response.message)✅")
43   - self.networkingLogin()
44   - self.mainView.spinner.startAnimating()
  43 + self.loginRequestProcessing()
45 44 } fail: { error in
  45 + self.mainView.spinner.stopAnimating()
46 46 print("3️⃣\(error)")
47 47 self.errorProcessing()
48 48 }
49 49 }
50 50
51   - func networkingLogin() {
52   - guard let loginModel = loginModelFilling() else { return }
53   - AuthService.share.loginRequest(model: loginModel) { response in
  51 + func loginRequestProcessing() {
  52 + guard let loginModel = getLoginModel() else { return }
  53 + AuthService.shared.loginRequest(model: loginModel) { response in
54 54 print("4️⃣\(String(describing: response.message))4️⃣")
55   - self.errorProcessing()
  55 + self.verifyMessage = response.message
  56 + self.loginDataProcessing()
56 57 } fail: { error in
  58 + self.mainView.spinner.stopAnimating()
  59 + self.errorProcessing()
57 60 print("4️⃣⛔️\(error)⛔️")
58 61 }
59 62 }
60 63
61   - func verifyModelFilling() -> VerifyRequestModel? {
  64 + func getVerifyModel() -> VerifyRequestModel? {
62 65 let email = "test@interqr.com"
63 66 guard let code = mainView.otpView.code else { return nil }
64 67 return VerifyRequestModel(emailOrNumber: email, code: code, secondAuthToken: "asdas")
65 68 }
66 69
67   - func loginModelFilling() -> LoginRequestModel? {
  70 + func getLoginModel() -> LoginRequestModel? {
68 71 guard let deviceUUID = UIDevice.current.identifierForVendor?.uuidString else {
69 72 return nil
70 73 }
... ... @@ -74,7 +77,7 @@ class CodeVerificationViewController: UIViewController {
74 77 //MARK: - Targets
75 78 extension CodeVerificationViewController {
76 79 @objc private func didTapVerifyButton() {
77   - networkingVerify()
  80 + verificationRequestProcessing()
78 81 }
79 82
80 83 private func showHomeVC() {
... ... @@ -82,25 +85,36 @@ extension CodeVerificationViewController {
82 85 navigationController?.pushViewController(viewController, animated: true)
83 86 }
84 87
  88 + private func loginDataProcessing() {
  89 + self.mainView.spinner.stopAnimating()
  90 + self.showHomeVC()
  91 + }
  92 +
85 93 private func errorProcessing() {
86 94 guard let code = mainView.otpView.code else { return }
  95 +
87 96 if code.count < 4 {
88 97 let alert = UIAlertController(title: "❌", message: "Enter all fields", preferredStyle: .alert)
89 98 alert.addAction(UIAlertAction(title: "Close", style: .cancel, handler: nil))
90 99 present(alert, animated: true, completion: nil)
  100 + } else if verifyMessage != "OK" {
  101 + let alert = UIAlertController(title: "Wrong password", message: "", preferredStyle: .alert)
  102 + alert.addAction(UIAlertAction(title: "Try again", style: .cancel, handler: { action in
  103 + self.mainView.otpView.isError.toggle()
  104 + self.mainView.errorAlertLabel.isHidden = false
  105 + self.mainView.otpView.textField.becomeFirstResponder()
  106 + }))
  107 + present(alert, animated: true, completion: nil)
91 108 } else {
92   - if code != "8327" {
93   - mainView.otpView.isError.toggle()
94   - mainView.errorAlertLabel.isHidden = false
95   - mainView.otpView.textField.becomeFirstResponder()
96   - } else {
97   - self.mainView.spinner.stopAnimating()
98   - self.showHomeVC()
99   - }
  109 + let alert = UIAlertController(title: "Network technical issues", message: "", preferredStyle: .alert)
  110 + alert.addAction(UIAlertAction(title: "Reload", style: .cancel, handler: { action in
  111 + self.didTapBackButton()
  112 + }))
  113 + present(alert, animated: true, completion: nil)
100 114 }
101 115 }
102 116
103   - @objc private func didDismissVC() {
  117 + @objc private func didTapBackButton() {
104 118 navigationController?.popViewController(animated: true)
105 119 }
106 120
... ... @@ -144,11 +158,5 @@ extension CodeVerificationViewController: OTPViewDelegate {
144 158
145 159 func didFullCodeCompletion(_ otpView: OTPView) {
146 160 print("code -> \(String(describing: otpView.code))")
147   - guard let code = otpView.code else { return }
148   - if code.isEmpty {
149   - mainView.otpView.isError.toggle()
150   - otpView.reloadInputViews()
151   - }
152   -
153 161 }
154 162 }
... ...
... ... @@ -11,15 +11,12 @@ class ResidentsViewController: UIViewController {
11 11 var mainView = ResidentsView()
12 12 var myData: [ResidentModel] = []
13 13
14   - let networkManager = AuthService()
15   -
16 14 override func loadView() {
17 15 view = mainView
18 16 }
19 17
20 18 override func viewDidLoad() {
21 19 initViewController()
22   - initDevice()
23 20 }
24 21
25 22 func initViewController() {
... ... @@ -31,32 +28,6 @@ class ResidentsViewController: UIViewController {
31 28 mainView.addResidentsButton.addTarget(self, action: #selector(willShowAddResidentVC), for: .touchUpInside)
32 29 }
33 30
34   - func modelFilling() -> InitRequestModel? {
35   - guard let deviceUUID = UIDevice.current.identifierForVendor?.uuidString else {
36   - return nil
37   - }
38   - guard let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String else {
39   - return nil
40   - }
41   - return InitRequestModel(deviceUUID: deviceUUID,
42   - manufacturer: .Text.apple,
43   - model: UIDevice.current.model,
44   - platform: UIDevice.current.systemName,
45   - osVersion: UIDevice.current.systemVersion,
46   - appVersion: appVersion)
47   - }
48   -
49   - private func initDevice() {
50   - guard let model = modelFilling() else {
51   - return
52   - }
53   - AuthService.share.initRequest(model: model) { result in
54   - print("1️⃣✅\(result.message)✅")
55   - } fail: { error in
56   - print("1️⃣\(error)")
57   - }
58   - }
59   -
60 31 @objc private func didShowChooseApartVC() {
61 32 navigationController?.popViewController(animated: true)
62 33 }
... ... @@ -111,14 +82,6 @@ extension ResidentsViewController: ResidentTableViewCellDelegate {
111 82 mainView.tableView.reloadData()
112 83 }
113 84
114   -// func didButtonsTapped(_ button: UIButton) {
115   -// if !button.isSelected {
116   -// button.isSelected = true
117   -// } else {
118   -// button.isSelected = false
119   -// }
120   -// }
121   -
122 85 func didManagerButtonTapped(cell: ResidentTableViewCell) {
123 86 if !cell.managerButton.isSelected {
124 87 cell.managerButton.isSelected = true
... ...
... ... @@ -8,9 +8,8 @@
8 8 import UIKit
9 9
10 10 class SettingsViewController: UIViewController {
11   - var mainView = SettingsView()
12   - var networkManager = AuthService()
13   -
  11 + var logoutMessage: String?
  12 + var mainView = SettingsView()
14 13 let settingsModel = SettingsModel.allCases
15 14
16 15 override func loadView() {
... ... @@ -30,7 +29,7 @@ class SettingsViewController: UIViewController {
30 29 mainView.settingsTableView.registerReusableCell(SettingsTableViewCell.self)
31 30
32 31 mainView.backButton.addTarget(self, action: #selector(didShowHomeVC), for: .touchUpInside)
33   - mainView.logoutButton.addTarget(self, action: #selector(didLogoutAndShowVerificationVC), for: .touchUpInside)
  32 + mainView.logoutButton.addTarget(self, action: #selector(didTapLogoutButton), for: .touchUpInside)
34 33 }
35 34 }
36 35 //MARK: - Delegate
... ... @@ -39,27 +38,50 @@ extension SettingsViewController {
39 38 navigationController?.popViewController(animated: true)
40 39 }
41 40
42   - @objc private func didLogoutAndShowVerificationVC() {
43   - networking()
44   - let vc = VerificationViewController()
45   - navigationController?.pushViewController(vc, animated: true)
  41 + @objc private func didTapLogoutButton() {
  42 + logoutRequestProcessing()
  43 +
46 44 }
47 45
48   - func networking() {
49   - guard let logoutModel = logoutModelFilling() else { return }
50   - AuthService.share.logoutRequest(model: logoutModel) { response in
  46 + func logoutRequestProcessing() {
  47 + guard let logoutModel = getLogoutModel() else { return }
  48 + AuthService.shared.logoutRequest(model: logoutModel) { response in
  49 + self.logoutMessage = response.message
  50 + self.logoutDataProcessing()
51 51 print("5️⃣❇️\(response.message ?? "Data not received!")❇️")
52 52 } fail: { error in
  53 + self.logoutErrorProcessing()
53 54 print("5️⃣❗️\(error)❗️")
54 55 }
55 56 }
56 57
57   - func logoutModelFilling() -> LogoutRequestModel? {
  58 + func getLogoutModel() -> LogoutRequestModel? {
58 59 guard let deviceUUID = UIDevice.current.identifierForVendor?.uuidString else {
59 60 return nil
60 61 }
61 62 return LogoutRequestModel(deviceUUID: deviceUUID)
62 63 }
  64 +
  65 + private func logoutDataProcessing() {
  66 + let alert = UIAlertController(title: "Do you really want to logout?", message: "", preferredStyle: .alert)
  67 + alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: { action in
  68 + let vc = VerificationViewController()
  69 + self.navigationController?.pushViewController(vc, animated: true)
  70 + }))
  71 + alert.addAction(UIAlertAction(title: "No", style: .cancel, handler: nil))
  72 + present(alert, animated: true, completion: nil)
  73 + }
  74 +
  75 + private func logoutErrorProcessing() {
  76 + if logoutMessage != "OK" {
  77 + let alert = UIAlertController(title: "Some network problems", message: "", preferredStyle: .alert)
  78 + alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
  79 + present(alert, animated: true, completion: nil)
  80 + } else {
  81 + let vc = VerificationViewController()
  82 + self.navigationController?.pushViewController(vc, animated: true)
  83 + }
  84 + }
63 85 }
64 86
65 87 //MARK: tableView delegate and datasource
... ...
... ... @@ -32,7 +32,7 @@ class VerificationView: UIView {
32 32 var label = UILabel()
33 33 label.text = .Text.letsVerifyYourAccount
34 34 label.numberOfLines = 2
35   - label.font = .skModernist(type: .regular, ofSize: 38)
  35 + label.font = .skModernist(type: .regular, ofSize: 28)
36 36 return label
37 37 }()
38 38
... ...
... ... @@ -8,8 +8,8 @@
8 8 import UIKit
9 9
10 10 class VerificationViewController: UIViewController {
11   - var networkManager = AuthService()
12 11 var isKeyboardAppear = false
  12 + var startMessage: String?
13 13 private let mainView = VerificationView()
14 14 var closeTap: UITapGestureRecognizer?
15 15
... ... @@ -57,13 +57,69 @@ class VerificationViewController: UIViewController {
57 57 NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil)
58 58 }
59 59
60   - func networking() {
  60 + private func initDevice() {
  61 + guard let model = getInitModel() else {
  62 + return
  63 + }
  64 + AuthService.shared.initRequest(model: model) { result in
  65 + print("1️⃣✅\(result.message)✅")
  66 + self.startRequestProcessing()
  67 + } fail: { error in
  68 + print("1️⃣\(error)")
  69 + let alert = UIAlertController(title: "Error", message: "", preferredStyle: .alert)
  70 + alert.addAction(UIAlertAction(title: "Cancel", style: .default, handler: nil))
  71 + self.present(alert, animated: true, completion: nil)
  72 + }
  73 + }
  74 +
  75 + func getInitModel() -> InitRequestModel? {
  76 + guard let deviceUUID = UIDevice.current.identifierForVendor?.uuidString else {
  77 + return nil
  78 + }
  79 + guard let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String else {
  80 + return nil
  81 + }
  82 + return InitRequestModel(deviceUUID: deviceUUID,
  83 + manufacturer: .Text.apple,
  84 + model: UIDevice.current.model,
  85 + platform: UIDevice.current.systemName,
  86 + osVersion: UIDevice.current.systemVersion,
  87 + appVersion: appVersion)
  88 + }
  89 +
  90 + private func startRequestProcessing() {
61 91 guard let startModel = startModelFilling() else { return }
62   - AuthService.share.startRequest(model: startModel) { response in
  92 + AuthService.shared.startRequest(model: startModel) { response in
  93 + self.startMessage = response.message
63 94 print("2️⃣✅\(response.message)✅")
  95 + self.didShowCodeVerificationVC()
64 96 } fail: { error in
65 97 print("2️⃣❌\(error)❌")
  98 + self.errorProcessing()
  99 + }
  100 + }
  101 +
  102 + func didShowCodeVerificationVC() {
  103 + if startMessage == "SMS successfully sent" {
  104 + let viewController = CodeVerificationViewController()
  105 + viewController.navigationItem.hidesBackButton = true
  106 + navigationController?.pushViewController(viewController, animated: true)
  107 + } else {
  108 + userDoesNotExistNotice()
66 109 }
  110 +
  111 + }
  112 +
  113 + private func userDoesNotExistNotice() {
  114 + let alert = UIAlertController(title: "User does not exist", message: "Try again", preferredStyle: .alert)
  115 + alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
  116 + present(alert, animated: true)
  117 + }
  118 +
  119 + private func errorProcessing() {
  120 + let alert = UIAlertController(title: "Network error", message: "Try again later", preferredStyle: .alert)
  121 + alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: nil))
  122 + present(alert, animated: true)
67 123 }
68 124
69 125 func startModelFilling() -> StartRequestModel? {
... ... @@ -76,7 +132,7 @@ class VerificationViewController: UIViewController {
76 132 }
77 133 }
78 134
79   - func addDoneButtonOnKeyboard() {
  135 + private func addDoneButtonOnKeyboard() {
80 136 let doneToolbar: UIToolbar = UIToolbar(frame: CGRect.init(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 50))
81 137 doneToolbar.barStyle = .default
82 138
... ... @@ -90,9 +146,8 @@ class VerificationViewController: UIViewController {
90 146 mainView.phoneTextField.inputAccessoryView = doneToolbar
91 147 }
92 148
93   - @objc func doneButtonAction(){
  149 + @objc private func doneButtonAction(){
94 150 mainView.phoneTextField.resignFirstResponder()
95   - didShowCodeVerificationVC()
96 151 }
97 152 }
98 153
... ... @@ -109,10 +164,12 @@ extension VerificationViewController {
109 164 sender.isSelected = true
110 165 mainView.phoneNumberButton.isSelected = false
111 166 mainView.handleUI(true)
  167 + mainView.phoneTextField.resignFirstResponder()
112 168 case mainView.phoneNumberButton:
113 169 sender.isSelected = true
114 170 mainView.emailButton.isSelected = false
115 171 mainView.handleUI(false)
  172 + mainView.emailTextField.resignFirstResponder()
116 173 default:
117 174 return
118 175 }
... ... @@ -124,28 +181,19 @@ extension VerificationViewController {
124 181 }
125 182
126 183 @objc private func didTapContinueButton() {
127   - didShowCodeVerificationVC()
  184 + validatingTheLoginField()
128 185 }
129 186
130   - private func didShowCodeVerificationVC() {
  187 + private func validatingTheLoginField() {
131 188 guard let email = mainView.emailTextField.text else { return }
132 189 guard let number = mainView.phoneTextField.text else { return }
133   - let userCode: String = .Text.userCode
  190 +
134 191 if email.isEmpty || number.isEmpty{
135 192 let alert = UIAlertController(title: "Enter email or number fields", message: "", preferredStyle: .alert)
136 193 alert.addAction(UIAlertAction(title: "Ok", style: .cancel, handler: nil))
137 194 present(alert, animated: true)
138   - } else { if email == userCode || number == userCode {
139   - let vc = CodeVerificationViewController()
140   - vc.navigationItem.hidesBackButton = true
141   - navigationController?.pushViewController(vc, animated: true)
142   - networking()
143   - } else { if email != userCode || number != userCode {
144   - let alert = UIAlertController(title: "User does not exist", message: "", preferredStyle: .alert)
145   - alert.addAction(UIAlertAction(title: "Ok", style: .cancel, handler: nil))
146   - present(alert, animated: true)
147   - }
148   - }
  195 + } else {
  196 + initDevice()
149 197 }
150 198 }
151 199
... ...
Please register or login to post a comment