Showing
1 changed file
with
62 additions
and
0 deletions
... | @@ -90,6 +90,9 @@ import AVFoundation | ... | @@ -90,6 +90,9 @@ import AVFoundation |
90 | // Do any additional setup after loading the view. | 90 | // Do any additional setup after loading the view. |
91 | setBackButton() | 91 | setBackButton() |
92 | setNavigationTitle("Εκπτωτικό κουπόνι") | 92 | setNavigationTitle("Εκπτωτικό κουπόνι") |
93 | + | ||
94 | + // Temporarily disable the table view's accessibility to prevent immediate focus shift | ||
95 | + self.mainView.accessibilityElementsHidden = true | ||
93 | 96 | ||
94 | // backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil) | 97 | // backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil) |
95 | backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 98 | backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
... | @@ -552,6 +555,7 @@ import AVFoundation | ... | @@ -552,6 +555,7 @@ import AVFoundation |
552 | print("Coupon Description: " + (couponSetData?.short_description ?? "")) | 555 | print("Coupon Description: " + (couponSetData?.short_description ?? "")) |
553 | print("Coupon Expiration: " + (coupon?.expiration ?? "")) | 556 | print("Coupon Expiration: " + (coupon?.expiration ?? "")) |
554 | 557 | ||
558 | + setupAccessibilty() | ||
555 | } | 559 | } |
556 | 560 | ||
557 | public override func viewWillAppear(_ animated: Bool) { | 561 | public override func viewWillAppear(_ animated: Bool) { |
... | @@ -562,6 +566,19 @@ import AVFoundation | ... | @@ -562,6 +566,19 @@ import AVFoundation |
562 | self.navigationController?.hideHairline() | 566 | self.navigationController?.hideHairline() |
563 | } | 567 | } |
564 | 568 | ||
569 | + public override func viewDidAppear(_ animated: Bool) { | ||
570 | + super.viewDidAppear(animated) | ||
571 | + | ||
572 | +// DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { | ||
573 | + UIAccessibility.post(notification: .screenChanged, argument: self.navigationItem.titleView) | ||
574 | +// } | ||
575 | + | ||
576 | + // Re-enable table view accessibility after the announcement | ||
577 | + DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { | ||
578 | + self.mainView.accessibilityElementsHidden = false | ||
579 | + } | ||
580 | + } | ||
581 | + | ||
565 | public func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { | 582 | public func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool { |
566 | UIApplication.shared.open(URL) | 583 | UIApplication.shared.open(URL) |
567 | 584 | ||
... | @@ -571,6 +588,44 @@ import AVFoundation | ... | @@ -571,6 +588,44 @@ import AVFoundation |
571 | 588 | ||
572 | 589 | ||
573 | // MARK: - Functions | 590 | // MARK: - Functions |
591 | + func setupAccessibilty () { | ||
592 | + couponImage.isAccessibilityElement = true | ||
593 | + couponImage.accessibilityLabel = "Φωτογραφία εκπτωτικού κουπονιού" | ||
594 | + couponImage.accessibilityTraits = .image | ||
595 | + | ||
596 | + var formatedExpiration = "" | ||
597 | + let dateFormatter = DateFormatter() | ||
598 | +// dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss" | ||
599 | + dateFormatter.locale = Locale(identifier: "en_US_POSIX") | ||
600 | + if let date = coupon?.expirationDate { | ||
601 | + // Set output format in Greek | ||
602 | + dateFormatter.locale = Locale(identifier: "el_GR") // Greek locale | ||
603 | + dateFormatter.dateFormat = "d MMMM yyyy" | ||
604 | + let resultString = dateFormatter.string(from: date) | ||
605 | + formatedExpiration = "Ισχύει έως " + resultString | ||
606 | + } else { | ||
607 | + formatedExpiration = "Ισχύει έως " + (coupon?.expiration ?? "") | ||
608 | + } | ||
609 | + expirationLabel.isAccessibilityElement = true | ||
610 | + expirationLabel.accessibilityLabel = formatedExpiration | ||
611 | + | ||
612 | + redeemButton.isAccessibilityElement = true | ||
613 | + redeemButton.accessibilityLabel = redeemButton.title(for: .normal) | ||
614 | + redeemButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα" | ||
615 | + redeemButton.accessibilityTraits = .button | ||
616 | + | ||
617 | + mapButton.isAccessibilityElement = true | ||
618 | + mapButton.accessibilityLabel = mapButton.title(for: .normal) | ||
619 | + mapButton.accessibilityHint = "Διπλό πάτημα για άνοιγμα" | ||
620 | + mapButton.accessibilityTraits = .button | ||
621 | + | ||
622 | + termsButton.isAccessibilityElement = true | ||
623 | + termsButton.accessibilityLabel = termsButton.title(for: .normal) | ||
624 | + termsButton.accessibilityHint = "Διπλό πάτημα για εμφάνιση" | ||
625 | + termsButton.accessibilityTraits = .button | ||
626 | + termsButton.accessibilityValue = "Συμπτυγμένο" | ||
627 | + } | ||
628 | + | ||
574 | func toggleTerms() { | 629 | func toggleTerms() { |
575 | if (termsVisible) { | 630 | if (termsVisible) { |
576 | termsTextView.isHidden = false | 631 | termsTextView.isHidden = false |
... | @@ -578,11 +633,18 @@ import AVFoundation | ... | @@ -578,11 +633,18 @@ import AVFoundation |
578 | termsTextViewHeight.constant = termsTextView.sizeThatFits(targetSize).height | 633 | termsTextViewHeight.constant = termsTextView.sizeThatFits(targetSize).height |
579 | 634 | ||
580 | termsButton.setImage(UIImage(named: "ic_up_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) | 635 | termsButton.setImage(UIImage(named: "ic_up_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) |
636 | + | ||
637 | + termsButton.accessibilityValue = "Ανεπτυγμένο" | ||
638 | + termsButton.accessibilityHint = "Διπλό πάτημα για απόκρυψη" | ||
639 | + | ||
581 | } else { | 640 | } else { |
582 | termsTextView.isHidden = true | 641 | termsTextView.isHidden = true |
583 | termsTextViewHeight.constant = CGFloat(0) | 642 | termsTextViewHeight.constant = CGFloat(0) |
584 | 643 | ||
585 | termsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) | 644 | termsButton.setImage(UIImage(named: "ic_down_dark_2.png", in: MyEmptyClass.resourceBundle(), compatibleWith: nil), for: .normal) |
645 | + | ||
646 | + termsButton.accessibilityValue = "Συμπτυγμένο" | ||
647 | + termsButton.accessibilityHint = "Διπλό πάτημα για εμφάνιση" | ||
586 | } | 648 | } |
587 | } | 649 | } |
588 | 650 | ... | ... |
-
Please register or login to post a comment