Manos Chorianopoulos

MarketPassViewController accessibilities

...@@ -59,6 +59,8 @@ import SwiftEventBus ...@@ -59,6 +59,8 @@ import SwiftEventBus
59 self.navigationController?.pushViewController(vc, animated: true) 59 self.navigationController?.pushViewController(vc, animated: true)
60 } 60 }
61 61
62 + self.passContainerView.accessibilityElementsHidden = true
63 +
62 setupUI() 64 setupUI()
63 } 65 }
64 66
...@@ -134,6 +136,11 @@ import SwiftEventBus ...@@ -134,6 +136,11 @@ import SwiftEventBus
134 mapButton.layer.borderWidth = 2 136 mapButton.layer.borderWidth = 2
135 mapButton.layer.borderColor = UIColor(rgb: 0x006D26).cgColor 137 mapButton.layer.borderColor = UIColor(rgb: 0x006D26).cgColor
136 138
139 + mapButton.isAccessibilityElement = true
140 + mapButton.accessibilityLabel = mapButton.title(for: .normal)
141 + mapButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
142 + mapButton.accessibilityTraits = .button
143 +
137 smLogosView.layer.cornerRadius = 16.0 144 smLogosView.layer.cornerRadius = 16.0
138 smLogosView.layer.maskedCorners = [ .layerMinXMaxYCorner, .layerMaxXMaxYCorner] // Bottom left, right corner radius 145 smLogosView.layer.maskedCorners = [ .layerMinXMaxYCorner, .layerMaxXMaxYCorner] // Bottom left, right corner radius
139 146
...@@ -171,6 +178,15 @@ import SwiftEventBus ...@@ -171,6 +178,15 @@ import SwiftEventBus
171 if let tempMarketPassDetails = swiftApi().getMarketPassDetails() { 178 if let tempMarketPassDetails = swiftApi().getMarketPassDetails() {
172 self.marketPassDetails = tempMarketPassDetails 179 self.marketPassDetails = tempMarketPassDetails
173 self.updateUI() 180 self.updateUI()
181 +
182 + // DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
183 + UIAccessibility.post(notification: .screenChanged, argument: self.navigationItem.titleView)
184 + // }
185 +
186 + // Re-enable table view accessibility after the announcement
187 + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
188 + self.passContainerView.accessibilityElementsHidden = false
189 + }
174 } else { 190 } else {
175 self.showDialog("Αποτυχία","Κάτι πήγε στραβά") 191 self.showDialog("Αποτυχία","Κάτι πήγε στραβά")
176 } 192 }
...@@ -183,9 +199,16 @@ import SwiftEventBus ...@@ -183,9 +199,16 @@ import SwiftEventBus
183 barcodeLabel.frame.size.width = barcodeLabel.intrinsicContentSize.width 199 barcodeLabel.frame.size.width = barcodeLabel.intrinsicContentSize.width
184 barcodeLabel.frame.size.height = barcodeLabel.intrinsicContentSize.height 200 barcodeLabel.frame.size.height = barcodeLabel.intrinsicContentSize.height
185 201
202 + barcodeLabel.isAccessibilityElement = true
203 + barcodeLabel.accessibilityLabel = "Αριθμός barcode " + (barcodeLabel.text ?? "")
204 +
186 if let barcodeUIImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.12)) { 205 if let barcodeUIImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.12)) {
187 // if let barcodeUIImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: 110, height: 83)) { 206 // if let barcodeUIImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: 110, height: 83)) {
188 barcodeImage.image = barcodeUIImage 207 barcodeImage.image = barcodeUIImage
208 +
209 + barcodeImage.isAccessibilityElement = true
210 + barcodeImage.accessibilityLabel = "Barcode"
211 + barcodeImage.accessibilityTraits = .image
189 212
190 barcodeImageHeight.constant = self.uiscreen.height * 0.12 213 barcodeImageHeight.constant = self.uiscreen.height * 0.12
191 // barcodeImageHeight.constant = 83 214 // barcodeImageHeight.constant = 83
...@@ -209,6 +232,10 @@ import SwiftEventBus ...@@ -209,6 +232,10 @@ import SwiftEventBus
209 couponsValueAttributedString.append(couponsValueBoldString) 232 couponsValueAttributedString.append(couponsValueBoldString)
210 couponsValueLabel.attributedText = couponsValueAttributedString 233 couponsValueLabel.attributedText = couponsValueAttributedString
211 234
235 + let formattedCost = couponsValueString.replacingOccurrences(of: ".", with: ",")
236 + couponsValueLabel.isAccessibilityElement = true
237 + couponsValueLabel.accessibilityLabel = "Έχεις κουπόνια συνολικής αξίας " + formattedCost + "€"
238 +
212 let supermarkets: Array<swiftApi.SupermarketModel> = marketPassDetails?._supermarkets ?? [] 239 let supermarkets: Array<swiftApi.SupermarketModel> = marketPassDetails?._supermarkets ?? []
213 240
214 // Create a horizontal stack view 241 // Create a horizontal stack view
...@@ -227,6 +254,10 @@ import SwiftEventBus ...@@ -227,6 +254,10 @@ import SwiftEventBus
227 254
228 imageView.load(link: sm._logo, placeholder: UIImage(), cache: URLCache()) 255 imageView.load(link: sm._logo, placeholder: UIImage(), cache: URLCache())
229 256
257 + imageView.isAccessibilityElement = true
258 + imageView.accessibilityLabel = "Λογότυπο καταστήματος " + sm._name
259 + imageView.accessibilityTraits = .image
260 +
230 // Add image view to the stack view 261 // Add image view to the stack view
231 stackView.addArrangedSubview(imageView) 262 stackView.addArrangedSubview(imageView)
232 } 263 }
......
...@@ -116,12 +116,14 @@ extension UIViewController { ...@@ -116,12 +116,14 @@ extension UIViewController {
116 116
117 func setNavBarRightInfoButton(action: @escaping InfoButtonAction) { 117 func setNavBarRightInfoButton(action: @escaping InfoButtonAction) {
118 // Create a UIView for the custom info button 118 // Create a UIView for the custom info button
119 - let customInfoView = UIView(frame: CGRect(x: 0, y: 0, width: 24, height: 24)) 119 + // let customInfoView = UIView(frame: CGRect(x: 0, y: 0, width: 24, height: 24))
120 + let customInfoView = UIView(frame: CGRect(x: 0, y: 0, width: 40, height: 40))
120 121
121 // Create the UIImageView for the custom info image 122 // Create the UIImageView for the custom info image
122 let infoImageView = UIImageView(image: UIImage(named: "info_icon", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)) // Your custom image 123 let infoImageView = UIImageView(image: UIImage(named: "info_icon", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)) // Your custom image
123 infoImageView.contentMode = .scaleAspectFit // Adjust to fit the image correctly 124 infoImageView.contentMode = .scaleAspectFit // Adjust to fit the image correctly
124 - infoImageView.frame = customInfoView.bounds // Set the image to fill the view 125 + // infoImageView.frame = customInfoView.bounds // Set the image to fill the view
126 + infoImageView.frame = CGRect(x: 8, y: 8, width: 24, height: 24)
125 127
126 // Add the image view to the custom view 128 // Add the image view to the custom view
127 customInfoView.addSubview(infoImageView) 129 customInfoView.addSubview(infoImageView)
...@@ -133,6 +135,11 @@ extension UIViewController { ...@@ -133,6 +135,11 @@ extension UIViewController {
133 let tapGesture = UITapGestureRecognizer(target: self, action: #selector(infoButtonTapped)) 135 let tapGesture = UITapGestureRecognizer(target: self, action: #selector(infoButtonTapped))
134 customInfoView.addGestureRecognizer(tapGesture) 136 customInfoView.addGestureRecognizer(tapGesture)
135 137
138 + customInfoView.isAccessibilityElement = true
139 + customInfoView.accessibilityLabel = "Οδηγίες χρήσης"
140 + customInfoView.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
141 + customInfoView.accessibilityTraits = .button
142 +
136 // Add the custom view to the navigation bar as a UIBarButtonItem 143 // Add the custom view to the navigation bar as a UIBarButtonItem
137 let infoBarButtonItem = UIBarButtonItem(customView: customInfoView) 144 let infoBarButtonItem = UIBarButtonItem(customView: customInfoView)
138 self.navigationItem.rightBarButtonItem = infoBarButtonItem 145 self.navigationItem.rightBarButtonItem = infoBarButtonItem
......