Showing
9 changed files
with
84 additions
and
60 deletions
| ... | ... | @@ -7,7 +7,6 @@ |
| 7 | 7 | objects = { |
| 8 | 8 | |
| 9 | 9 | /* Begin PBXBuildFile section */ |
| 10 | - 008858E128786A5B00B23E08 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 008858DF28786A5B00B23E08 /* Localizable.strings */; }; | |
| 11 | 10 | 00A48B62285F8CDD00EF0A08 /* CodeVerificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A48B5F285F8CDD00EF0A08 /* CodeVerificationView.swift */; }; |
| 12 | 11 | 00A48B63285F8CDD00EF0A08 /* CodeVerificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A48B61285F8CDD00EF0A08 /* CodeVerificationViewController.swift */; }; |
| 13 | 12 | 00A48B6A285F8CEA00EF0A08 /* AddResidentsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A48B66285F8CEA00EF0A08 /* AddResidentsView.swift */; }; |
| ... | ... | @@ -21,6 +20,7 @@ |
| 21 | 20 | 00A48B7B285F8F6600EF0A08 /* ProtocolDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A48B79285F8F6600EF0A08 /* ProtocolDelegate.swift */; }; |
| 22 | 21 | 00A48B7F285F8F9200EF0A08 /* ContactPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A48B7E285F8F9200EF0A08 /* ContactPickerViewController.swift */; }; |
| 23 | 22 | 00E581BB284F71CD00E779FB /* Checkbox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00E581BA284F71CD00E779FB /* Checkbox.swift */; }; |
| 23 | + 170E2C45287C434500296FC9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 170E2C44287C434500296FC9 /* Localizable.strings */; }; | |
| 24 | 24 | 1721AEF028704E3100EC4FDB /* Strings + Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1721AEEF28704E3100EC4FDB /* Strings + Extension.swift */; }; |
| 25 | 25 | 1721AEF228705FD600EC4FDB /* OTPView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1721AEF128705FD600EC4FDB /* OTPView.swift */; }; |
| 26 | 26 | 17287C602848AD8D00AA7113 /* Fonts + Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17287C5F2848AD8D00AA7113 /* Fonts + Extension.swift */; }; |
| ... | ... | @@ -59,7 +59,6 @@ |
| 59 | 59 | |
| 60 | 60 | /* Begin PBXFileReference section */ |
| 61 | 61 | 008858DC287869A100B23E08 /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/LaunchScreen.strings; sourceTree = "<group>"; }; |
| 62 | - 008858E028786A5B00B23E08 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = "InterQR-Internship/Base.lproj/Localizable.strings"; sourceTree = SOURCE_ROOT; }; | |
| 63 | 62 | 00A48B5F285F8CDD00EF0A08 /* CodeVerificationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeVerificationView.swift; sourceTree = "<group>"; }; |
| 64 | 63 | 00A48B61285F8CDD00EF0A08 /* CodeVerificationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeVerificationViewController.swift; sourceTree = "<group>"; }; |
| 65 | 64 | 00A48B66285F8CEA00EF0A08 /* AddResidentsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddResidentsView.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -73,6 +72,7 @@ |
| 73 | 72 | 00A48B79285F8F6600EF0A08 /* ProtocolDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProtocolDelegate.swift; sourceTree = "<group>"; }; |
| 74 | 73 | 00A48B7E285F8F9200EF0A08 /* ContactPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactPickerViewController.swift; sourceTree = "<group>"; }; |
| 75 | 74 | 00E581BA284F71CD00E779FB /* Checkbox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Checkbox.swift; sourceTree = "<group>"; }; |
| 75 | + 170E2C44287C434500296FC9 /* Localizable.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; }; | |
| 76 | 76 | 1721AEEF28704E3100EC4FDB /* Strings + Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Strings + Extension.swift"; sourceTree = "<group>"; }; |
| 77 | 77 | 1721AEF128705FD600EC4FDB /* OTPView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OTPView.swift; sourceTree = "<group>"; }; |
| 78 | 78 | 17287C5F2848AD8D00AA7113 /* Fonts + Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Fonts + Extension.swift"; sourceTree = "<group>"; }; |
| ... | ... | @@ -527,7 +527,7 @@ |
| 527 | 527 | 17FD60D82848A2CE00957A3A /* Resources */ = { |
| 528 | 528 | isa = PBXGroup; |
| 529 | 529 | children = ( |
| 530 | - 008858DF28786A5B00B23E08 /* Localizable.strings */, | |
| 530 | + 170E2C44287C434500296FC9 /* Localizable.strings */, | |
| 531 | 531 | 17FD60D92848A56900957A3A /* Fonts */, |
| 532 | 532 | ); |
| 533 | 533 | path = Resources; |
| ... | ... | @@ -622,8 +622,8 @@ |
| 622 | 622 | buildActionMask = 2147483647; |
| 623 | 623 | files = ( |
| 624 | 624 | 17CF9EED2844ED90000D8077 /* LaunchScreen.storyboard in Resources */, |
| 625 | - 008858E128786A5B00B23E08 /* Localizable.strings in Resources */, | |
| 626 | 625 | 17287C6D2848C69600AA7113 /* Sk-Modernist-Mono.otf in Resources */, |
| 626 | + 170E2C45287C434500296FC9 /* Localizable.strings in Resources */, | |
| 627 | 627 | 17287C692848C69600AA7113 /* Sk-Modernist-Bold.otf in Resources */, |
| 628 | 628 | 17287C6A2848C69600AA7113 /* Sk-Modernist-Regular.otf in Resources */, |
| 629 | 629 | 17CF9EEA2844ED90000D8077 /* Assets.xcassets in Resources */, |
| ... | ... | @@ -726,14 +726,6 @@ |
| 726 | 726 | /* End PBXSourcesBuildPhase section */ |
| 727 | 727 | |
| 728 | 728 | /* Begin PBXVariantGroup section */ |
| 729 | - 008858DF28786A5B00B23E08 /* Localizable.strings */ = { | |
| 730 | - isa = PBXVariantGroup; | |
| 731 | - children = ( | |
| 732 | - 008858E028786A5B00B23E08 /* Base */, | |
| 733 | - ); | |
| 734 | - name = Localizable.strings; | |
| 735 | - sourceTree = "<group>"; | |
| 736 | - }; | |
| 737 | 729 | 17CF9EEB2844ED90000D8077 /* LaunchScreen.storyboard */ = { |
| 738 | 730 | isa = PBXVariantGroup; |
| 739 | 731 | children = ( |
| ... | ... | @@ -873,7 +865,7 @@ |
| 873 | 865 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 874 | 866 | CODE_SIGN_STYLE = Automatic; |
| 875 | 867 | CURRENT_PROJECT_VERSION = 1; |
| 876 | - DEVELOPMENT_TEAM = 52KCA3JZ59; | |
| 868 | + DEVELOPMENT_TEAM = 4X46JG9W6V; | |
| 877 | 869 | GENERATE_INFOPLIST_FILE = YES; |
| 878 | 870 | INFOPLIST_FILE = "InterQR-Internship/Info.plist"; |
| 879 | 871 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
| ... | ... | @@ -902,7 +894,7 @@ |
| 902 | 894 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
| 903 | 895 | CODE_SIGN_STYLE = Automatic; |
| 904 | 896 | CURRENT_PROJECT_VERSION = 1; |
| 905 | - DEVELOPMENT_TEAM = 52KCA3JZ59; | |
| 897 | + DEVELOPMENT_TEAM = 4X46JG9W6V; | |
| 906 | 898 | GENERATE_INFOPLIST_FILE = YES; |
| 907 | 899 | INFOPLIST_FILE = "InterQR-Internship/Info.plist"; |
| 908 | 900 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; | ... | ... |
| ... | ... | @@ -8,26 +8,29 @@ |
| 8 | 8 | import Foundation |
| 9 | 9 | |
| 10 | 10 | struct Constants { |
| 11 | - enum APIRoutes { | |
| 12 | - case initURL | |
| 13 | - case startURL | |
| 14 | - case verifyURL | |
| 15 | - case loginURL | |
| 16 | - case logoutURL | |
| 11 | + static let baseURL = "https://www.interqr.com" | |
| 12 | +} | |
| 13 | + | |
| 14 | +enum APIRoutes { | |
| 15 | + case initURL | |
| 16 | + case startURL | |
| 17 | + case verifyURL | |
| 18 | + case loginURL | |
| 19 | + case logoutURL | |
| 20 | + | |
| 21 | + var urlString: String { | |
| 22 | + switch self { | |
| 17 | 23 | |
| 18 | - var urlString: String { | |
| 19 | - switch self { | |
| 20 | - case .initURL: | |
| 21 | - return "https://www.interqr.com/api/init" | |
| 22 | - case .startURL: | |
| 23 | - return "https://www.interqr.com/api/twofa/start" | |
| 24 | - case .verifyURL: | |
| 25 | - return "https://www.interqr.com/api/twofa/verify" | |
| 26 | - case .loginURL: | |
| 27 | - return "https://www.interqr.com/api/login" | |
| 28 | - case .logoutURL: | |
| 29 | - return "https://www.interqr.com/api/logout" | |
| 30 | - } | |
| 24 | + case .initURL: | |
| 25 | + return "/api/init" | |
| 26 | + case .startURL: | |
| 27 | + return "/api/twofa/start" | |
| 28 | + case .verifyURL: | |
| 29 | + return "/api/twofa/verify" | |
| 30 | + case .loginURL: | |
| 31 | + return "/api/login" | |
| 32 | + case .logoutURL: | |
| 33 | + return "/api/logout" | |
| 31 | 34 | } |
| 32 | 35 | } |
| 33 | 36 | } | ... | ... |
InterQR-Internship/Modules/OneTimePasswordScreen/ViewController/CodeVerificationViewController.swift
| ... | ... | @@ -37,7 +37,7 @@ class CodeVerificationViewController: UIViewController { |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | func networkingVerify() { |
| 40 | - guard let verifyUrl = URL(string: Constants.APIRoutes.verifyURL.urlString) else { return } | |
| 40 | + guard let verifyUrl = URL(string: APIRoutes.verifyURL.urlString) else { return } | |
| 41 | 41 | let verifyModel = verifyModelFilling() |
| 42 | 42 | AuthNetworkManager.share.verifyRequest(verifyUrl, model: verifyModel!) { response in |
| 43 | 43 | print("3️⃣✅\(response.data)") |
| ... | ... | @@ -50,7 +50,7 @@ class CodeVerificationViewController: UIViewController { |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | func networkingLogin() { |
| 53 | - guard let loginUrl = URL(string: Constants.APIRoutes.loginURL.urlString) else { return } | |
| 53 | + guard let loginUrl = URL(string: APIRoutes.loginURL.urlString) else { return } | |
| 54 | 54 | guard let loginModel = loginModelFilling() else { return } |
| 55 | 55 | |
| 56 | 56 | self.networkManager.loginRequest(loginUrl, model: loginModel) { response in | ... | ... |
| ... | ... | @@ -12,7 +12,6 @@ protocol ResidentTableViewCellDelegate: AnyObject { |
| 12 | 12 | func didManagerButtonTapped(cell: ResidentTableViewCell) |
| 13 | 13 | func didHiddenButtonTapped(cell: ResidentTableViewCell) |
| 14 | 14 | func didHeardButtonTapped(cell: ResidentTableViewCell) |
| 15 | - | |
| 16 | 15 | } |
| 17 | 16 | |
| 18 | 17 | class ResidentTableViewCell: UITableViewCell { |
| ... | ... | @@ -89,7 +88,7 @@ class ResidentTableViewCell: UITableViewCell { |
| 89 | 88 | }() |
| 90 | 89 | |
| 91 | 90 | var heartButton: UIButton = { |
| 92 | - var obj = UIButton(type: .system) | |
| 91 | + var obj = UIButton() | |
| 93 | 92 | obj.setImage(UIImage(named: .Image.heart), for: .normal) |
| 94 | 93 | obj.setImage(UIImage(named: .Image.heartRed), for: .selected) |
| 95 | 94 | return obj |
| ... | ... | @@ -184,6 +183,9 @@ class ResidentTableViewCell: UITableViewCell { |
| 184 | 183 | } |
| 185 | 184 | |
| 186 | 185 | removeCellButton.addTarget(self, action: #selector(didRemoveButtonTapped(_:)), for: .touchUpInside) |
| 186 | + managerButton.addTarget(self, action: #selector(didButtonsTapped(_:)), for: .touchUpInside) | |
| 187 | + hiddenButton.addTarget(self, action: #selector(didButtonsTapped(_:)), for: .touchUpInside) | |
| 188 | + heartButton.addTarget(self, action: #selector(didButtonsTapped(_:)), for: .touchUpInside) | |
| 187 | 189 | } |
| 188 | 190 | |
| 189 | 191 | override func layoutSubviews() { |
| ... | ... | @@ -198,4 +200,10 @@ extension ResidentTableViewCell { |
| 198 | 200 | @objc private func didRemoveButtonTapped(_ sender: UIButton) { |
| 199 | 201 | delegate?.didRemoveButtonTapped(cell: self) |
| 200 | 202 | } |
| 203 | + | |
| 204 | + @objc private func didButtonsTapped(_ sender: UIButton) { | |
| 205 | + delegate?.didManagerButtonTapped(cell: self) | |
| 206 | + delegate?.didHiddenButtonTapped(cell: self) | |
| 207 | + delegate?.didHeardButtonTapped(cell: self) | |
| 208 | + } | |
| 201 | 209 | } | ... | ... |
| ... | ... | @@ -47,9 +47,9 @@ class ResidentsViewController: UIViewController { |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | func networking() { |
| 50 | - guard let initUrl = URL(string: Constants.APIRoutes.initURL.urlString) else { return } | |
| 50 | + guard let initUrl = URL(string: APIRoutes.initURL.urlString) else { return } | |
| 51 | 51 | guard let model = modelFilling() else { return } |
| 52 | - networkManager.initRequest(initUrl, model: model) { responseModel in | |
| 52 | + networkManager.initRequest(initUrl, completion: (InitResponseModel) -> Void, model: model) { responseModel in | |
| 53 | 53 | print("1️⃣✅\(responseModel.message)✅") |
| 54 | 54 | } fail: { error in |
| 55 | 55 | print("1️⃣\(error)") |
| ... | ... | @@ -84,19 +84,19 @@ extension ResidentsViewController: UITableViewDelegate, UITableViewDataSource { |
| 84 | 84 | return cell |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - @objc private func removeCell(_ sender: UIButton) { | |
| 88 | - myData.remove(at: sender.tag) | |
| 89 | - mainView.tableView.deleteRows(at: [IndexPath(row: sender.tag, section: 0)], with: .fade) | |
| 90 | - mainView.tableView.reloadData() | |
| 91 | - } | |
| 87 | +// @objc private func removeCell(_ sender: UIButton) { | |
| 88 | +// myData.remove(at: sender.tag) | |
| 89 | +// mainView.tableView.deleteRows(at: [IndexPath(row: sender.tag, section: 0)], with: .fade) | |
| 90 | +// mainView.tableView.reloadData() | |
| 91 | +// } | |
| 92 | 92 | |
| 93 | - @objc private func didTapManagerButton(_ sender: UIButton) { | |
| 94 | - if !sender.isSelected { | |
| 95 | - sender.isSelected = true | |
| 96 | - } else { | |
| 97 | - sender.isSelected = false | |
| 98 | - } | |
| 99 | - } | |
| 93 | +// @objc private func didTapManagerButton(_ sender: UIButton) { | |
| 94 | +// if !sender.isSelected { | |
| 95 | +// sender.isSelected = true | |
| 96 | +// } else { | |
| 97 | +// sender.isSelected = false | |
| 98 | +// } | |
| 99 | +// } | |
| 100 | 100 | } |
| 101 | 101 | //MARK: - ResidentSavable delegate |
| 102 | 102 | extension ResidentsViewController: ResidentSavable { |
| ... | ... | @@ -116,17 +116,31 @@ extension ResidentsViewController: ResidentTableViewCellDelegate { |
| 116 | 116 | mainView.tableView.reloadData() |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | + func didButtonsTapped(_ sender: UIButton) { | |
| 120 | + | |
| 121 | + } | |
| 122 | + | |
| 119 | 123 | func didManagerButtonTapped(cell: ResidentTableViewCell) { |
| 120 | - print("") | |
| 124 | + if !cell.managerButton.isSelected { | |
| 125 | + cell.managerButton.isSelected = true | |
| 126 | + } else { | |
| 127 | + cell.managerButton.isSelected = false | |
| 128 | + } | |
| 121 | 129 | } |
| 122 | 130 | |
| 123 | 131 | func didHiddenButtonTapped(cell: ResidentTableViewCell) { |
| 124 | - print("") | |
| 132 | + if !cell.hiddenButton.isSelected { | |
| 133 | + cell.hiddenButton.isSelected = true | |
| 134 | + } else { | |
| 135 | + cell.hiddenButton.isSelected = false | |
| 136 | + } | |
| 125 | 137 | } |
| 126 | 138 | |
| 127 | 139 | func didHeardButtonTapped(cell: ResidentTableViewCell) { |
| 128 | - print("") | |
| 140 | + if !cell.heartButton.isSelected { | |
| 141 | + cell.heartButton.isSelected = true | |
| 142 | + } else { | |
| 143 | + cell.heartButton.isSelected = false | |
| 144 | + } | |
| 129 | 145 | } |
| 130 | - | |
| 131 | - | |
| 132 | 146 | } | ... | ... |
| ... | ... | @@ -46,7 +46,7 @@ extension SettingsViewController { |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | func networking() { |
| 49 | - guard let logoutUrl = URL(string: Constants.APIRoutes.logoutURL.urlString) else { return } | |
| 49 | + guard let logoutUrl = URL(string: APIRoutes.logoutURL.urlString) else { return } | |
| 50 | 50 | guard let logoutModel = logoutModelFilling() else { return } |
| 51 | 51 | networkManager.logoutRequest(logoutUrl, model: logoutModel) { response in |
| 52 | 52 | print("5️⃣❇️\(response.message ?? "Data not received!")❇️") | ... | ... |
| ... | ... | @@ -52,7 +52,7 @@ class VerificationViewController: UIViewController { |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | func networking() { |
| 55 | - guard let startUrl = URL(string: Constants.APIRoutes.startURL.urlString) else { return } | |
| 55 | + guard let startUrl = URL(string: APIRoutes.startURL.urlString) else { return } | |
| 56 | 56 | guard let startModel = startModelFilling() else { return } |
| 57 | 57 | networkManager.startRequest(startUrl, model: startModel) { response in |
| 58 | 58 | print("2️⃣✅\(response.message)✅") | ... | ... |
| ... | ... | @@ -31,7 +31,7 @@ class AuthNetworkManager { |
| 31 | 31 | |
| 32 | 32 | typealias FailedHandler = (Error) -> Void |
| 33 | 33 | |
| 34 | - func initRequest(_ url: URL, model: InitRequestModel, completion: @escaping InitWebServiceResponse, fail: @escaping FailedHandler) { | |
| 34 | + func initRequest(_ model: InitRequestModel, completion: @escaping (InitResponseModel) -> Void, fail: @escaping FailedHandler) { | |
| 35 | 35 | |
| 36 | 36 | let params = ["device_uuid": model.deviceUUID, |
| 37 | 37 | "manufacturer": model.manufacturer, |
| ... | ... | @@ -40,7 +40,7 @@ class AuthNetworkManager { |
| 40 | 40 | "os_version": model.osVersion, |
| 41 | 41 | "app_version": model.appVersion] as [String: Any] |
| 42 | 42 | |
| 43 | - AF.request(url, method: .post, parameters: params, encoding: JSONEncoding.default).responseDecodable(of: InitResponseModel.self ) { response in | |
| 43 | + AF.request(Constants.baseURL + APIRoutes.initURL.urlString, method: .post, parameters: params, encoding: JSONEncoding.default).responseDecodable(of: InitResponseModel.self ) { response in | |
| 44 | 44 | |
| 45 | 45 | if let error = response.error { |
| 46 | 46 | fail(error) | ... | ... |
Please
register
or
login
to post a comment