Manos Chorianopoulos

MyRewards Accessibilities

...@@ -58,5 +58,15 @@ import UIKit ...@@ -58,5 +58,15 @@ import UIKit
58 } 58 }
59 59
60 badgeCountLabel.text = String(badgeCount) 60 badgeCountLabel.text = String(badgeCount)
61 +
62 + setupAccessibilty(badgeText: badgeLabel.text ?? "", badgeCount: badgeCount, showBadgeCount: !badgeCountView.isHidden)
63 + }
64 +
65 + func setupAccessibilty (badgeText: String, badgeCount: Int, showBadgeCount: Bool) {
66 + self.isAccessibilityElement = true
67 + self.accessibilityLabel = badgeText + ", " + (showBadgeCount ? String(badgeCount) : "")
68 + self.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
69 + self.accessibilityTraits = .button
70 +
61 } 71 }
62 } 72 }
......
...@@ -11,6 +11,7 @@ import SwiftEventBus ...@@ -11,6 +11,7 @@ import SwiftEventBus
11 @objc public class WalletActiveCouponsScrollTableViewCell: UITableViewCell { 11 @objc public class WalletActiveCouponsScrollTableViewCell: UITableViewCell {
12 @IBOutlet weak var sectionTitleLabel: UILabel! 12 @IBOutlet weak var sectionTitleLabel: UILabel!
13 @IBOutlet weak var historyButtonImage: UIImageView! 13 @IBOutlet weak var historyButtonImage: UIImageView!
14 + @IBOutlet weak var historyButton: UIButton!
14 15
15 @IBOutlet weak var collectionView: UICollectionView! 16 @IBOutlet weak var collectionView: UICollectionView!
16 @IBOutlet weak var dotLeft: UIView! 17 @IBOutlet weak var dotLeft: UIView!
...@@ -45,7 +46,7 @@ import SwiftEventBus ...@@ -45,7 +46,7 @@ import SwiftEventBus
45 dotRight.layer.cornerRadius = 4 46 dotRight.layer.cornerRadius = 4
46 47
47 } 48 }
48 - 49 +
49 public override func setSelected(_ selected: Bool, animated: Bool) { 50 public override func setSelected(_ selected: Bool, animated: Bool) {
50 super.setSelected(selected, animated: animated) 51 super.setSelected(selected, animated: animated)
51 52
...@@ -54,8 +55,21 @@ import SwiftEventBus ...@@ -54,8 +55,21 @@ import SwiftEventBus
54 55
55 func configureCell(dfyCount: Int, smCount: Int, gfyCount: Int, boxCount: Int) { 56 func configureCell(dfyCount: Int, smCount: Int, gfyCount: Int, boxCount: Int) {
56 sortBadges(dfyCount, smCount, gfyCount, boxCount) 57 sortBadges(dfyCount, smCount, gfyCount, boxCount)
58 + setupAccessibilty()
57 } 59 }
58 60
61 + func setupAccessibilty () {
62 + // Disable accessibility for the whole cell
63 + self.isAccessibilityElement = false
64 +
65 + sectionTitleLabel.isAccessibilityElement = true
66 +
67 + historyButton.isAccessibilityElement = true
68 + historyButton.accessibilityLabel = "Ιστορικό"
69 + historyButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
70 + historyButton.accessibilityTraits = .button
71 + }
72 +
59 func sortBadges(_ dfyCount: Int, _ smCount: Int, _ gfyCount: Int, _ boxCount: Int) { 73 func sortBadges(_ dfyCount: Int, _ smCount: Int, _ gfyCount: Int, _ boxCount: Int) {
60 // deals weight 3 74 // deals weight 3
61 // sm weight 2 75 // sm weight 2
......
...@@ -97,6 +97,23 @@ import UIKit ...@@ -97,6 +97,23 @@ import UIKit
97 bannerView.isHidden = false 97 bannerView.isHidden = false
98 bannerCenteredView.isHidden = true 98 bannerCenteredView.isHidden = true
99 } 99 }
100 +
101 + setupAccessibilty(buttonTitle: (isCentered ? bannerCenteredLabel.text : bannerLabel.text) ?? "")
102 + }
103 +
104 + func setupAccessibilty (buttonTitle: String) {
105 + // Disable accessibility for the whole cell
106 + self.isAccessibilityElement = false
107 +
108 + bannerView.isAccessibilityElement = true
109 + bannerView.accessibilityLabel = buttonTitle
110 + bannerView.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
111 + bannerView.accessibilityTraits = .button
112 +
113 + bannerCenteredView.isAccessibilityElement = true
114 + bannerCenteredView.accessibilityLabel = buttonTitle
115 + bannerCenteredView.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
116 + bannerCenteredView.accessibilityTraits = .button
100 } 117 }
101 118
102 } 119 }
......
...@@ -595,6 +595,17 @@ import SwiftEventBus ...@@ -595,6 +595,17 @@ import SwiftEventBus
595 } 595 }
596 } 596 }
597 597
598 + // Auto focus Accessibility
599 +// public override func viewDidAppear(_ animated: Bool) {
600 +// super.viewDidAppear(animated)
601 +//
602 +// DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
603 +// if let firstCell = self.tableView.visibleCells.first as? WalletActiveCouponsScrollTableViewCell {
604 +// UIAccessibility.post(notification: .layoutChanged, argument: firstCell.sectionTitleLabel)
605 +// }
606 +// }
607 +// }
608 +
598 public override func viewDidLayoutSubviews() { 609 public override func viewDidLayoutSubviews() {
599 super.viewDidLayoutSubviews() 610 super.viewDidLayoutSubviews()
600 611
...@@ -857,6 +868,23 @@ import SwiftEventBus ...@@ -857,6 +868,23 @@ import SwiftEventBus
857 swiftApi().openQuestionnaire(self); 868 swiftApi().openQuestionnaire(self);
858 } 869 }
859 870
871 + @IBAction func questionnaireBannerButtonAction(_ sender: Any) {
872 + swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "Questionnaire"))
873 +
874 + swiftApi().openQuestionnaire(self);
875 + }
876 +
877 + @IBAction func vouchersBannerButtonAction(_ sender: Any) {
878 + let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
879 + firebaseEvent._eventName = "did_tap_vouchers_badge"
880 + firebaseEvent.setParameter = ("screen", "Loyalty Wallet")
881 + SwiftEventBus.post("firebase", sender: firebaseEvent)
882 +
883 + swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "VouchersBadge"))
884 +
885 + SwiftEventBus.post("vouchers_banner_pressed")
886 + }
887 +
860 @IBAction func historyButtonAction(_ sender: Any) { 888 @IBAction func historyButtonAction(_ sender: Any) {
861 let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel() 889 let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
862 firebaseEvent._eventName = "did_tap_history_badge" 890 firebaseEvent._eventName = "did_tap_history_badge"
...@@ -1482,9 +1510,10 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -1482,9 +1510,10 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
1482 } else if (indexPath.section == 1) { 1510 } else if (indexPath.section == 1) {
1483 // Do nothing 1511 // Do nothing
1484 } else if (indexPath.section == 2) { 1512 } else if (indexPath.section == 2) {
1485 - swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "Questionnaire")) 1513 + // Do nothing - action transfered to questionnaireBannerButtonAction
1486 - 1514 +// swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "Questionnaire"))
1487 - swiftApi().openQuestionnaire(self); 1515 +//
1516 +// swiftApi().openQuestionnaire(self);
1488 1517
1489 } 1518 }
1490 // else if (indexPath.section == 2) { 1519 // else if (indexPath.section == 2) {
...@@ -1501,14 +1530,15 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{ ...@@ -1501,14 +1530,15 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
1501 // 1530 //
1502 // } 1531 // }
1503 else if (indexPath.section == 3) { 1532 else if (indexPath.section == 3) {
1504 - let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel() 1533 +// // Do nothing - action transfered to vouchersBannerButtonAction
1505 - firebaseEvent._eventName = "did_tap_vouchers_badge" 1534 +// let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
1506 - firebaseEvent.setParameter = ("screen", "Loyalty Wallet") 1535 +// firebaseEvent._eventName = "did_tap_vouchers_badge"
1507 - SwiftEventBus.post("firebase", sender: firebaseEvent) 1536 +// firebaseEvent.setParameter = ("screen", "Loyalty Wallet")
1508 - 1537 +// SwiftEventBus.post("firebase", sender: firebaseEvent)
1509 - swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "VouchersBadge")) 1538 +//
1510 - 1539 +// swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "VouchersBadge"))
1511 - SwiftEventBus.post("vouchers_banner_pressed") 1540 +//
1541 +// SwiftEventBus.post("vouchers_banner_pressed")
1512 1542
1513 } else if (indexPath.section == 4) { 1543 } else if (indexPath.section == 4) {
1514 // Do nothing 1544 // Do nothing
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
6 // 6 //
7 7
8 import UIKit 8 import UIKit
9 +import SwiftEventBus
9 10
10 @objc public class WalletVouchersBannerTableViewCell: UITableViewCell { 11 @objc public class WalletVouchersBannerTableViewCell: UITableViewCell {
11 @IBOutlet weak var separatorView: UIView! 12 @IBOutlet weak var separatorView: UIView!
...@@ -78,6 +79,20 @@ import UIKit ...@@ -78,6 +79,20 @@ import UIKit
78 voucherBannerLabel.frame.size.width = voucherBannerLabel.intrinsicContentSize.width 79 voucherBannerLabel.frame.size.width = voucherBannerLabel.intrinsicContentSize.width
79 voucherCountView.isHidden = false 80 voucherCountView.isHidden = false
80 } 81 }
82 +
83 + setupAccessibilty(active: active, buttonTitle: voucherBannerLabel.text ?? "")
81 } 84 }
82 - 85 +
86 + func setupAccessibilty (active: Bool ,buttonTitle: String) {
87 + // Disable accessibility for the whole cell
88 + self.isAccessibilityElement = false
89 +
90 + sectionTitleLabel.isAccessibilityElement = true
91 +
92 + voucherBannerView.isAccessibilityElement = true
93 + voucherBannerView.accessibilityLabel = buttonTitle + (!active ? ", 0" : "") + (!active ? ", Ανενεργό" : "")
94 + voucherBannerView.accessibilityHint = "Διπλό πάτημα για άνοιγμα"
95 + voucherBannerView.accessibilityTraits = .button
96 + }
97 +
83 } 98 }
......