Manos Chorianopoulos

MyRewards Accessibilities

......@@ -58,5 +58,15 @@ import UIKit
}
badgeCountLabel.text = String(badgeCount)
setupAccessibilty(badgeText: badgeLabel.text ?? "", badgeCount: badgeCount, showBadgeCount: !badgeCountView.isHidden)
}
func setupAccessibilty (badgeText: String, badgeCount: Int, showBadgeCount: Bool) {
self.isAccessibilityElement = true
self.accessibilityLabel = badgeText + ", " + (showBadgeCount ? String(badgeCount) : "")
self.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
self.accessibilityTraits = .button
}
}
......
......@@ -11,6 +11,7 @@ import SwiftEventBus
@objc public class WalletActiveCouponsScrollTableViewCell: UITableViewCell {
@IBOutlet weak var sectionTitleLabel: UILabel!
@IBOutlet weak var historyButtonImage: UIImageView!
@IBOutlet weak var historyButton: UIButton!
@IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var dotLeft: UIView!
......@@ -54,6 +55,19 @@ import SwiftEventBus
func configureCell(dfyCount: Int, smCount: Int, gfyCount: Int, boxCount: Int) {
sortBadges(dfyCount, smCount, gfyCount, boxCount)
setupAccessibilty()
}
func setupAccessibilty () {
// Disable accessibility for the whole cell
self.isAccessibilityElement = false
sectionTitleLabel.isAccessibilityElement = true
historyButton.isAccessibilityElement = true
historyButton.accessibilityLabel = "Ιστορικό"
historyButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
historyButton.accessibilityTraits = .button
}
func sortBadges(_ dfyCount: Int, _ smCount: Int, _ gfyCount: Int, _ boxCount: Int) {
......
......@@ -97,6 +97,23 @@ import UIKit
bannerView.isHidden = false
bannerCenteredView.isHidden = true
}
setupAccessibilty(buttonTitle: (isCentered ? bannerCenteredLabel.text : bannerLabel.text) ?? "")
}
func setupAccessibilty (buttonTitle: String) {
// Disable accessibility for the whole cell
self.isAccessibilityElement = false
bannerView.isAccessibilityElement = true
bannerView.accessibilityLabel = buttonTitle
bannerView.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
bannerView.accessibilityTraits = .button
bannerCenteredView.isAccessibilityElement = true
bannerCenteredView.accessibilityLabel = buttonTitle
bannerCenteredView.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
bannerCenteredView.accessibilityTraits = .button
}
}
......
......@@ -595,6 +595,17 @@ import SwiftEventBus
}
}
// Auto focus Accessibility
// public override func viewDidAppear(_ animated: Bool) {
// super.viewDidAppear(animated)
//
// DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
// if let firstCell = self.tableView.visibleCells.first as? WalletActiveCouponsScrollTableViewCell {
// UIAccessibility.post(notification: .layoutChanged, argument: firstCell.sectionTitleLabel)
// }
// }
// }
public override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
......@@ -857,6 +868,23 @@ import SwiftEventBus
swiftApi().openQuestionnaire(self);
}
@IBAction func questionnaireBannerButtonAction(_ sender: Any) {
swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "Questionnaire"))
swiftApi().openQuestionnaire(self);
}
@IBAction func vouchersBannerButtonAction(_ sender: Any) {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "did_tap_vouchers_badge"
firebaseEvent.setParameter = ("screen", "Loyalty Wallet")
SwiftEventBus.post("firebase", sender: firebaseEvent)
swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "VouchersBadge"))
SwiftEventBus.post("vouchers_banner_pressed")
}
@IBAction func historyButtonAction(_ sender: Any) {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "did_tap_history_badge"
......@@ -1482,9 +1510,10 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
} else if (indexPath.section == 1) {
// Do nothing
} else if (indexPath.section == 2) {
swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "Questionnaire"))
swiftApi().openQuestionnaire(self);
// Do nothing - action transfered to questionnaireBannerButtonAction
// swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "Questionnaire"))
//
// swiftApi().openQuestionnaire(self);
}
// else if (indexPath.section == 2) {
......@@ -1501,14 +1530,15 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
//
// }
else if (indexPath.section == 3) {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "did_tap_vouchers_badge"
firebaseEvent.setParameter = ("screen", "Loyalty Wallet")
SwiftEventBus.post("firebase", sender: firebaseEvent)
swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "VouchersBadge"))
SwiftEventBus.post("vouchers_banner_pressed")
// // Do nothing - action transfered to vouchersBannerButtonAction
// let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
// firebaseEvent._eventName = "did_tap_vouchers_badge"
// firebaseEvent.setParameter = ("screen", "Loyalty Wallet")
// SwiftEventBus.post("firebase", sender: firebaseEvent)
//
// swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "VouchersBadge"))
//
// SwiftEventBus.post("vouchers_banner_pressed")
} else if (indexPath.section == 4) {
// Do nothing
......
......@@ -6,6 +6,7 @@
//
import UIKit
import SwiftEventBus
@objc public class WalletVouchersBannerTableViewCell: UITableViewCell {
@IBOutlet weak var separatorView: UIView!
......@@ -78,6 +79,20 @@ import UIKit
voucherBannerLabel.frame.size.width = voucherBannerLabel.intrinsicContentSize.width
voucherCountView.isHidden = false
}
setupAccessibilty(active: active, buttonTitle: voucherBannerLabel.text ?? "")
}
func setupAccessibilty (active: Bool ,buttonTitle: String) {
// Disable accessibility for the whole cell
self.isAccessibilityElement = false
sectionTitleLabel.isAccessibilityElement = true
voucherBannerView.isAccessibilityElement = true
voucherBannerView.accessibilityLabel = buttonTitle + (!active ? ", 0" : "") + (!active ? ", Ανενεργό" : "")
voucherBannerView.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
voucherBannerView.accessibilityTraits = .button
}
}
......