Manos Chorianopoulos

Market History accessibilities

......@@ -126,5 +126,16 @@ extension AnalysisHeaderMessageViewCell {
messageLabel.attributedText = coupAttributedString
}
setupAccessibilty()
}
func setupAccessibilty() {
// Disable accessibility for the whole cell
self.isAccessibilityElement = false
messageLabelView.isAccessibilityElement = true
messageLabelView.accessibilityLabel = messageLabel.text
emptyLabel.isAccessibilityElement = true
}
}
......
......@@ -10,6 +10,7 @@ import UIKit
@objc public class AnalysisMoreViewCell: UITableViewCell {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var arrowImage: UIImageView!
@IBOutlet weak var stackView: UIStackView!
// lifecycle
public override func awakeFromNib() {
......@@ -21,5 +22,15 @@ import UIKit
titleLabel.text = "Δες Περισσότερα"
arrowImage.image = UIImage(named: "ic_down_dark_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
setupAccessibilty()
}
func setupAccessibilty() {
// Disable accessibility for the whole cell
self.isAccessibilityElement = false
stackView.isAccessibilityElement = true
stackView.accessibilityLabel = titleLabel.text
}
}
......
......@@ -1671,6 +1671,7 @@
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="arrowImage" destination="UAb-LB-dY7" id="nKr-Gk-SgS"/>
<outlet property="stackView" destination="ctP-ye-yIH" id="1c9-eW-SMf"/>
<outlet property="titleLabel" destination="t7D-IM-UwS" id="nZ6-Nf-utE"/>
</connections>
</tableViewCell>
......
......@@ -106,6 +106,7 @@ extension MarketAnalysisItemViewCell {
let htmlText = couponSetData?.inner_text ?? ""
productTitleLabel.text = htmlText.htmlToString
setupAccessibilty(item: item)
}
func configureCell(item: swiftApi.CouponItemModel, isMarket: Bool) {
......@@ -149,6 +150,26 @@ extension MarketAnalysisItemViewCell {
// let htmlText = couponSetData?.inner_text ?? ""
// subtitleLabel.text = htmlText.htmlToString
setupAccessibilty(item: item)
}
func setupAccessibilty (item: swiftApi.CouponItemModel) {
var formatedDate = ""
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "en_US_POSIX")
if let date = item.redeemed_date {
// Set output format in Greek
dateFormatter.locale = Locale(identifier: "el_GR") // Greek locale
dateFormatter.dateFormat = "d MMMM yyyy"
let resultString = dateFormatter.string(from: date)
formatedDate = resultString
} else {
formatedDate = dateLabel.text ?? ""
}
let accessibilityLabel = formatedDate + ", " + (titleLabel.text ?? "") + ", " + (productTitleLabel.text ?? "") + ", " + (subtitleLabel.text ?? "") + ", " + (priceLabel.text ?? "")
self.isAccessibilityElement = true
self.accessibilityLabel = accessibilityLabel
}
}
......
......@@ -32,6 +32,8 @@ import SwiftEventBus
setBackButton()
setNavigationTitle("Ανάλυση")
contentView.accessibilityElementsHidden = false
// TODO: DELETE if tabs needed again
contentViewHeight.constant = 0
......@@ -90,6 +92,8 @@ import SwiftEventBus
// Notify the child view controller that it has been moved to the parent
childVC.didMove(toParent: self)
// <==
setupAccessibilty()
}
public override func viewWillAppear(_ animated: Bool) {
......@@ -108,7 +112,32 @@ import SwiftEventBus
self.stopTimer()
}
public override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
UIAccessibility.post(notification: .screenChanged, argument: self.navigationItem.titleView)
// }
// Re-enable table view accessibility after the announcement
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
self.contentView.accessibilityElementsHidden = false
}
}
// MARK: - Functions
func setupAccessibilty () {
leftButton.isAccessibilityElement = true
leftButton.accessibilityLabel = leftButton.title(for: .normal)
leftButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
leftButton.accessibilityTraits = .button
rightButton.isAccessibilityElement = true
rightButton.accessibilityLabel = rightButton.title(for: .normal)
rightButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
rightButton.accessibilityTraits = .button
}
func startTimer() {
print("========= GiftsCalculator Timer Started! =========")
......