Manos Chorianopoulos

LoyaltyAnalysisViewController accessibilities

...@@ -30,6 +30,8 @@ import SwiftEventBus ...@@ -30,6 +30,8 @@ import SwiftEventBus
30 setBackButton() 30 setBackButton()
31 setNavigationTitle("Ανάλυση") 31 setNavigationTitle("Ανάλυση")
32 32
33 + contentView.accessibilityElementsHidden = false
34 +
33 // tab 35 // tab
34 leftButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15) 36 leftButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
35 leftButton.setTitle("Εξαργυρωμένα", for:.normal) 37 leftButton.setTitle("Εξαργυρωμένα", for:.normal)
...@@ -59,6 +61,8 @@ import SwiftEventBus ...@@ -59,6 +61,8 @@ import SwiftEventBus
59 61
60 let analysisVC = self.viewControllerAt(0) 62 let analysisVC = self.viewControllerAt(0)
61 pageController.setViewControllers([analysisVC!], direction:.forward, animated:false) 63 pageController.setViewControllers([analysisVC!], direction:.forward, animated:false)
64 +
65 + setupAccessibilty()
62 } 66 }
63 67
64 public override func viewWillAppear(_ animated: Bool) { 68 public override func viewWillAppear(_ animated: Bool) {
...@@ -76,8 +80,35 @@ import SwiftEventBus ...@@ -76,8 +80,35 @@ import SwiftEventBus
76 80
77 self.stopTimer() 81 self.stopTimer()
78 } 82 }
83 +
84 + public override func viewDidAppear(_ animated: Bool) {
85 + super.viewDidAppear(animated)
86 +
87 +// DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
88 + UIAccessibility.post(notification: .screenChanged, argument: self.navigationItem.titleView)
89 +// }
90 +
91 + // Re-enable table view accessibility after the announcement
92 + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
93 + self.contentView.accessibilityElementsHidden = false
94 + }
95 + }
79 96
80 // MARK: - Functions 97 // MARK: - Functions
98 + func setupAccessibilty() {
99 + leftButton.isAccessibilityElement = true
100 + leftButton.accessibilityLabel = leftButton.title(for: .normal)
101 + leftButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
102 + leftButton.accessibilityTraits = .button
103 + leftButton.accessibilityValue = "Επιλεγμένο"
104 +
105 + rightButton.isAccessibilityElement = true
106 + rightButton.accessibilityLabel = rightButton.title(for: .normal)
107 + rightButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
108 + rightButton.accessibilityTraits = .button
109 + rightButton.accessibilityValue = "Μη επιλεγμένο"
110 + }
111 +
81 func startTimer() { 112 func startTimer() {
82 print("========= GiftsCalculator Timer Started! =========") 113 print("========= GiftsCalculator Timer Started! =========")
83 114
...@@ -151,6 +182,9 @@ import SwiftEventBus ...@@ -151,6 +182,9 @@ import SwiftEventBus
151 } 182 }
152 let analysisVC = self.viewControllerAt(0) 183 let analysisVC = self.viewControllerAt(0)
153 pageController.setViewControllers([analysisVC!], direction:.reverse, animated:true) 184 pageController.setViewControllers([analysisVC!], direction:.reverse, animated:true)
185 +
186 + self.leftButton.accessibilityValue = "Επιλεγμένο"
187 + self.rightButton.accessibilityValue = "Μη επιλεγμένο"
154 } 188 }
155 } 189 }
156 190
...@@ -171,6 +205,9 @@ import SwiftEventBus ...@@ -171,6 +205,9 @@ import SwiftEventBus
171 } 205 }
172 let analysisVC = self.viewControllerAt(1) 206 let analysisVC = self.viewControllerAt(1)
173 pageController.setViewControllers([analysisVC!], direction:.forward, animated:true) 207 pageController.setViewControllers([analysisVC!], direction:.forward, animated:true)
208 +
209 + self.leftButton.accessibilityValue = "Μη επιλεγμένο"
210 + self.rightButton.accessibilityValue = "Επιλεγμένο"
174 } 211 }
175 } 212 }
176 } 213 }
...@@ -226,6 +263,10 @@ extension LoyaltyAnalysisViewController: UIPageViewControllerDataSource, UIPageV ...@@ -226,6 +263,10 @@ extension LoyaltyAnalysisViewController: UIPageViewControllerDataSource, UIPageV
226 self.leftLineView.isHidden = false 263 self.leftLineView.isHidden = false
227 self.rightLineView.isHidden = true 264 self.rightLineView.isHidden = true
228 265
266 + self.leftButton.accessibilityValue = "Επιλεγμένο"
267 + self.rightButton.accessibilityValue = "Μη επιλεγμένο"
268 + UIAccessibility.post(notification: .screenChanged, argument: self.leftButton)
269 +
229 } else { 270 } else {
230 self.leftButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 15) 271 self.leftButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 15)
231 self.rightButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15) 272 self.rightButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
...@@ -234,6 +275,10 @@ extension LoyaltyAnalysisViewController: UIPageViewControllerDataSource, UIPageV ...@@ -234,6 +275,10 @@ extension LoyaltyAnalysisViewController: UIPageViewControllerDataSource, UIPageV
234 self.tabSelected = 1 275 self.tabSelected = 1
235 self.leftLineView.isHidden = true 276 self.leftLineView.isHidden = true
236 self.rightLineView.isHidden = false 277 self.rightLineView.isHidden = false
278 +
279 + self.leftButton.accessibilityValue = "Μη επιλεγμένο"
280 + self.rightButton.accessibilityValue = "Επιλεγμένο"
281 + UIAccessibility.post(notification: .screenChanged, argument: self.rightButton)
237 } 282 }
238 } 283 }
239 } 284 }
......