Commit 42242b55a5a374823c4ae5c90f12d70bc2a6dae1

Authored by vlad.lopatynets
1 parent 60397c80

+++

@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 objects = { 7 objects = {
8 8
9 /* Begin PBXBuildFile section */ 9 /* Begin PBXBuildFile section */
  10 + 008858E128786A5B00B23E08 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 008858DF28786A5B00B23E08 /* Localizable.strings */; };
10 00A48B62285F8CDD00EF0A08 /* CodeVerificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A48B5F285F8CDD00EF0A08 /* CodeVerificationView.swift */; }; 11 00A48B62285F8CDD00EF0A08 /* CodeVerificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A48B5F285F8CDD00EF0A08 /* CodeVerificationView.swift */; };
11 00A48B63285F8CDD00EF0A08 /* CodeVerificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A48B61285F8CDD00EF0A08 /* CodeVerificationViewController.swift */; }; 12 00A48B63285F8CDD00EF0A08 /* CodeVerificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A48B61285F8CDD00EF0A08 /* CodeVerificationViewController.swift */; };
12 00A48B6A285F8CEA00EF0A08 /* AddResidentsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A48B66285F8CEA00EF0A08 /* AddResidentsView.swift */; }; 13 00A48B6A285F8CEA00EF0A08 /* AddResidentsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00A48B66285F8CEA00EF0A08 /* AddResidentsView.swift */; };
@@ -57,6 +58,8 @@ @@ -57,6 +58,8 @@
57 /* End PBXBuildFile section */ 58 /* End PBXBuildFile section */
58 59
59 /* Begin PBXFileReference section */ 60 /* Begin PBXFileReference section */
  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; };
60 00A48B5F285F8CDD00EF0A08 /* CodeVerificationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeVerificationView.swift; sourceTree = "<group>"; }; 63 00A48B5F285F8CDD00EF0A08 /* CodeVerificationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeVerificationView.swift; sourceTree = "<group>"; };
61 00A48B61285F8CDD00EF0A08 /* CodeVerificationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeVerificationViewController.swift; sourceTree = "<group>"; }; 64 00A48B61285F8CDD00EF0A08 /* CodeVerificationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeVerificationViewController.swift; sourceTree = "<group>"; };
62 00A48B66285F8CEA00EF0A08 /* AddResidentsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddResidentsView.swift; sourceTree = "<group>"; }; 65 00A48B66285F8CEA00EF0A08 /* AddResidentsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AddResidentsView.swift; sourceTree = "<group>"; };
@@ -122,6 +125,14 @@ @@ -122,6 +125,14 @@
122 /* End PBXFrameworksBuildPhase section */ 125 /* End PBXFrameworksBuildPhase section */
123 126
124 /* Begin PBXGroup section */ 127 /* Begin PBXGroup section */
  128 + 008858E228786B5B00B23E08 /* Model */ = {
  129 + isa = PBXGroup;
  130 + children = (
  131 + 00A48B67285F8CEA00EF0A08 /* ResidentModel.swift */,
  132 + );
  133 + path = Model;
  134 + sourceTree = "<group>";
  135 + };
125 00A48B5D285F8CDD00EF0A08 /* OneTimePasswordScreen */ = { 136 00A48B5D285F8CDD00EF0A08 /* OneTimePasswordScreen */ = {
126 isa = PBXGroup; 137 isa = PBXGroup;
127 children = ( 138 children = (
@@ -151,9 +162,9 @@ @@ -151,9 +162,9 @@
151 00A48B64285F8CEA00EF0A08 /* AddResidentsScreen */ = { 162 00A48B64285F8CEA00EF0A08 /* AddResidentsScreen */ = {
152 isa = PBXGroup; 163 isa = PBXGroup;
153 children = ( 164 children = (
  165 + 008858E228786B5B00B23E08 /* Model */,
154 00A48B68285F8CEA00EF0A08 /* ViewController */, 166 00A48B68285F8CEA00EF0A08 /* ViewController */,
155 00A48B65285F8CEA00EF0A08 /* View */, 167 00A48B65285F8CEA00EF0A08 /* View */,
156 - 00A48B67285F8CEA00EF0A08 /* ResidentModel.swift */,  
157 ); 168 );
158 path = AddResidentsScreen; 169 path = AddResidentsScreen;
159 sourceTree = "<group>"; 170 sourceTree = "<group>";
@@ -516,6 +527,7 @@ @@ -516,6 +527,7 @@
516 17FD60D82848A2CE00957A3A /* Resources */ = { 527 17FD60D82848A2CE00957A3A /* Resources */ = {
517 isa = PBXGroup; 528 isa = PBXGroup;
518 children = ( 529 children = (
  530 + 008858DF28786A5B00B23E08 /* Localizable.strings */,
519 17FD60D92848A56900957A3A /* Fonts */, 531 17FD60D92848A56900957A3A /* Fonts */,
520 ); 532 );
521 path = Resources; 533 path = Resources;
@@ -592,6 +604,7 @@ @@ -592,6 +604,7 @@
592 knownRegions = ( 604 knownRegions = (
593 en, 605 en,
594 Base, 606 Base,
  607 + uk,
595 ); 608 );
596 mainGroup = 17CF9ED42844ED8F000D8077; 609 mainGroup = 17CF9ED42844ED8F000D8077;
597 productRefGroup = 17CF9EDE2844ED8F000D8077 /* Products */; 610 productRefGroup = 17CF9EDE2844ED8F000D8077 /* Products */;
@@ -609,6 +622,7 @@ @@ -609,6 +622,7 @@
609 buildActionMask = 2147483647; 622 buildActionMask = 2147483647;
610 files = ( 623 files = (
611 17CF9EED2844ED90000D8077 /* LaunchScreen.storyboard in Resources */, 624 17CF9EED2844ED90000D8077 /* LaunchScreen.storyboard in Resources */,
  625 + 008858E128786A5B00B23E08 /* Localizable.strings in Resources */,
612 17287C6D2848C69600AA7113 /* Sk-Modernist-Mono.otf in Resources */, 626 17287C6D2848C69600AA7113 /* Sk-Modernist-Mono.otf in Resources */,
613 17287C692848C69600AA7113 /* Sk-Modernist-Bold.otf in Resources */, 627 17287C692848C69600AA7113 /* Sk-Modernist-Bold.otf in Resources */,
614 17287C6A2848C69600AA7113 /* Sk-Modernist-Regular.otf in Resources */, 628 17287C6A2848C69600AA7113 /* Sk-Modernist-Regular.otf in Resources */,
@@ -712,10 +726,19 @@ @@ -712,10 +726,19 @@
712 /* End PBXSourcesBuildPhase section */ 726 /* End PBXSourcesBuildPhase section */
713 727
714 /* Begin PBXVariantGroup section */ 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 + };
715 17CF9EEB2844ED90000D8077 /* LaunchScreen.storyboard */ = { 737 17CF9EEB2844ED90000D8077 /* LaunchScreen.storyboard */ = {
716 isa = PBXVariantGroup; 738 isa = PBXVariantGroup;
717 children = ( 739 children = (
718 17CF9EEC2844ED90000D8077 /* Base */, 740 17CF9EEC2844ED90000D8077 /* Base */,
  741 + 008858DC287869A100B23E08 /* uk */,
719 ); 742 );
720 name = LaunchScreen.storyboard; 743 name = LaunchScreen.storyboard;
721 sourceTree = "<group>"; 744 sourceTree = "<group>";
@@ -727,6 +750,7 @@ @@ -727,6 +750,7 @@
727 isa = XCBuildConfiguration; 750 isa = XCBuildConfiguration;
728 buildSettings = { 751 buildSettings = {
729 ALWAYS_SEARCH_USER_PATHS = NO; 752 ALWAYS_SEARCH_USER_PATHS = NO;
  753 + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
730 CLANG_ANALYZER_NONNULL = YES; 754 CLANG_ANALYZER_NONNULL = YES;
731 CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 755 CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
732 CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 756 CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
@@ -788,6 +812,7 @@ @@ -788,6 +812,7 @@
788 isa = XCBuildConfiguration; 812 isa = XCBuildConfiguration;
789 buildSettings = { 813 buildSettings = {
790 ALWAYS_SEARCH_USER_PATHS = NO; 814 ALWAYS_SEARCH_USER_PATHS = NO;
  815 + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
791 CLANG_ANALYZER_NONNULL = YES; 816 CLANG_ANALYZER_NONNULL = YES;
792 CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 817 CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
793 CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 818 CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
@@ -848,7 +873,7 @@ @@ -848,7 +873,7 @@
848 CODE_SIGN_IDENTITY = "Apple Development"; 873 CODE_SIGN_IDENTITY = "Apple Development";
849 CODE_SIGN_STYLE = Automatic; 874 CODE_SIGN_STYLE = Automatic;
850 CURRENT_PROJECT_VERSION = 1; 875 CURRENT_PROJECT_VERSION = 1;
851 - DEVELOPMENT_TEAM = 4X46JG9W6V; 876 + DEVELOPMENT_TEAM = 52KCA3JZ59;
852 GENERATE_INFOPLIST_FILE = YES; 877 GENERATE_INFOPLIST_FILE = YES;
853 INFOPLIST_FILE = "InterQR-Internship/Info.plist"; 878 INFOPLIST_FILE = "InterQR-Internship/Info.plist";
854 INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 879 INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
@@ -877,7 +902,7 @@ @@ -877,7 +902,7 @@
877 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 902 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
878 CODE_SIGN_STYLE = Automatic; 903 CODE_SIGN_STYLE = Automatic;
879 CURRENT_PROJECT_VERSION = 1; 904 CURRENT_PROJECT_VERSION = 1;
880 - DEVELOPMENT_TEAM = 4X46JG9W6V; 905 + DEVELOPMENT_TEAM = 52KCA3JZ59;
881 GENERATE_INFOPLIST_FILE = YES; 906 GENERATE_INFOPLIST_FILE = YES;
882 INFOPLIST_FILE = "InterQR-Internship/Info.plist"; 907 INFOPLIST_FILE = "InterQR-Internship/Info.plist";
883 INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 908 INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <key>InterQR-Internship.xcscheme_^#shared#^_</key> 7 <key>InterQR-Internship.xcscheme_^#shared#^_</key>
8 <dict> 8 <dict>
9 <key>orderHint</key> 9 <key>orderHint</key>
10 - <integer>2</integer> 10 + <integer>3</integer>
11 </dict> 11 </dict>
12 </dict> 12 </dict>
13 </dict> 13 </dict>
@@ -14,9 +14,57 @@ @@ -14,9 +14,57 @@
14 filePath = "InterQR-Internship/Modules/VerificationSceen/ViewController/VerificationViewController.swift" 14 filePath = "InterQR-Internship/Modules/VerificationSceen/ViewController/VerificationViewController.swift"
15 startingColumnNumber = "9223372036854775807" 15 startingColumnNumber = "9223372036854775807"
16 endingColumnNumber = "9223372036854775807" 16 endingColumnNumber = "9223372036854775807"
17 - startingLineNumber = "117"  
18 - endingLineNumber = "117"  
19 - landmarkName = "keyboardWillHide(notification:)" 17 + startingLineNumber = "128"
  18 + endingLineNumber = "128"
  19 + landmarkName = "VerificationViewController"
  20 + landmarkType = "21">
  21 + </BreakpointContent>
  22 + </BreakpointProxy>
  23 + <BreakpointProxy
  24 + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
  25 + <BreakpointContent
  26 + uuid = "7E7A7FC7-3941-42FF-9D99-A8E8D38CAF4C"
  27 + shouldBeEnabled = "No"
  28 + ignoreCount = "0"
  29 + continueAfterRunningActions = "No"
  30 + filePath = "InterQR-Internship/Modules/ResidentsScreen/ViewController/ResidentsViewController.swift"
  31 + startingColumnNumber = "9223372036854775807"
  32 + endingColumnNumber = "9223372036854775807"
  33 + startingLineNumber = "115"
  34 + endingLineNumber = "115"
  35 + landmarkName = "didRemoveButtonTapped(cell:)"
  36 + landmarkType = "7">
  37 + </BreakpointContent>
  38 + </BreakpointProxy>
  39 + <BreakpointProxy
  40 + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
  41 + <BreakpointContent
  42 + uuid = "EECC7F33-D6B0-4537-A925-697E0430E6CC"
  43 + shouldBeEnabled = "No"
  44 + ignoreCount = "0"
  45 + continueAfterRunningActions = "No"
  46 + filePath = "InterQR-Internship/Modules/VerificationSceen/ViewController/VerificationViewController.swift"
  47 + startingColumnNumber = "9223372036854775807"
  48 + endingColumnNumber = "9223372036854775807"
  49 + startingLineNumber = "83"
  50 + endingLineNumber = "83"
  51 + landmarkName = "didCheckboxTapped(_:)"
  52 + landmarkType = "7">
  53 + </BreakpointContent>
  54 + </BreakpointProxy>
  55 + <BreakpointProxy
  56 + BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
  57 + <BreakpointContent
  58 + uuid = "3F979C60-D565-4FB5-BB07-FBEE9DA2B47C"
  59 + shouldBeEnabled = "No"
  60 + ignoreCount = "0"
  61 + continueAfterRunningActions = "No"
  62 + filePath = "InterQR-Internship/Modules/VerificationSceen/View/VerificationView.swift"
  63 + startingColumnNumber = "9223372036854775807"
  64 + endingColumnNumber = "9223372036854775807"
  65 + startingLineNumber = "329"
  66 + endingLineNumber = "329"
  67 + landmarkName = "handleUI(_:)"
20 landmarkType = "7"> 68 landmarkType = "7">
21 </BreakpointContent> 69 </BreakpointContent>
22 </BreakpointProxy> 70 </BreakpointProxy>
@@ -11,7 +11,6 @@ import ContactsUI @@ -11,7 +11,6 @@ import ContactsUI
11 class AddResidentsViewController: UIViewController { 11 class AddResidentsViewController: UIViewController {
12 var isKeyboardAppear = false 12 var isKeyboardAppear = false
13 13
14 - var savedResidents: [ResidentModel] = []  
15 weak var delegate: ResidentSavable? 14 weak var delegate: ResidentSavable?
16 15
17 var contact = ContactPickerViewController() 16 var contact = ContactPickerViewController()
@@ -70,20 +69,12 @@ class AddResidentsViewController: UIViewController { @@ -70,20 +69,12 @@ class AddResidentsViewController: UIViewController {
70 else { 69 else {
71 return 70 return
72 } 71 }
73 - let model = [ResidentModel(name: name, 72 + let model = ResidentModel(name: name,
74 mobileNumber: mobileNumber, 73 mobileNumber: mobileNumber,
75 manager: mainView.managerButton.isSelected, 74 manager: mainView.managerButton.isSelected,
76 hidden: mainView.hiddenButton.isSelected, 75 hidden: mainView.hiddenButton.isSelected,
77 - heart: mainView.heartButton.isSelected)]  
78 - savedResidents.append(contentsOf: model)  
79 - delegate?.save(savedResidents)  
80 - // ???????????????????????????????  
81 - mainView.nameTextField.text = "" //???  
82 - mainView.mobileNumberTextField.text = "" //???  
83 - mainView.managerButton.isSelected = false //???  
84 - mainView.hiddenButton.isSelected = false //???  
85 - mainView.heartButton.isSelected = false //???  
86 - // ??????????????????????????????? 76 + heart: mainView.heartButton.isSelected)
  77 + delegate?.save(model)
87 } 78 }
88 79
89 @objc private func didTapOnChangeableButtons(_ sender: SquereCheckbox) { 80 @objc private func didTapOnChangeableButtons(_ sender: SquereCheckbox) {
@@ -39,9 +39,10 @@ class CodeVerificationViewController: UIViewController { @@ -39,9 +39,10 @@ class CodeVerificationViewController: UIViewController {
39 func networkingVerify() { 39 func networkingVerify() {
40 guard let verifyUrl = URL(string: Constants.APIRoutes.verifyURL.urlString) else { return } 40 guard let verifyUrl = URL(string: Constants.APIRoutes.verifyURL.urlString) else { return }
41 let verifyModel = verifyModelFilling() 41 let verifyModel = verifyModelFilling()
42 - networkManager.verifyRequest(verifyUrl, model: verifyModel!) { response in 42 + AuthNetworkManager.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.mainView.spinner.startAnimating() 46 self.mainView.spinner.startAnimating()
46 } fail: { error in 47 } fail: { error in
47 print("3️⃣\(error)") 48 print("3️⃣\(error)")
@@ -55,6 +56,7 @@ class CodeVerificationViewController: UIViewController { @@ -55,6 +56,7 @@ class CodeVerificationViewController: UIViewController {
55 self.networkManager.loginRequest(loginUrl, model: loginModel) { response in 56 self.networkManager.loginRequest(loginUrl, model: loginModel) { response in
56 guard let message = response.message else { return } 57 guard let message = response.message else { return }
57 print("4️⃣✅\(message)✅") 58 print("4️⃣✅\(message)✅")
  59 + self.errorProcessing()
58 } fail: { error in 60 } fail: { error in
59 print("4️⃣⛔️\(error)⛔️") 61 print("4️⃣⛔️\(error)⛔️")
60 } 62 }
@@ -76,7 +78,6 @@ class CodeVerificationViewController: UIViewController { @@ -76,7 +78,6 @@ class CodeVerificationViewController: UIViewController {
76 //MARK: - Targets 78 //MARK: - Targets
77 extension CodeVerificationViewController { 79 extension CodeVerificationViewController {
78 @objc private func didTapVerifyButton() { 80 @objc private func didTapVerifyButton() {
79 - errorProcessing()  
80 networkingVerify() 81 networkingVerify()
81 } 82 }
82 83
@@ -97,12 +98,8 @@ extension CodeVerificationViewController { @@ -97,12 +98,8 @@ extension CodeVerificationViewController {
97 mainView.errorAlertLabel.isHidden = false 98 mainView.errorAlertLabel.isHidden = false
98 mainView.otpView.textField.becomeFirstResponder() 99 mainView.otpView.textField.becomeFirstResponder()
99 } else { 100 } else {
100 - DispatchQueue.main.asyncAfter(deadline: .now() + 2) {  
101 - self.networkingLogin()  
102 self.mainView.spinner.stopAnimating() 101 self.mainView.spinner.stopAnimating()
103 self.showHomeVC() 102 self.showHomeVC()
104 - }  
105 -  
106 } 103 }
107 } 104 }
108 } 105 }
@@ -7,7 +7,29 @@ @@ -7,7 +7,29 @@
7 7
8 import UIKit 8 import UIKit
9 9
  10 +protocol ResidentTableViewCellDelegate: AnyObject {
  11 + func didRemoveButtonTapped(cell: ResidentTableViewCell)
  12 + func didManagerButtonTapped(cell: ResidentTableViewCell)
  13 + func didHiddenButtonTapped(cell: ResidentTableViewCell)
  14 + func didHeardButtonTapped(cell: ResidentTableViewCell)
  15 +
  16 +}
  17 +
10 class ResidentTableViewCell: UITableViewCell { 18 class ResidentTableViewCell: UITableViewCell {
  19 + var model: ResidentModel? {
  20 + didSet {
  21 + if let model = model {
  22 + nameLabel.text = model.name
  23 + phoneNumberLabel.text = model.mobileNumber
  24 + managerButton.isSelected = model.manager
  25 + hiddenButton.isSelected = model.hidden
  26 + heartButton.isSelected = model.heart
  27 + }
  28 + }
  29 + }
  30 +
  31 + weak var delegate: ResidentTableViewCellDelegate?
  32 +
11 static let id = String(describing: ResidentTableViewCell.self) 33 static let id = String(describing: ResidentTableViewCell.self)
12 34
13 var containerView: UIView = { 35 var containerView: UIView = {
@@ -67,7 +89,7 @@ class ResidentTableViewCell: UITableViewCell { @@ -67,7 +89,7 @@ class ResidentTableViewCell: UITableViewCell {
67 }() 89 }()
68 90
69 var heartButton: UIButton = { 91 var heartButton: UIButton = {
70 - var obj = UIButton() 92 + var obj = UIButton(type: .system)
71 obj.setImage(UIImage(named: .Image.heart), for: .normal) 93 obj.setImage(UIImage(named: .Image.heart), for: .normal)
72 obj.setImage(UIImage(named: .Image.heartRed), for: .selected) 94 obj.setImage(UIImage(named: .Image.heartRed), for: .selected)
73 return obj 95 return obj
@@ -160,6 +182,8 @@ class ResidentTableViewCell: UITableViewCell { @@ -160,6 +182,8 @@ class ResidentTableViewCell: UITableViewCell {
160 $0.bottom.equalToSuperview().offset(-18) 182 $0.bottom.equalToSuperview().offset(-18)
161 $0.trailing.equalToSuperview().offset(-22) 183 $0.trailing.equalToSuperview().offset(-22)
162 } 184 }
  185 +
  186 + removeCellButton.addTarget(self, action: #selector(didRemoveButtonTapped(_:)), for: .touchUpInside)
163 } 187 }
164 188
165 override func layoutSubviews() { 189 override func layoutSubviews() {
@@ -167,13 +191,11 @@ class ResidentTableViewCell: UITableViewCell { @@ -167,13 +191,11 @@ class ResidentTableViewCell: UITableViewCell {
167 gradientBG.frame = serialNumberView.bounds 191 gradientBG.frame = serialNumberView.bounds
168 } 192 }
169 193
170 - func model(_ item: ResidentModel) {  
171 - nameLabel.text = item.name  
172 - phoneNumberLabel.text = item.mobileNumber  
173 - managerButton.isSelected = item.manager  
174 - hiddenButton.isSelected = item.hidden  
175 - heartButton.isSelected = item.heart 194 +}
  195 +
  196 +//MARK: targets
  197 +extension ResidentTableViewCell {
  198 + @objc private func didRemoveButtonTapped(_ sender: UIButton) {
  199 + delegate?.didRemoveButtonTapped(cell: self)
176 } 200 }
177 -  
178 -  
179 } 201 }
@@ -11,7 +11,6 @@ class ResidentsViewController: UIViewController { @@ -11,7 +11,6 @@ class ResidentsViewController: UIViewController {
11 var mainView = ResidentsView() 11 var mainView = ResidentsView()
12 var myData: [ResidentModel] = [] 12 var myData: [ResidentModel] = []
13 13
14 - let addResidentsVC = AddResidentsViewController()  
15 let networkManager = AuthNetworkManager() 14 let networkManager = AuthNetworkManager()
16 15
17 override func loadView() { 16 override func loadView() {
@@ -62,6 +61,7 @@ class ResidentsViewController: UIViewController { @@ -62,6 +61,7 @@ class ResidentsViewController: UIViewController {
62 } 61 }
63 62
64 @objc private func willShowAddResidentVC() { 63 @objc private func willShowAddResidentVC() {
  64 + let addResidentsVC = AddResidentsViewController()
65 addResidentsVC.modalPresentationStyle = .overCurrentContext 65 addResidentsVC.modalPresentationStyle = .overCurrentContext
66 addResidentsVC.modalTransitionStyle = .crossDissolve 66 addResidentsVC.modalTransitionStyle = .crossDissolve
67 addResidentsVC.delegate = self 67 addResidentsVC.delegate = self
@@ -79,12 +79,8 @@ extension ResidentsViewController: UITableViewDelegate, UITableViewDataSource { @@ -79,12 +79,8 @@ extension ResidentsViewController: UITableViewDelegate, UITableViewDataSource {
79 guard let cell = tableView.dequeueReusableCell(withIdentifier: ResidentTableViewCell.id, for: indexPath) as? ResidentTableViewCell else { return UITableViewCell() } 79 guard let cell = tableView.dequeueReusableCell(withIdentifier: ResidentTableViewCell.id, for: indexPath) as? ResidentTableViewCell else { return UITableViewCell() }
80 cell.serialNumberLabel.text = "\(indexPath.row + 1)" 80 cell.serialNumberLabel.text = "\(indexPath.row + 1)"
81 let data = myData[indexPath.row] 81 let data = myData[indexPath.row]
82 - cell.model(data)  
83 -  
84 - cell.removeCellButton.addTarget(self, action: #selector(removeCell(_:)), for: .touchUpInside)  
85 - cell.managerButton.addTarget(self, action: #selector(didTapManagerButton), for: .touchUpInside)  
86 - cell.hiddenButton.addTarget(self, action: #selector(didTapManagerButton), for: .touchUpInside)  
87 - cell.heartButton.addTarget(self, action: #selector(didTapManagerButton), for: .touchUpInside) 82 + cell.model = data
  83 + cell.delegate = self
88 return cell 84 return cell
89 } 85 }
90 86
@@ -104,8 +100,33 @@ extension ResidentsViewController: UITableViewDelegate, UITableViewDataSource { @@ -104,8 +100,33 @@ extension ResidentsViewController: UITableViewDelegate, UITableViewDataSource {
104 } 100 }
105 //MARK: - ResidentSavable delegate 101 //MARK: - ResidentSavable delegate
106 extension ResidentsViewController: ResidentSavable { 102 extension ResidentsViewController: ResidentSavable {
107 - func save(_ data: [ResidentModel]) {  
108 - self.myData = data 103 + func save(_ data: ResidentModel) {
  104 + self.myData.append(data)
109 mainView.tableView.reloadData() 105 mainView.tableView.reloadData()
110 } 106 }
111 } 107 }
  108 +
  109 +//MARK: residentcell delegate
  110 +extension ResidentsViewController: ResidentTableViewCellDelegate {
  111 + func didRemoveButtonTapped(cell: ResidentTableViewCell) {
  112 + guard let model = cell.model else {
  113 + return
  114 + }
  115 + myData.removeAll(where: {$0.name == model.name})
  116 + mainView.tableView.reloadData()
  117 + }
  118 +
  119 + func didManagerButtonTapped(cell: ResidentTableViewCell) {
  120 + print("")
  121 + }
  122 +
  123 + func didHiddenButtonTapped(cell: ResidentTableViewCell) {
  124 + print("")
  125 + }
  126 +
  127 + func didHeardButtonTapped(cell: ResidentTableViewCell) {
  128 + print("")
  129 + }
  130 +
  131 +
  132 +}
@@ -10,11 +10,11 @@ import UIKit @@ -10,11 +10,11 @@ import UIKit
10 10
11 class VerificationView: UIView { 11 class VerificationView: UIView {
12 var isShow: Bool = false 12 var isShow: Bool = false
13 - var isChanged: Bool = false {  
14 - didSet {  
15 - handleUI(isChanged)  
16 - }  
17 - } 13 +// var isChanged: Bool = false {
  14 +// didSet {
  15 +// handleUI(isChanged)
  16 +// }
  17 +// }
18 var logoImage: UIImageView = { 18 var logoImage: UIImageView = {
19 var view = UIImageView() 19 var view = UIImageView()
20 view.image = UIImage(named: .Image.interQR) 20 view.image = UIImage(named: .Image.interQR)
@@ -326,29 +326,11 @@ class VerificationView: UIView { @@ -326,29 +326,11 @@ class VerificationView: UIView {
326 } 326 }
327 327
328 func handleUI(_ isChanged: Bool) { 328 func handleUI(_ isChanged: Bool) {
329 - switch isChanged {  
330 - case emailButton.isSelected :  
331 - emailTextField.isHidden = false  
332 - phoneTextField.isHidden = true  
333 - phoneNumberButton.isSelected = false  
334 - emailButton.isSelected = true  
335 - verificationDescriptionLabel.text = .Text.verificationCodeWillBeSentToYourEmail  
336 - enterChosenAuthenticatorLabel.text = .Text.enterYourEmailAddress  
337 - emailTextField.text = ""  
338 - emailTextField.placeholder = .Text.exampleEmail  
339 - showPickerButton.isHidden = true  
340 - case phoneNumberButton.isSelected :  
341 - emailTextField.isHidden = true  
342 - phoneTextField.isHidden = false  
343 - phoneNumberButton.isSelected = true  
344 - emailButton.isSelected = false  
345 - phoneNumberButton.image(for: .normal)  
346 - verificationDescriptionLabel.text = .Text.verificationCodeWillBeSentToYourNumber  
347 - enterChosenAuthenticatorLabel.text = .Text.enterYourPhoneNumber  
348 - emailTextField.text = .Text.plusOne  
349 - showPickerButton.isHidden = false  
350 - default :  
351 - return  
352 - } 329 + emailTextField.isHidden = !isChanged
  330 + phoneTextField.isHidden = isChanged
  331 + verificationDescriptionLabel.text = isChanged ? .Text.verificationCodeWillBeSentToYourEmail : .Text.verificationCodeWillBeSentToYourNumber
  332 + enterChosenAuthenticatorLabel.text = isChanged ? .Text.enterYourEmailAddress : .Text.enterYourPhoneNumber
  333 + emailTextField.text = isChanged ? "" : .Text.plusOne
  334 + showPickerButton.isHidden = isChanged
353 } 335 }
354 } 336 }
@@ -80,8 +80,19 @@ extension VerificationViewController { @@ -80,8 +80,19 @@ extension VerificationViewController {
80 //MARK: targets 80 //MARK: targets
81 extension VerificationViewController { 81 extension VerificationViewController {
82 @objc private func didCheckboxTapped(_ sender: Checkbox) { 82 @objc private func didCheckboxTapped(_ sender: Checkbox) {
83 - mainView.isChanged ? mainView.handleUI(true) : mainView.handleUI(false)  
84 - mainView.isChanged.toggle() 83 + switch sender {
  84 + case mainView.emailButton :
  85 + sender.isSelected = true
  86 + mainView.phoneNumberButton.isSelected = false
  87 + mainView.handleUI(true)
  88 + case mainView.phoneNumberButton:
  89 + sender.isSelected = true
  90 + mainView.emailButton.isSelected = false
  91 + mainView.handleUI(false)
  92 + default:
  93 + return
  94 + }
  95 +// mainView.handleUI(mainView.emailButton.isSelected)
85 } 96 }
86 97
87 @objc private func didshowPickerButtonTapped(_ sender: UIButton) { 98 @objc private func didshowPickerButtonTapped(_ sender: UIButton) {
@@ -9,6 +9,9 @@ import Foundation @@ -9,6 +9,9 @@ import Foundation
9 import Alamofire 9 import Alamofire
10 10
11 class AuthNetworkManager { 11 class AuthNetworkManager {
  12 +
  13 + static let share = AuthNetworkManager()
  14 +
12 var networkToken: String? { 15 var networkToken: String? {
13 get { 16 get {
14 // обязательно ключи на подобии NETWORK_TOKEN выносить в Constants.networkTokenKey 17 // обязательно ключи на подобии NETWORK_TOKEN выносить в Constants.networkTokenKey
@@ -9,5 +9,5 @@ import Foundation @@ -9,5 +9,5 @@ import Foundation
9 import ContactsUI 9 import ContactsUI
10 10
11 protocol ResidentSavable: AnyObject { 11 protocol ResidentSavable: AnyObject {
12 - func save(_ data: [ResidentModel]) 12 + func save(_ data: ResidentModel)
13 } 13 }
@@ -19,7 +19,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { @@ -19,7 +19,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
19 let viewController = VerificationViewController() 19 let viewController = VerificationViewController()
20 let homeVC = HomeViewController() 20 let homeVC = HomeViewController()
21 let residentVC = ResidentsViewController() 21 let residentVC = ResidentsViewController()
22 - let navigation = UINavigationController(rootViewController: residentVC) 22 + let navigation = UINavigationController(rootViewController: viewController)
23 navigation.isNavigationBarHidden = true 23 navigation.isNavigationBarHidden = true
24 window?.rootViewController = navigation 24 window?.rootViewController = navigation
25 window?.makeKeyAndVisible() 25 window?.makeKeyAndVisible()
@@ -4,20 +4,27 @@ @@ -4,20 +4,27 @@
4 <dict> 4 <dict>
5 <key>SchemeUserState</key> 5 <key>SchemeUserState</key>
6 <dict> 6 <dict>
7 - <key>Pods-InterQR-Internship.xcscheme</key> 7 + <key>Alamofire.xcscheme</key>
8 <dict> 8 <dict>
9 <key>isShown</key> 9 <key>isShown</key>
10 <false/> 10 <false/>
11 <key>orderHint</key> 11 <key>orderHint</key>
12 <integer>0</integer> 12 <integer>0</integer>
13 </dict> 13 </dict>
14 - <key>SnapKit.xcscheme</key> 14 + <key>Pods-InterQR-Internship.xcscheme</key>
15 <dict> 15 <dict>
16 <key>isShown</key> 16 <key>isShown</key>
17 <false/> 17 <false/>
18 <key>orderHint</key> 18 <key>orderHint</key>
19 <integer>1</integer> 19 <integer>1</integer>
20 </dict> 20 </dict>
  21 + <key>SnapKit.xcscheme</key>
  22 + <dict>
  23 + <key>isShown</key>
  24 + <false/>
  25 + <key>orderHint</key>
  26 + <integer>2</integer>
  27 + </dict>
21 </dict> 28 </dict>
22 <key>SuppressBuildableAutocreation</key> 29 <key>SuppressBuildableAutocreation</key>
23 <dict/> 30 <dict/>
Please register or login to post a comment