Manos Chorianopoulos

ShareViewController accessibilitues

...@@ -82,6 +82,8 @@ protocol NumbersPopupDelegate { ...@@ -82,6 +82,8 @@ protocol NumbersPopupDelegate {
82 // self.tableView.reloadData() 82 // self.tableView.reloadData()
83 self.tableView.invalidateIntrinsicContentSize() 83 self.tableView.invalidateIntrinsicContentSize()
84 self.headerLabel.text = self.headerText 84 self.headerLabel.text = self.headerText
85 +
86 + setupAccessibilty()
85 } 87 }
86 88
87 func setupScreens() { 89 func setupScreens() {
...@@ -124,6 +126,17 @@ protocol NumbersPopupDelegate { ...@@ -124,6 +126,17 @@ protocol NumbersPopupDelegate {
124 // return UIModalPresentationStyle.none 126 // return UIModalPresentationStyle.none
125 } 127 }
126 128
129 + // MARK: - functions
130 + func setupAccessibilty () {
131 + headerLabel.isAccessibilityElement = true
132 + headerLabel.accessibilityTraits = .header
133 +
134 + closeButton.isAccessibilityElement = true
135 + closeButton.accessibilityLabel = "Κλείσιμο"
136 + closeButton.accessibilityHint = "Διπλό πάτημα για κλείσιμο"
137 + closeButton.accessibilityTraits = .button
138 + }
139 +
127 // MARK: - UIButton Action 140 // MARK: - UIButton Action
128 @IBAction func closeButtonAction(_ sender: Any) { 141 @IBAction func closeButtonAction(_ sender: Any) {
129 self.dismiss(animated: true, completion: { 142 self.dismiss(animated: true, completion: {
...@@ -154,6 +167,7 @@ extension NumberPopupViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -154,6 +167,7 @@ extension NumberPopupViewController: UITableViewDelegate, UITableViewDataSource{
154 let isLast = indexPath.row == (self.numbersList.count - 1) 167 let isLast = indexPath.row == (self.numbersList.count - 1)
155 168
156 cell.configureCell(number: numbersList[indexPath.row], isLast: isLast) 169 cell.configureCell(number: numbersList[indexPath.row], isLast: isLast)
170 + cell.accessibilityHint = "Διπλό πάτημα για επιλογή"
157 171
158 return cell 172 return cell
159 } 173 }
......
...@@ -53,6 +53,9 @@ import SwiftEventBus ...@@ -53,6 +53,9 @@ import SwiftEventBus
53 setBackButton() 53 setBackButton()
54 setNavigationTitle("Δώρισέ το") 54 setNavigationTitle("Δώρισέ το")
55 55
56 + // Temporarily disable the table view's accessibility to prevent immediate focus shift
57 + self.mainView.accessibilityElementsHidden = true
58 +
56 backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 59 backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
57 60
58 // scrollView.clipsToBounds = true 61 // scrollView.clipsToBounds = true
...@@ -117,6 +120,7 @@ import SwiftEventBus ...@@ -117,6 +120,7 @@ import SwiftEventBus
117 // redeemButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.6).isActive = true 120 // redeemButton.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.6).isActive = true
118 // } 121 // }
119 122
123 + setupAccessibilty()
120 } 124 }
121 125
122 public override func viewWillAppear(_ animated: Bool) { 126 public override func viewWillAppear(_ animated: Bool) {
...@@ -127,6 +131,19 @@ import SwiftEventBus ...@@ -127,6 +131,19 @@ import SwiftEventBus
127 self.navigationController?.hideHairline() 131 self.navigationController?.hideHairline()
128 } 132 }
129 133
134 + public override func viewDidAppear(_ animated: Bool) {
135 + super.viewDidAppear(animated)
136 +
137 +// DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
138 + UIAccessibility.post(notification: .screenChanged, argument: self.navigationItem.titleView)
139 +// }
140 +
141 + // Re-enable table view accessibility after the announcement
142 + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
143 + self.mainView.accessibilityElementsHidden = false
144 + }
145 + }
146 +
130 deinit { 147 deinit {
131 NotificationCenter.default.removeObserver(self) 148 NotificationCenter.default.removeObserver(self)
132 } 149 }
...@@ -156,6 +173,22 @@ import SwiftEventBus ...@@ -156,6 +173,22 @@ import SwiftEventBus
156 } 173 }
157 174
158 // MARK: - Functions 175 // MARK: - Functions
176 + func setupAccessibilty () {
177 + couponImage.isAccessibilityElement = true
178 + couponImage.accessibilityLabel = "Φωτογραφία εκπτωτικού κουπονιού"
179 + couponImage.accessibilityTraits = .image
180 +
181 + senderButton.isAccessibilityElement = true
182 + senderButton.accessibilityLabel = (senderLabel.text ?? "Αποστολέας") + ": " + selectedNumber
183 + senderButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
184 + senderButton.accessibilityTraits = .button
185 +
186 + redeemButton.isAccessibilityElement = true
187 + redeemButton.accessibilityLabel = redeemButton.title(for: .normal)
188 + redeemButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
189 + redeemButton.accessibilityTraits = .button
190 + }
191 +
159 func showSpinner() { 192 func showSpinner() {
160 // add the spinner view controller 193 // add the spinner view controller
161 // addChild(spinner) 194 // addChild(spinner)
...@@ -379,6 +412,8 @@ extension ShareViewController: NumbersPopupDelegate { ...@@ -379,6 +412,8 @@ extension ShareViewController: NumbersPopupDelegate {
379 selectedNumber = option 412 selectedNumber = option
380 senderLabel.text = option 413 senderLabel.text = option
381 senderLabel.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00) 414 senderLabel.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)
415 +
416 + senderButton.accessibilityLabel = "Αποστολέας: " + selectedNumber
382 } 417 }
383 } 418 }
384 419
......