Showing
7 changed files
with
27 additions
and
29 deletions
@@ -35,7 +35,7 @@ | @@ -35,7 +35,7 @@ | ||
35 | 1738F7DA2850F5F1003F1806 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1738F7D92850F5F1003F1806 /* SettingsView.swift */; }; | 35 | 1738F7DA2850F5F1003F1806 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1738F7D92850F5F1003F1806 /* SettingsView.swift */; }; |
36 | 175DA474285241C90075F0A9 /* SettingsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 175DA473285241C90075F0A9 /* SettingsModel.swift */; }; | 36 | 175DA474285241C90075F0A9 /* SettingsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 175DA473285241C90075F0A9 /* SettingsModel.swift */; }; |
37 | 1763F7FC2861FFFD005D988C /* ResidentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1763F7FB2861FFFD005D988C /* ResidentTableViewCell.swift */; }; | 37 | 1763F7FC2861FFFD005D988C /* ResidentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1763F7FB2861FFFD005D988C /* ResidentTableViewCell.swift */; }; |
38 | - 1764A05C28670B9F00847A30 /* AuthNetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1764A05B28670B9F00847A30 /* AuthNetworkManager.swift */; }; | 38 | + 1764A05C28670B9F00847A30 /* AuthService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1764A05B28670B9F00847A30 /* AuthService.swift */; }; |
39 | 1764A05E28673C7F00847A30 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1764A05D28673C7F00847A30 /* Constants.swift */; }; | 39 | 1764A05E28673C7F00847A30 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1764A05D28673C7F00847A30 /* Constants.swift */; }; |
40 | 1774213D2866EE13002730EE /* AuthModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1774213C2866EE13002730EE /* AuthModel.swift */; }; | 40 | 1774213D2866EE13002730EE /* AuthModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1774213C2866EE13002730EE /* AuthModel.swift */; }; |
41 | 17ABE070285B80DC0006E7EC /* DisplayNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17ABE06F285B80DC0006E7EC /* DisplayNameCell.swift */; }; | 41 | 17ABE070285B80DC0006E7EC /* DisplayNameCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17ABE06F285B80DC0006E7EC /* DisplayNameCell.swift */; }; |
@@ -87,7 +87,7 @@ | @@ -87,7 +87,7 @@ | ||
87 | 1738F7D92850F5F1003F1806 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; }; | 87 | 1738F7D92850F5F1003F1806 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; }; |
88 | 175DA473285241C90075F0A9 /* SettingsModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsModel.swift; sourceTree = "<group>"; }; | 88 | 175DA473285241C90075F0A9 /* SettingsModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsModel.swift; sourceTree = "<group>"; }; |
89 | 1763F7FB2861FFFD005D988C /* ResidentTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResidentTableViewCell.swift; sourceTree = "<group>"; }; | 89 | 1763F7FB2861FFFD005D988C /* ResidentTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResidentTableViewCell.swift; sourceTree = "<group>"; }; |
90 | - 1764A05B28670B9F00847A30 /* AuthNetworkManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthNetworkManager.swift; sourceTree = "<group>"; }; | 90 | + 1764A05B28670B9F00847A30 /* AuthService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthService.swift; sourceTree = "<group>"; }; |
91 | 1764A05D28673C7F00847A30 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; }; | 91 | 1764A05D28673C7F00847A30 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; }; |
92 | 1774213C2866EE13002730EE /* AuthModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthModel.swift; sourceTree = "<group>"; }; | 92 | 1774213C2866EE13002730EE /* AuthModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthModel.swift; sourceTree = "<group>"; }; |
93 | 17ABE06F285B80DC0006E7EC /* DisplayNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayNameCell.swift; sourceTree = "<group>"; }; | 93 | 17ABE06F285B80DC0006E7EC /* DisplayNameCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayNameCell.swift; sourceTree = "<group>"; }; |
@@ -376,7 +376,7 @@ | @@ -376,7 +376,7 @@ | ||
376 | 1764A05A28670B7200847A30 /* NetworkManager */ = { | 376 | 1764A05A28670B7200847A30 /* NetworkManager */ = { |
377 | isa = PBXGroup; | 377 | isa = PBXGroup; |
378 | children = ( | 378 | children = ( |
379 | - 1764A05B28670B9F00847A30 /* AuthNetworkManager.swift */, | 379 | + 1764A05B28670B9F00847A30 /* AuthService.swift */, |
380 | ); | 380 | ); |
381 | path = NetworkManager; | 381 | path = NetworkManager; |
382 | sourceTree = "<group>"; | 382 | sourceTree = "<group>"; |
@@ -679,7 +679,7 @@ | @@ -679,7 +679,7 @@ | ||
679 | isa = PBXSourcesBuildPhase; | 679 | isa = PBXSourcesBuildPhase; |
680 | buildActionMask = 2147483647; | 680 | buildActionMask = 2147483647; |
681 | files = ( | 681 | files = ( |
682 | - 1764A05C28670B9F00847A30 /* AuthNetworkManager.swift in Sources */, | 682 | + 1764A05C28670B9F00847A30 /* AuthService.swift in Sources */, |
683 | 17ABE070285B80DC0006E7EC /* DisplayNameCell.swift in Sources */, | 683 | 17ABE070285B80DC0006E7EC /* DisplayNameCell.swift in Sources */, |
684 | 00A48B73285F8EB000EF0A08 /* SquereCheckBox.swift in Sources */, | 684 | 00A48B73285F8EB000EF0A08 /* SquereCheckBox.swift in Sources */, |
685 | 1729E22128465DA9006C7C29 /* PhonePickerModel.swift in Sources */, | 685 | 1729E22128465DA9006C7C29 /* PhonePickerModel.swift in Sources */, |
@@ -865,7 +865,7 @@ | @@ -865,7 +865,7 @@ | ||
865 | CODE_SIGN_IDENTITY = "Apple Development"; | 865 | CODE_SIGN_IDENTITY = "Apple Development"; |
866 | CODE_SIGN_STYLE = Automatic; | 866 | CODE_SIGN_STYLE = Automatic; |
867 | CURRENT_PROJECT_VERSION = 1; | 867 | CURRENT_PROJECT_VERSION = 1; |
868 | - DEVELOPMENT_TEAM = 4X46JG9W6V; | 868 | + DEVELOPMENT_TEAM = 52KCA3JZ59; |
869 | GENERATE_INFOPLIST_FILE = YES; | 869 | GENERATE_INFOPLIST_FILE = YES; |
870 | INFOPLIST_FILE = "InterQR-Internship/Info.plist"; | 870 | INFOPLIST_FILE = "InterQR-Internship/Info.plist"; |
871 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; | 871 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
@@ -894,7 +894,7 @@ | @@ -894,7 +894,7 @@ | ||
894 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | 894 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
895 | CODE_SIGN_STYLE = Automatic; | 895 | CODE_SIGN_STYLE = Automatic; |
896 | CURRENT_PROJECT_VERSION = 1; | 896 | CURRENT_PROJECT_VERSION = 1; |
897 | - DEVELOPMENT_TEAM = 4X46JG9W6V; | 897 | + DEVELOPMENT_TEAM = 52KCA3JZ59; |
898 | GENERATE_INFOPLIST_FILE = YES; | 898 | GENERATE_INFOPLIST_FILE = YES; |
899 | INFOPLIST_FILE = "InterQR-Internship/Info.plist"; | 899 | INFOPLIST_FILE = "InterQR-Internship/Info.plist"; |
900 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; | 900 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
@@ -30,8 +30,8 @@ | @@ -30,8 +30,8 @@ | ||
30 | filePath = "InterQR-Internship/Modules/ResidentsScreen/ViewController/ResidentsViewController.swift" | 30 | filePath = "InterQR-Internship/Modules/ResidentsScreen/ViewController/ResidentsViewController.swift" |
31 | startingColumnNumber = "9223372036854775807" | 31 | startingColumnNumber = "9223372036854775807" |
32 | endingColumnNumber = "9223372036854775807" | 32 | endingColumnNumber = "9223372036854775807" |
33 | - startingLineNumber = "115" | ||
34 | - endingLineNumber = "115" | 33 | + startingLineNumber = "116" |
34 | + endingLineNumber = "116" | ||
35 | landmarkName = "didRemoveButtonTapped(cell:)" | 35 | landmarkName = "didRemoveButtonTapped(cell:)" |
36 | landmarkType = "7"> | 36 | landmarkType = "7"> |
37 | </BreakpointContent> | 37 | </BreakpointContent> |
InterQR-Internship/Modules/OneTimePasswordScreen/ViewController/CodeVerificationViewController.swift
@@ -13,7 +13,7 @@ class CodeVerificationViewController: UIViewController { | @@ -13,7 +13,7 @@ class CodeVerificationViewController: UIViewController { | ||
13 | var isKeyboardAppear = false | 13 | var isKeyboardAppear = false |
14 | 14 | ||
15 | private let mainView = CodeVerificationView() | 15 | private let mainView = CodeVerificationView() |
16 | - private let networkManager = AuthNetworkManager() | 16 | + private let networkManager = AuthService() |
17 | override func loadView() { | 17 | override func loadView() { |
18 | view = mainView | 18 | view = mainView |
19 | } | 19 | } |
@@ -39,7 +39,7 @@ class CodeVerificationViewController: UIViewController { | @@ -39,7 +39,7 @@ class CodeVerificationViewController: UIViewController { | ||
39 | func networkingVerify() { | 39 | func networkingVerify() { |
40 | guard let verifyUrl = URL(string: APIRoutes.verifyURL.urlString) else { return } | 40 | guard let verifyUrl = URL(string: APIRoutes.verifyURL.urlString) else { return } |
41 | let verifyModel = verifyModelFilling() | 41 | let verifyModel = verifyModelFilling() |
42 | - AuthNetworkManager.share.verifyRequest(verifyUrl, model: verifyModel!) { response in | 42 | + AuthService.share.verifyRequest(verifyUrl, model: verifyModel!) { response in |
43 | print("3️⃣✅\(response.data)") | 43 | print("3️⃣✅\(response.data)") |
44 | print("\(response.message)✅") | 44 | print("\(response.message)✅") |
45 | self.networkingLogin() | 45 | self.networkingLogin() |
@@ -11,7 +11,7 @@ class ResidentsViewController: UIViewController { | @@ -11,7 +11,7 @@ class ResidentsViewController: UIViewController { | ||
11 | var mainView = ResidentsView() | 11 | var mainView = ResidentsView() |
12 | var myData: [ResidentModel] = [] | 12 | var myData: [ResidentModel] = [] |
13 | 13 | ||
14 | - let networkManager = AuthNetworkManager() | 14 | + let networkManager = AuthService() |
15 | 15 | ||
16 | override func loadView() { | 16 | override func loadView() { |
17 | view = mainView | 17 | view = mainView |
@@ -19,7 +19,7 @@ class ResidentsViewController: UIViewController { | @@ -19,7 +19,7 @@ class ResidentsViewController: UIViewController { | ||
19 | 19 | ||
20 | override func viewDidLoad() { | 20 | override func viewDidLoad() { |
21 | initViewController() | 21 | initViewController() |
22 | - networking() | 22 | + initDevice() |
23 | } | 23 | } |
24 | 24 | ||
25 | func initViewController() { | 25 | func initViewController() { |
@@ -46,11 +46,12 @@ class ResidentsViewController: UIViewController { | @@ -46,11 +46,12 @@ class ResidentsViewController: UIViewController { | ||
46 | appVersion: appVersion) | 46 | appVersion: appVersion) |
47 | } | 47 | } |
48 | 48 | ||
49 | - func networking() { | ||
50 | - guard let initUrl = URL(string: APIRoutes.initURL.urlString) else { return } | ||
51 | - guard let model = modelFilling() else { return } | ||
52 | - networkManager.initRequest(initUrl, completion: (InitResponseModel) -> Void, model: model) { responseModel in | ||
53 | - print("1️⃣✅\(responseModel.message)✅") | 49 | + private func initDevice() { |
50 | + guard let model = modelFilling() else { | ||
51 | + return | ||
52 | + } | ||
53 | + AuthService.share.initRequest(model) { result in | ||
54 | + print("1️⃣✅\(result.message)✅") | ||
54 | } fail: { error in | 55 | } fail: { error in |
55 | print("1️⃣\(error)") | 56 | print("1️⃣\(error)") |
56 | } | 57 | } |
@@ -9,7 +9,7 @@ import UIKit | @@ -9,7 +9,7 @@ import UIKit | ||
9 | 9 | ||
10 | class SettingsViewController: UIViewController { | 10 | class SettingsViewController: UIViewController { |
11 | var mainView = SettingsView() | 11 | var mainView = SettingsView() |
12 | - var networkManager = AuthNetworkManager() | 12 | + var networkManager = AuthService() |
13 | 13 | ||
14 | let settingsModel = SettingsModel.allCases | 14 | let settingsModel = SettingsModel.allCases |
15 | 15 |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | import UIKit | 8 | import UIKit |
9 | 9 | ||
10 | class VerificationViewController: UIViewController { | 10 | class VerificationViewController: UIViewController { |
11 | - var networkManager = AuthNetworkManager() | 11 | + var networkManager = AuthService() |
12 | var isKeyboardAppear = false | 12 | var isKeyboardAppear = false |
13 | private let mainView = VerificationView() | 13 | private let mainView = VerificationView() |
14 | 14 |
@@ -8,9 +8,9 @@ | @@ -8,9 +8,9 @@ | ||
8 | import Foundation | 8 | import Foundation |
9 | import Alamofire | 9 | import Alamofire |
10 | 10 | ||
11 | -class AuthNetworkManager { | 11 | +class AuthService { |
12 | 12 | ||
13 | - static let share = AuthNetworkManager() | 13 | + static let share = AuthService() |
14 | 14 | ||
15 | var networkToken: String? { | 15 | var networkToken: String? { |
16 | get { | 16 | get { |
@@ -28,10 +28,9 @@ class AuthNetworkManager { | @@ -28,10 +28,9 @@ class AuthNetworkManager { | ||
28 | typealias VerifyWebServiceResponse = (VerifyResponseModel) -> Void | 28 | typealias VerifyWebServiceResponse = (VerifyResponseModel) -> Void |
29 | typealias LoginWebServiceResponse = (LoginResponseModel) -> Void | 29 | typealias LoginWebServiceResponse = (LoginResponseModel) -> Void |
30 | typealias LogoutWebServiceResponse = (LogoutResponseModel) -> Void | 30 | typealias LogoutWebServiceResponse = (LogoutResponseModel) -> Void |
31 | - | ||
32 | typealias FailedHandler = (Error) -> Void | 31 | typealias FailedHandler = (Error) -> Void |
33 | 32 | ||
34 | - func initRequest(_ model: InitRequestModel, completion: @escaping (InitResponseModel) -> Void, fail: @escaping FailedHandler) { | 33 | + func initRequest(_ model: InitRequestModel, success: @escaping InitWebServiceResponse, fail: @escaping FailedHandler) { |
35 | 34 | ||
36 | let params = ["device_uuid": model.deviceUUID, | 35 | let params = ["device_uuid": model.deviceUUID, |
37 | "manufacturer": model.manufacturer, | 36 | "manufacturer": model.manufacturer, |
@@ -41,13 +40,11 @@ class AuthNetworkManager { | @@ -41,13 +40,11 @@ class AuthNetworkManager { | ||
41 | "app_version": model.appVersion] as [String: Any] | 40 | "app_version": model.appVersion] as [String: Any] |
42 | 41 | ||
43 | AF.request(Constants.baseURL + APIRoutes.initURL.urlString, method: .post, parameters: params, encoding: JSONEncoding.default).responseDecodable(of: InitResponseModel.self ) { response in | 42 | AF.request(Constants.baseURL + APIRoutes.initURL.urlString, method: .post, parameters: params, encoding: JSONEncoding.default).responseDecodable(of: InitResponseModel.self ) { response in |
44 | - | ||
45 | - if let error = response.error { | 43 | + switch response.result { |
44 | + case .failure(let error) : | ||
46 | fail(error) | 45 | fail(error) |
47 | - } else { | ||
48 | - if let res = response.value { | ||
49 | - completion(res) | ||
50 | - } | 46 | + case .success(let res) : |
47 | + success(res) | ||
51 | } | 48 | } |
52 | } | 49 | } |
53 | } | 50 | } |
Please
register
or
login
to post a comment