diff --git a/MoppApp/MoppApp/AccessibilityUtil.swift b/MoppApp/MoppApp/AccessibilityUtil.swift index 5eeb63560..1d25f3801 100644 --- a/MoppApp/MoppApp/AccessibilityUtil.swift +++ b/MoppApp/MoppApp/AccessibilityUtil.swift @@ -29,4 +29,17 @@ class AccessibilityUtil { subview.isAccessibilityElement = isAccessibilityElement } } + + // Adjust spacing between addressee and "Add" buttons + // Adjust so that the spacing is not too big and also don't overlap each other when font size changes + static func adjustSpacing(preferredContentSizeCategory: UIContentSizeCategory, stackView: UIStackView) { + switch preferredContentSizeCategory { + case .extraSmall, .small, .medium, .large, .extraLarge, .extraExtraLarge: + stackView.spacing = -120 + break + default: + stackView.spacing = 0 + break + } + } } diff --git a/MoppApp/MoppApp/Container.storyboard b/MoppApp/MoppApp/Container.storyboard index fc0803d09..30d4aac6b 100644 --- a/MoppApp/MoppApp/Container.storyboard +++ b/MoppApp/MoppApp/Container.storyboard @@ -1514,6 +1514,7 @@ + diff --git a/MoppApp/MoppApp/ContainerAddresseeCell.swift b/MoppApp/MoppApp/ContainerAddresseeCell.swift index 163a5baba..a62c132b6 100644 --- a/MoppApp/MoppApp/ContainerAddresseeCell.swift +++ b/MoppApp/MoppApp/ContainerAddresseeCell.swift @@ -33,13 +33,13 @@ class ContainerAddresseeCell: UITableViewCell, AddresseeActions { @IBOutlet weak var nameLabel: UILabel! @IBOutlet weak var iconImage: UIImageView! + @IBOutlet weak var addresseeMainStackView: UIStackView! @IBOutlet weak var bottomBorder: UIView! @IBOutlet weak var infoLabel: UILabel! @IBOutlet weak var removeButton: UIButton! weak var delegate: ContainerAddresseeCellDelegate! var removeIndex: Int = 0 - @IBAction func removeAddressee(_ sender: Any) { delegate.removeAddressee(index: removeIndex) UIAccessibility.post(notification: .screenChanged, argument: L(.cryptoRecipientRemoved)) @@ -52,5 +52,8 @@ class ContainerAddresseeCell: UITableViewCell, AddresseeActions { removeIndex = index nameLabel.text = determineName(addressee: addressee) infoLabel.text = determineInfo(addressee: addressee) + + let preferredContentSizeCategory = UIApplication.shared.preferredContentSizeCategory + AccessibilityUtil.adjustSpacing(preferredContentSizeCategory: preferredContentSizeCategory, stackView: addresseeMainStackView) } } diff --git a/MoppApp/MoppApp/ContainerFoundAddresseeCell.swift b/MoppApp/MoppApp/ContainerFoundAddresseeCell.swift index 723604a43..b07806363 100644 --- a/MoppApp/MoppApp/ContainerFoundAddresseeCell.swift +++ b/MoppApp/MoppApp/ContainerFoundAddresseeCell.swift @@ -71,21 +71,7 @@ class ContainerFoundAddresseeCell: UITableViewCell, AddresseeActions { addButton.tintColor = UIColor.moppBase } - adjustSpacing() - } - - // Adjust spacing between addressee and "Add" buttons - // Adjust so that the spacing is not too big and also don't overlap each other when font size changes - private func adjustSpacing() { let preferredContentSizeCategory = UIApplication.shared.preferredContentSizeCategory - - switch preferredContentSizeCategory { - case .extraSmall, .small, .medium, .large, .extraLarge, .extraExtraLarge: - addresseeMainStackView.spacing = -120 - break - default: - addresseeMainStackView.spacing = 0 - break - } + AccessibilityUtil.adjustSpacing(preferredContentSizeCategory: preferredContentSizeCategory, stackView: addresseeMainStackView) } } diff --git a/MoppApp/MoppApp/MobileIDChallengeViewController.swift b/MoppApp/MoppApp/MobileIDChallengeViewController.swift index 3d6415469..d311ad30d 100644 --- a/MoppApp/MoppApp/MobileIDChallengeViewController.swift +++ b/MoppApp/MoppApp/MobileIDChallengeViewController.swift @@ -43,9 +43,10 @@ class MobileIDChallengeViewController : UIViewController { var challengeIdAccessibilityLabel = "" var challengeIdNumbers = Array() - @IBOutlet weak var cancelButton: ScaledButton! + @IBOutlet weak var cancelButton: ScaledLabel! - @IBAction func cancelSigningButton(_ sender: Any) { + + @objc func cancelSigningButton(_ sender: UITapGestureRecognizer) { printLog("Cancelling Mobile-ID signing") sessionTimer?.invalidate() NotificationCenter.default.post(name: .signatureSigningCancelledNotificationName, object: nil) @@ -60,15 +61,22 @@ class MobileIDChallengeViewController : UIViewController { super.viewDidLoad() helpLabel.text = L(.mobileIdSignHelpTitle) - cancelButton.setTitle(L(.actionAbort)) + cancelButton.text = L(.actionAbort) cancelButton.accessibilityLabel = L(.actionAbort).lowercased() - if let cancelTitleLabel = cancelButton.titleLabel { + if let cancelTitleLabel = cancelButton { let maxSize: CGFloat = 17 let currentFontSize = cancelTitleLabel.font.pointSize cancelTitleLabel.font = cancelTitleLabel.font.withSize(min(maxSize, currentFontSize)) } + if !(self.cancelButton.gestureRecognizers?.contains(where: { $0 is UITapGestureRecognizer }) ?? false) { + + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.cancelSigningButton(_:))) + self.cancelButton.addGestureRecognizer(tapGesture) + self.cancelButton.isUserInteractionEnabled = true + } + codeLabel.isHidden = true currentProgress = 0 timeoutProgressView.progress = 0 diff --git a/MoppApp/MoppApp/SmartIDChallengeViewController.swift b/MoppApp/MoppApp/SmartIDChallengeViewController.swift index 14c6c30d9..1473bbe9e 100644 --- a/MoppApp/MoppApp/SmartIDChallengeViewController.swift +++ b/MoppApp/MoppApp/SmartIDChallengeViewController.swift @@ -38,10 +38,10 @@ class SmartIDChallengeViewController : UIViewController { var isAnnouncementMade = false var isProgressBarFocused = false - @IBOutlet weak var cancelButton: ScaledButton! + @IBOutlet weak var cancelButton: ScaledLabel! - @IBAction func cancelSigningButton(_ sender: Any) { - printLog("Cancelling Mobile-ID signing") + @objc func cancelSigningButton(_ sender: UITapGestureRecognizer) { + printLog("Cancelling Smart-ID signing") sessionTimer?.invalidate() NotificationCenter.default.post(name: .signatureSigningCancelledNotificationName, object: nil) NotificationCenter.default.removeObserver(self) @@ -54,15 +54,22 @@ class SmartIDChallengeViewController : UIViewController { override func viewDidLoad() { super.viewDidLoad() helpLabel.text = L(.smartIdChallengeTitle) - cancelButton.setTitle(L(.actionAbort)) + cancelButton.text = L(.actionAbort) cancelButton.accessibilityLabel = L(.actionAbort).lowercased() - if let cancelTitleLabel = cancelButton.titleLabel { + if let cancelTitleLabel = cancelButton { let maxSize: CGFloat = 17 let currentFontSize = cancelTitleLabel.font.pointSize cancelTitleLabel.font = cancelTitleLabel.font.withSize(min(maxSize, currentFontSize)) } + if !(self.cancelButton.gestureRecognizers?.contains(where: { $0 is UITapGestureRecognizer }) ?? false) { + + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(self.cancelSigningButton(_:))) + self.cancelButton.addGestureRecognizer(tapGesture) + self.cancelButton.isUserInteractionEnabled = true + } + currentProgress = 0 timeoutProgressView.progress = 0 timeoutProgressView.accessibilityUserInputLabels = [""] @@ -232,7 +239,6 @@ class SmartIDChallengeViewController : UIViewController { self.timeoutProgressView.isAccessibilityElement = true self.helpLabel.isAccessibilityElement = true self.cancelButton.isAccessibilityElement = true - self.cancelButton.titleLabel?.isAccessibilityElement = true codeLabel.accessibilityLabel = getCodeLabelAccessibilityLabel(withProgress: false) } } @@ -258,7 +264,6 @@ class SmartIDChallengeViewController : UIViewController { self.timeoutProgressView.isAccessibilityElement = false self.helpLabel.isAccessibilityElement = false self.cancelButton.isAccessibilityElement = false - self.cancelButton.titleLabel?.isAccessibilityElement = false DispatchQueue.main.async { DispatchQueue.main.asyncAfter(deadline: .now() + 3) { DispatchQueue(label: "codeLabel", qos: .userInitiated).sync { diff --git a/MoppApp/MoppApp/TokenFlow.storyboard b/MoppApp/MoppApp/TokenFlow.storyboard index 393943036..210e37ecb 100644 --- a/MoppApp/MoppApp/TokenFlow.storyboard +++ b/MoppApp/MoppApp/TokenFlow.storyboard @@ -657,7 +657,7 @@ - + - - - - - - + + + + + - - + - + - + + @@ -733,7 +717,7 @@ - + @@ -774,7 +758,7 @@ - + @@ -1026,7 +1010,7 @@ - + - + + + + - - - - + + - + + @@ -1122,7 +1100,7 @@ - +