Manos Chorianopoulos

Market History accessibilities

...@@ -126,5 +126,16 @@ extension AnalysisHeaderMessageViewCell { ...@@ -126,5 +126,16 @@ extension AnalysisHeaderMessageViewCell {
126 messageLabel.attributedText = coupAttributedString 126 messageLabel.attributedText = coupAttributedString
127 } 127 }
128 128
129 + setupAccessibilty()
130 + }
131 +
132 + func setupAccessibilty() {
133 + // Disable accessibility for the whole cell
134 + self.isAccessibilityElement = false
135 +
136 + messageLabelView.isAccessibilityElement = true
137 + messageLabelView.accessibilityLabel = messageLabel.text
138 +
139 + emptyLabel.isAccessibilityElement = true
129 } 140 }
130 } 141 }
......
...@@ -10,6 +10,7 @@ import UIKit ...@@ -10,6 +10,7 @@ import UIKit
10 @objc public class AnalysisMoreViewCell: UITableViewCell { 10 @objc public class AnalysisMoreViewCell: UITableViewCell {
11 @IBOutlet weak var titleLabel: UILabel! 11 @IBOutlet weak var titleLabel: UILabel!
12 @IBOutlet weak var arrowImage: UIImageView! 12 @IBOutlet weak var arrowImage: UIImageView!
13 + @IBOutlet weak var stackView: UIStackView!
13 14
14 // lifecycle 15 // lifecycle
15 public override func awakeFromNib() { 16 public override func awakeFromNib() {
...@@ -21,5 +22,15 @@ import UIKit ...@@ -21,5 +22,15 @@ import UIKit
21 titleLabel.text = "Δες Περισσότερα" 22 titleLabel.text = "Δες Περισσότερα"
22 23
23 arrowImage.image = UIImage(named: "ic_down_dark_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 24 arrowImage.image = UIImage(named: "ic_down_dark_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
24 - } 25 +
26 + setupAccessibilty()
27 + }
28 +
29 + func setupAccessibilty() {
30 + // Disable accessibility for the whole cell
31 + self.isAccessibilityElement = false
32 +
33 + stackView.isAccessibilityElement = true
34 + stackView.accessibilityLabel = titleLabel.text
35 + }
25 } 36 }
......
...@@ -1671,6 +1671,7 @@ ...@@ -1671,6 +1671,7 @@
1671 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 1671 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
1672 <connections> 1672 <connections>
1673 <outlet property="arrowImage" destination="UAb-LB-dY7" id="nKr-Gk-SgS"/> 1673 <outlet property="arrowImage" destination="UAb-LB-dY7" id="nKr-Gk-SgS"/>
1674 + <outlet property="stackView" destination="ctP-ye-yIH" id="1c9-eW-SMf"/>
1674 <outlet property="titleLabel" destination="t7D-IM-UwS" id="nZ6-Nf-utE"/> 1675 <outlet property="titleLabel" destination="t7D-IM-UwS" id="nZ6-Nf-utE"/>
1675 </connections> 1676 </connections>
1676 </tableViewCell> 1677 </tableViewCell>
......
...@@ -106,6 +106,7 @@ extension MarketAnalysisItemViewCell { ...@@ -106,6 +106,7 @@ extension MarketAnalysisItemViewCell {
106 let htmlText = couponSetData?.inner_text ?? "" 106 let htmlText = couponSetData?.inner_text ?? ""
107 productTitleLabel.text = htmlText.htmlToString 107 productTitleLabel.text = htmlText.htmlToString
108 108
109 + setupAccessibilty(item: item)
109 } 110 }
110 111
111 func configureCell(item: swiftApi.CouponItemModel, isMarket: Bool) { 112 func configureCell(item: swiftApi.CouponItemModel, isMarket: Bool) {
...@@ -149,6 +150,26 @@ extension MarketAnalysisItemViewCell { ...@@ -149,6 +150,26 @@ extension MarketAnalysisItemViewCell {
149 // let htmlText = couponSetData?.inner_text ?? "" 150 // let htmlText = couponSetData?.inner_text ?? ""
150 // subtitleLabel.text = htmlText.htmlToString 151 // subtitleLabel.text = htmlText.htmlToString
151 152
153 + setupAccessibilty(item: item)
152 } 154 }
155 +
156 + func setupAccessibilty (item: swiftApi.CouponItemModel) {
157 + var formatedDate = ""
158 + let dateFormatter = DateFormatter()
159 + dateFormatter.locale = Locale(identifier: "en_US_POSIX")
160 + if let date = item.redeemed_date {
161 + // Set output format in Greek
162 + dateFormatter.locale = Locale(identifier: "el_GR") // Greek locale
163 + dateFormatter.dateFormat = "d MMMM yyyy"
164 + let resultString = dateFormatter.string(from: date)
165 + formatedDate = resultString
166 + } else {
167 + formatedDate = dateLabel.text ?? ""
168 + }
169 +
170 + let accessibilityLabel = formatedDate + ", " + (titleLabel.text ?? "") + ", " + (productTitleLabel.text ?? "") + ", " + (subtitleLabel.text ?? "") + ", " + (priceLabel.text ?? "")
171 + self.isAccessibilityElement = true
172 + self.accessibilityLabel = accessibilityLabel
173 + }
153 } 174 }
154 175
......
...@@ -32,6 +32,8 @@ import SwiftEventBus ...@@ -32,6 +32,8 @@ import SwiftEventBus
32 setBackButton() 32 setBackButton()
33 setNavigationTitle("Ανάλυση") 33 setNavigationTitle("Ανάλυση")
34 34
35 + contentView.accessibilityElementsHidden = false
36 +
35 // TODO: DELETE if tabs needed again 37 // TODO: DELETE if tabs needed again
36 contentViewHeight.constant = 0 38 contentViewHeight.constant = 0
37 39
...@@ -90,6 +92,8 @@ import SwiftEventBus ...@@ -90,6 +92,8 @@ import SwiftEventBus
90 // Notify the child view controller that it has been moved to the parent 92 // Notify the child view controller that it has been moved to the parent
91 childVC.didMove(toParent: self) 93 childVC.didMove(toParent: self)
92 // <== 94 // <==
95 +
96 + setupAccessibilty()
93 } 97 }
94 98
95 public override func viewWillAppear(_ animated: Bool) { 99 public override func viewWillAppear(_ animated: Bool) {
...@@ -107,8 +111,33 @@ import SwiftEventBus ...@@ -107,8 +111,33 @@ import SwiftEventBus
107 111
108 self.stopTimer() 112 self.stopTimer()
109 } 113 }
114 +
115 + public override func viewDidAppear(_ animated: Bool) {
116 + super.viewDidAppear(animated)
117 +
118 +// DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
119 + UIAccessibility.post(notification: .screenChanged, argument: self.navigationItem.titleView)
120 +// }
121 +
122 + // Re-enable table view accessibility after the announcement
123 + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
124 + self.contentView.accessibilityElementsHidden = false
125 + }
126 + }
110 127
111 // MARK: - Functions 128 // MARK: - Functions
129 + func setupAccessibilty () {
130 + leftButton.isAccessibilityElement = true
131 + leftButton.accessibilityLabel = leftButton.title(for: .normal)
132 + leftButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
133 + leftButton.accessibilityTraits = .button
134 +
135 + rightButton.isAccessibilityElement = true
136 + rightButton.accessibilityLabel = rightButton.title(for: .normal)
137 + rightButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
138 + rightButton.accessibilityTraits = .button
139 + }
140 +
112 func startTimer() { 141 func startTimer() {
113 print("========= GiftsCalculator Timer Started! =========") 142 print("========= GiftsCalculator Timer Started! =========")
114 143
......