Manos Chorianopoulos

History, SharingHistory accesibilities

...@@ -51,5 +51,13 @@ extension AnalysisHeaderViewCell { ...@@ -51,5 +51,13 @@ extension AnalysisHeaderViewCell {
51 itemImage.image = UIImage(named: "ic_gift_history", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) 51 itemImage.image = UIImage(named: "ic_gift_history", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
52 } 52 }
53 53
54 + setupAccessibilty()
55 + }
56 +
57 + func setupAccessibilty() {
58 + // Disable accessibility for the whole cell
59 + self.isAccessibilityElement = false
60 +
61 + emptyLabel.isAccessibilityElement = true
54 } 62 }
55 } 63 }
......
...@@ -85,6 +85,8 @@ extension AnalysisItemViewCell { ...@@ -85,6 +85,8 @@ extension AnalysisItemViewCell {
85 } else if ("received" == item._sharing_type) { 85 } else if ("received" == item._sharing_type) {
86 subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn) 86 subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn)
87 } 87 }
88 +
89 + setupAccessibilty(item: item)
88 } 90 }
89 91
90 func configureCell(item: swiftApi.SharingCouponModel, isMarket: Bool) { 92 func configureCell(item: swiftApi.SharingCouponModel, isMarket: Bool) {
...@@ -118,6 +120,8 @@ extension AnalysisItemViewCell { ...@@ -118,6 +120,8 @@ extension AnalysisItemViewCell {
118 } else if ("received" == item._sharing_type) { 120 } else if ("received" == item._sharing_type) {
119 subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn) 121 subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από " + item._sender_msisdn)
120 } 122 }
123 +
124 + setupAccessibilty(item: item)
121 } 125 }
122 126
123 func configureCell(item: swiftApi.CouponItemModel) { 127 func configureCell(item: swiftApi.CouponItemModel) {
...@@ -160,6 +164,7 @@ extension AnalysisItemViewCell { ...@@ -160,6 +164,7 @@ extension AnalysisItemViewCell {
160 // let htmlText = couponSetData?.inner_text ?? "" 164 // let htmlText = couponSetData?.inner_text ?? ""
161 // subtitleLabel.text = htmlText.htmlToString 165 // subtitleLabel.text = htmlText.htmlToString
162 166
167 + setupAccessibilty(item: item)
163 } 168 }
164 169
165 func configureCell(item: swiftApi.CouponItemModel, isMarket: Bool) { 170 func configureCell(item: swiftApi.CouponItemModel, isMarket: Bool) {
...@@ -202,5 +207,44 @@ extension AnalysisItemViewCell { ...@@ -202,5 +207,44 @@ extension AnalysisItemViewCell {
202 // let htmlText = couponSetData?.inner_text ?? "" 207 // let htmlText = couponSetData?.inner_text ?? ""
203 // subtitleLabel.text = htmlText.htmlToString 208 // subtitleLabel.text = htmlText.htmlToString
204 209
210 + setupAccessibilty(item: item)
205 } 211 }
212 +
213 + func setupAccessibilty (item: swiftApi.CouponItemModel) {
214 + var formatedDate = ""
215 + let dateFormatter = DateFormatter()
216 + dateFormatter.locale = Locale(identifier: "en_US_POSIX")
217 + if let date = item.redeemed_date {
218 + // Set output format in Greek
219 + dateFormatter.locale = Locale(identifier: "el_GR") // Greek locale
220 + dateFormatter.dateFormat = "d MMMM yyyy"
221 + let resultString = dateFormatter.string(from: date)
222 + formatedDate = resultString
223 + } else {
224 + formatedDate = dateLabel.text ?? ""
225 + }
226 +
227 + let accessibilityLabel = formatedDate + ", " + (titleLabel.text ?? "") + ", " + (subtitleLabel.text ?? "") + ", " + (priceLabel.text ?? "")
228 + self.isAccessibilityElement = true
229 + self.accessibilityLabel = accessibilityLabel
230 + }
231 +
232 + func setupAccessibilty (item: swiftApi.SharingCouponModel) {
233 + var formatedDate = ""
234 + let dateFormatter = DateFormatter()
235 + dateFormatter.locale = Locale(identifier: "en_US_POSIX")
236 + if let date = item._dateValue {
237 + // Set output format in Greek
238 + dateFormatter.locale = Locale(identifier: "el_GR") // Greek locale
239 + dateFormatter.dateFormat = "d MMMM yyyy"
240 + let resultString = dateFormatter.string(from: date)
241 + formatedDate = resultString
242 + } else {
243 + formatedDate = dateLabel.text ?? ""
244 + }
245 +
246 + let accessibilityLabel = formatedDate + ", " + (titleLabel.text ?? "") + ", " + (subtitleLabel.text ?? "") + ", " + (priceLabel.text ?? "")
247 + self.isAccessibilityElement = true
248 + self.accessibilityLabel = accessibilityLabel
249 + }
206 } 250 }
......
...@@ -1862,6 +1862,7 @@ ...@@ -1862,6 +1862,7 @@
1862 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 1862 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
1863 <connections> 1863 <connections>
1864 <outlet property="arrowImage" destination="w3t-uo-L5p" id="gDu-xC-MXj"/> 1864 <outlet property="arrowImage" destination="w3t-uo-L5p" id="gDu-xC-MXj"/>
1865 + <outlet property="stackView" destination="Ujy-Ns-gSY" id="kJV-gV-Dqh"/>
1865 <outlet property="titleLabel" destination="jD8-wg-76D" id="K6c-qT-EMs"/> 1866 <outlet property="titleLabel" destination="jD8-wg-76D" id="K6c-qT-EMs"/>
1866 </connections> 1867 </connections>
1867 </tableViewCell> 1868 </tableViewCell>
...@@ -7706,6 +7707,7 @@ ...@@ -7706,6 +7707,7 @@
7706 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 7707 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
7707 <connections> 7708 <connections>
7708 <outlet property="arrowImage" destination="eGc-lu-1DB" id="msZ-3k-oO3"/> 7709 <outlet property="arrowImage" destination="eGc-lu-1DB" id="msZ-3k-oO3"/>
7710 + <outlet property="stackView" destination="DHl-3e-Mz6" id="2Ea-MF-eLD"/>
7709 <outlet property="titleLabel" destination="gOz-Rd-1D4" id="5Ps-AV-qMQ"/> 7711 <outlet property="titleLabel" destination="gOz-Rd-1D4" id="5Ps-AV-qMQ"/>
7710 </connections> 7712 </connections>
7711 </tableViewCell> 7713 </tableViewCell>
......
...@@ -6855,6 +6855,7 @@ public class swiftApi { ...@@ -6855,6 +6855,7 @@ public class swiftApi {
6855 public class SharingCouponModel: Codable { 6855 public class SharingCouponModel: Codable {
6856 private var couponset_uuid: String? 6856 private var couponset_uuid: String?
6857 private var date: String? 6857 private var date: String?
6858 + private var dateValue: Date?
6858 private var discount: String? 6859 private var discount: String?
6859 private var merchant_uuid: String? 6860 private var merchant_uuid: String?
6860 private var sharing_type: String? 6861 private var sharing_type: String?
...@@ -6868,6 +6869,7 @@ public class swiftApi { ...@@ -6868,6 +6869,7 @@ public class swiftApi {
6868 public init() { 6869 public init() {
6869 self.couponset_uuid = "" 6870 self.couponset_uuid = ""
6870 self.date = "" 6871 self.date = ""
6872 + self.dateValue = nil
6871 self.discount = "" 6873 self.discount = ""
6872 self.merchant_uuid = "" 6874 self.merchant_uuid = ""
6873 self.sharing_type = "" 6875 self.sharing_type = ""
...@@ -6907,8 +6909,10 @@ public class swiftApi { ...@@ -6907,8 +6909,10 @@ public class swiftApi {
6907 dateFormatter.dateFormat = "dd/MM/yyyy" 6909 dateFormatter.dateFormat = "dd/MM/yyyy"
6908 let resultString = dateFormatter.string(from: date) 6910 let resultString = dateFormatter.string(from: date)
6909 self.date = resultString 6911 self.date = resultString
6912 + self.dateValue = date
6910 } else { 6913 } else {
6911 self.date = "" 6914 self.date = ""
6915 + self.dateValue = nil
6912 } 6916 }
6913 6917
6914 if let transaction_metadata_json = dictionary["transaction_metadata"] as? AnyObject { 6918 if let transaction_metadata_json = dictionary["transaction_metadata"] as? AnyObject {
...@@ -6961,6 +6965,15 @@ public class swiftApi { ...@@ -6961,6 +6965,15 @@ public class swiftApi {
6961 } 6965 }
6962 } 6966 }
6963 6967
6968 + public var _dateValue: Date? {
6969 + get { // getter
6970 + return self.dateValue
6971 + }
6972 + set(newValue) { //setter
6973 + self.dateValue = newValue
6974 + }
6975 + }
6976 +
6964 public var _discount: String { 6977 public var _discount: String {
6965 get { // getter 6978 get { // getter
6966 return self.discount ?? "" 6979 return self.discount ?? ""
......