diff --git a/Pods/RocketChatViewController/Composer/Assets/cs.lproj/Localizable.strings b/Pods/RocketChatViewController/Composer/Assets/cs.lproj/Localizable.strings index cd8d82b5d5..8bc5cba529 100644 --- a/Pods/RocketChatViewController/Composer/Assets/cs.lproj/Localizable.strings +++ b/Pods/RocketChatViewController/Composer/Assets/cs.lproj/Localizable.strings @@ -7,3 +7,13 @@ "composer.sendButton.label" = "Send"; // TODO "composer.micButton.label" = "Voice message"; // TODO "composer.addButton.label" = "Share media"; // TODO +"composer.redMicButton.label" = "Stop recording"; // TODO +"composer.playButton.label" = "Play"; // TODO +"composer.pauseButton.label" = "Pause"; // TODO +"composer.discardButton.label" = "Discard"; // TODO +"composer.duration.label" = "Duration,"; // TODO +"composer.recordaudioview.swipe.label" = "Swipe left to cancel"; // TODO +"composer.slider.position.label" = "Position, "; // TODO +"composer.slider.of.label" = " of "; // TODO + +"composer.recordaudioview.micButton.hint" = "Double tap to record"; // TODO diff --git a/Pods/RocketChatViewController/Composer/Assets/de.lproj/Localizable.strings b/Pods/RocketChatViewController/Composer/Assets/de.lproj/Localizable.strings index cd8d82b5d5..8bc5cba529 100644 --- a/Pods/RocketChatViewController/Composer/Assets/de.lproj/Localizable.strings +++ b/Pods/RocketChatViewController/Composer/Assets/de.lproj/Localizable.strings @@ -7,3 +7,13 @@ "composer.sendButton.label" = "Send"; // TODO "composer.micButton.label" = "Voice message"; // TODO "composer.addButton.label" = "Share media"; // TODO +"composer.redMicButton.label" = "Stop recording"; // TODO +"composer.playButton.label" = "Play"; // TODO +"composer.pauseButton.label" = "Pause"; // TODO +"composer.discardButton.label" = "Discard"; // TODO +"composer.duration.label" = "Duration,"; // TODO +"composer.recordaudioview.swipe.label" = "Swipe left to cancel"; // TODO +"composer.slider.position.label" = "Position, "; // TODO +"composer.slider.of.label" = " of "; // TODO + +"composer.recordaudioview.micButton.hint" = "Double tap to record"; // TODO diff --git a/Pods/RocketChatViewController/Composer/Assets/el.lproj/Localizable.strings b/Pods/RocketChatViewController/Composer/Assets/el.lproj/Localizable.strings index cd8d82b5d5..8bc5cba529 100644 --- a/Pods/RocketChatViewController/Composer/Assets/el.lproj/Localizable.strings +++ b/Pods/RocketChatViewController/Composer/Assets/el.lproj/Localizable.strings @@ -7,3 +7,13 @@ "composer.sendButton.label" = "Send"; // TODO "composer.micButton.label" = "Voice message"; // TODO "composer.addButton.label" = "Share media"; // TODO +"composer.redMicButton.label" = "Stop recording"; // TODO +"composer.playButton.label" = "Play"; // TODO +"composer.pauseButton.label" = "Pause"; // TODO +"composer.discardButton.label" = "Discard"; // TODO +"composer.duration.label" = "Duration,"; // TODO +"composer.recordaudioview.swipe.label" = "Swipe left to cancel"; // TODO +"composer.slider.position.label" = "Position, "; // TODO +"composer.slider.of.label" = " of "; // TODO + +"composer.recordaudioview.micButton.hint" = "Double tap to record"; // TODO diff --git a/Pods/RocketChatViewController/Composer/Assets/en.lproj/Localizable.strings b/Pods/RocketChatViewController/Composer/Assets/en.lproj/Localizable.strings index 67b669d911..457006707b 100644 --- a/Pods/RocketChatViewController/Composer/Assets/en.lproj/Localizable.strings +++ b/Pods/RocketChatViewController/Composer/Assets/en.lproj/Localizable.strings @@ -7,3 +7,13 @@ "composer.sendButton.label" = "Send"; "composer.micButton.label" = "Voice message"; "composer.addButton.label" = "Share media"; +"composer.redMicButton.label" = "Stop recording"; +"composer.playButton.label" = "Play"; +"composer.pauseButton.label" = "Pause"; +"composer.discardButton.label" = "Discard"; +"composer.duration.label" = "Duration,"; +"composer.recordaudioview.swipe.label" = "Swipe left to cancel"; +"composer.slider.position.label" = "Position, "; +"composer.slider.of.label" = " of "; + +"composer.recordaudioview.micButton.hint" = "Double tap to record"; diff --git a/Pods/RocketChatViewController/Composer/Assets/es.lproj/Localizable.strings b/Pods/RocketChatViewController/Composer/Assets/es.lproj/Localizable.strings index cd8d82b5d5..8bc5cba529 100644 --- a/Pods/RocketChatViewController/Composer/Assets/es.lproj/Localizable.strings +++ b/Pods/RocketChatViewController/Composer/Assets/es.lproj/Localizable.strings @@ -7,3 +7,13 @@ "composer.sendButton.label" = "Send"; // TODO "composer.micButton.label" = "Voice message"; // TODO "composer.addButton.label" = "Share media"; // TODO +"composer.redMicButton.label" = "Stop recording"; // TODO +"composer.playButton.label" = "Play"; // TODO +"composer.pauseButton.label" = "Pause"; // TODO +"composer.discardButton.label" = "Discard"; // TODO +"composer.duration.label" = "Duration,"; // TODO +"composer.recordaudioview.swipe.label" = "Swipe left to cancel"; // TODO +"composer.slider.position.label" = "Position, "; // TODO +"composer.slider.of.label" = " of "; // TODO + +"composer.recordaudioview.micButton.hint" = "Double tap to record"; // TODO diff --git a/Pods/RocketChatViewController/Composer/Assets/fr.lproj/Localizable.strings b/Pods/RocketChatViewController/Composer/Assets/fr.lproj/Localizable.strings index cd8d82b5d5..8bc5cba529 100644 --- a/Pods/RocketChatViewController/Composer/Assets/fr.lproj/Localizable.strings +++ b/Pods/RocketChatViewController/Composer/Assets/fr.lproj/Localizable.strings @@ -7,3 +7,13 @@ "composer.sendButton.label" = "Send"; // TODO "composer.micButton.label" = "Voice message"; // TODO "composer.addButton.label" = "Share media"; // TODO +"composer.redMicButton.label" = "Stop recording"; // TODO +"composer.playButton.label" = "Play"; // TODO +"composer.pauseButton.label" = "Pause"; // TODO +"composer.discardButton.label" = "Discard"; // TODO +"composer.duration.label" = "Duration,"; // TODO +"composer.recordaudioview.swipe.label" = "Swipe left to cancel"; // TODO +"composer.slider.position.label" = "Position, "; // TODO +"composer.slider.of.label" = " of "; // TODO + +"composer.recordaudioview.micButton.hint" = "Double tap to record"; // TODO diff --git a/Pods/RocketChatViewController/Composer/Assets/ja.lproj/Localizable.strings b/Pods/RocketChatViewController/Composer/Assets/ja.lproj/Localizable.strings index cd8d82b5d5..8bc5cba529 100644 --- a/Pods/RocketChatViewController/Composer/Assets/ja.lproj/Localizable.strings +++ b/Pods/RocketChatViewController/Composer/Assets/ja.lproj/Localizable.strings @@ -7,3 +7,13 @@ "composer.sendButton.label" = "Send"; // TODO "composer.micButton.label" = "Voice message"; // TODO "composer.addButton.label" = "Share media"; // TODO +"composer.redMicButton.label" = "Stop recording"; // TODO +"composer.playButton.label" = "Play"; // TODO +"composer.pauseButton.label" = "Pause"; // TODO +"composer.discardButton.label" = "Discard"; // TODO +"composer.duration.label" = "Duration,"; // TODO +"composer.recordaudioview.swipe.label" = "Swipe left to cancel"; // TODO +"composer.slider.position.label" = "Position, "; // TODO +"composer.slider.of.label" = " of "; // TODO + +"composer.recordaudioview.micButton.hint" = "Double tap to record"; // TODO diff --git a/Pods/RocketChatViewController/Composer/Assets/pl.lproj/Localizable.strings b/Pods/RocketChatViewController/Composer/Assets/pl.lproj/Localizable.strings index ba2a6d8577..b3c4252e32 100644 --- a/Pods/RocketChatViewController/Composer/Assets/pl.lproj/Localizable.strings +++ b/Pods/RocketChatViewController/Composer/Assets/pl.lproj/Localizable.strings @@ -7,3 +7,13 @@ "composer.sendButton.label" = "Send"; // TODO "composer.micButton.label" = "Voice message"; // TODO "composer.addButton.label" = "Share media"; // TODO +"composer.redMicButton.label" = "Stop recording"; // TODO +"composer.playButton.label" = "Play"; // TODO +"composer.pauseButton.label" = "Pause"; // TODO +"composer.discardButton.label" = "Discard"; // TODO +"composer.duration.label" = "Duration,"; // TODO +"composer.recordaudioview.swipe.label" = "Swipe left to cancel"; // TODO +"composer.slider.position.label" = "Position, "; // TODO +"composer.slider.of.label" = " of "; // TODO + +"composer.recordaudioview.micButton.hint" = "Double tap to record"; // TODO diff --git a/Pods/RocketChatViewController/Composer/Assets/pt-BR.lproj/Localizable.strings b/Pods/RocketChatViewController/Composer/Assets/pt-BR.lproj/Localizable.strings index a829a0ee5a..80242d6839 100644 --- a/Pods/RocketChatViewController/Composer/Assets/pt-BR.lproj/Localizable.strings +++ b/Pods/RocketChatViewController/Composer/Assets/pt-BR.lproj/Localizable.strings @@ -7,3 +7,13 @@ "composer.sendButton.label" = "Send"; // TODO "composer.micButton.label" = "Voice message"; // TODO "composer.addButton.label" = "Share media"; // TODO +"composer.redMicButton.label" = "Stop recording"; // TODO +"composer.playButton.label" = "Play"; // TODO +"composer.pauseButton.label" = "Pause"; // TODO +"composer.discardButton.label" = "Discard"; // TODO +"composer.duration.label" = "Duration,"; // TODO +"composer.recordaudioview.swipe.label" = "Swipe left to cancel"; // TODO +"composer.slider.position.label" = "Position, "; // TODO +"composer.slider.of.label" = " of "; // TODO + +"composer.recordaudioview.micButton.hint" = "Double tap to record"; // TODO diff --git a/Pods/RocketChatViewController/Composer/Assets/pt-PT.lproj/Localizable.strings b/Pods/RocketChatViewController/Composer/Assets/pt-PT.lproj/Localizable.strings index a829a0ee5a..80242d6839 100644 --- a/Pods/RocketChatViewController/Composer/Assets/pt-PT.lproj/Localizable.strings +++ b/Pods/RocketChatViewController/Composer/Assets/pt-PT.lproj/Localizable.strings @@ -7,3 +7,13 @@ "composer.sendButton.label" = "Send"; // TODO "composer.micButton.label" = "Voice message"; // TODO "composer.addButton.label" = "Share media"; // TODO +"composer.redMicButton.label" = "Stop recording"; // TODO +"composer.playButton.label" = "Play"; // TODO +"composer.pauseButton.label" = "Pause"; // TODO +"composer.discardButton.label" = "Discard"; // TODO +"composer.duration.label" = "Duration,"; // TODO +"composer.recordaudioview.swipe.label" = "Swipe left to cancel"; // TODO +"composer.slider.position.label" = "Position, "; // TODO +"composer.slider.of.label" = " of "; // TODO + +"composer.recordaudioview.micButton.hint" = "Double tap to record"; // TODO diff --git a/Pods/RocketChatViewController/Composer/Assets/ru.lproj/Localizable.strings b/Pods/RocketChatViewController/Composer/Assets/ru.lproj/Localizable.strings index cd8d82b5d5..8bc5cba529 100644 --- a/Pods/RocketChatViewController/Composer/Assets/ru.lproj/Localizable.strings +++ b/Pods/RocketChatViewController/Composer/Assets/ru.lproj/Localizable.strings @@ -7,3 +7,13 @@ "composer.sendButton.label" = "Send"; // TODO "composer.micButton.label" = "Voice message"; // TODO "composer.addButton.label" = "Share media"; // TODO +"composer.redMicButton.label" = "Stop recording"; // TODO +"composer.playButton.label" = "Play"; // TODO +"composer.pauseButton.label" = "Pause"; // TODO +"composer.discardButton.label" = "Discard"; // TODO +"composer.duration.label" = "Duration,"; // TODO +"composer.recordaudioview.swipe.label" = "Swipe left to cancel"; // TODO +"composer.slider.position.label" = "Position, "; // TODO +"composer.slider.of.label" = " of "; // TODO + +"composer.recordaudioview.micButton.hint" = "Double tap to record"; // TODO diff --git a/Pods/RocketChatViewController/Composer/Classes/Delegate/ComposerViewExpandedDelegate.swift b/Pods/RocketChatViewController/Composer/Classes/Delegate/ComposerViewExpandedDelegate.swift index eef8e2326a..078e03eb7e 100644 --- a/Pods/RocketChatViewController/Composer/Classes/Delegate/ComposerViewExpandedDelegate.swift +++ b/Pods/RocketChatViewController/Composer/Classes/Delegate/ComposerViewExpandedDelegate.swift @@ -85,12 +85,15 @@ public extension ComposerViewExpandedDelegate { func composerView(_ composerView: ComposerView, willConfigureButton button: ComposerButton) { if button == composerView.rightButton { - let composerButtonAccessibilityLabel = composerView.textView.text.isEmpty - ? ComposerView.localized(.micButtonLabel) : ComposerView.localized(.sendButtonLabel) - button.accessibilityLabel = composerButtonAccessibilityLabel - let image = composerView.textView.text.isEmpty - ? ComposerAssets.micButtonImage : ComposerAssets.sendButtonImage - button.setBackgroundImage(image, for: .normal) + if composerView.textView.text.isEmpty { + button.accessibilityLabel = ComposerView.localized(.micButtonLabel) + button.accessibilityHint = ComposerView.localized(.micButtonHint) + button.setBackgroundImage(ComposerAssets.micButtonImage, for: .normal) + } else { + button.accessibilityLabel = ComposerView.localized(.sendButtonLabel) + button.accessibilityHint = nil + button.setBackgroundImage(ComposerAssets.sendButtonImage, for: .normal) + } } } diff --git a/Pods/RocketChatViewController/Composer/Classes/Library/ComposerLocalizable.swift b/Pods/RocketChatViewController/Composer/Classes/Library/ComposerLocalizable.swift index 0b2f0d25d3..321f41813b 100644 --- a/Pods/RocketChatViewController/Composer/Classes/Library/ComposerLocalizable.swift +++ b/Pods/RocketChatViewController/Composer/Classes/Library/ComposerLocalizable.swift @@ -17,6 +17,16 @@ enum ComposerLocalizableKey: String { case sendButtonLabel = "composer.sendButton.label" case micButtonLabel = "composer.micButton.label" case addButtonLabel = "composer.addButton.label" + case redMicButtonLabel = "composer.redMicButton.label" + case playButtonLabel = "composer.playButton.label" + case pauseButtonLabel = "composer.pauseButton.label" + case discardButtonLabel = "composer.discardButton.label" + case durationLabel = "composer.duration.label" + case swipeLabel = "composer.recordaudioview.swipe.label" + case sliderLabelPosition = "composer.slider.position.label" + case sliderLabelOf = "composer.slider.of.label" + + case micButtonHint = "composer.recordaudioview.micButton.hint" } protocol ComposerLocalizable { diff --git a/Pods/RocketChatViewController/Composer/Classes/Overlays/PreviewAudioView.swift b/Pods/RocketChatViewController/Composer/Classes/Overlays/PreviewAudioView.swift index df91e0cba4..1ac58f9e77 100644 --- a/Pods/RocketChatViewController/Composer/Classes/Overlays/PreviewAudioView.swift +++ b/Pods/RocketChatViewController/Composer/Classes/Overlays/PreviewAudioView.swift @@ -23,6 +23,7 @@ public class PreviewAudioView: UIView, ComposerLocalizable { public let discardButton = tap(UIButton()) { $0.translatesAutoresizingMaskIntoConstraints = false + $0.accessibilityLabel = localized(.discardButtonLabel) $0.addConstraints([ $0.heightAnchor.constraint(equalToConstant: Consts.discardButtonHeight), @@ -45,6 +46,7 @@ public class PreviewAudioView: UIView, ComposerLocalizable { public let sendButton = tap(UIButton()) { $0.translatesAutoresizingMaskIntoConstraints = false + $0.accessibilityLabel = localized(.sendButtonLabel) $0.addConstraints([ $0.heightAnchor.constraint(equalToConstant: Consts.discardButtonHeight), @@ -182,6 +184,7 @@ extension PreviewAudioView { audioView.player = nil delegate?.previewAudioView(self, didDiscardAudio: url) + UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, composerView?.rightButton) } @objc func touchUpInsideSendButton() { @@ -193,16 +196,18 @@ extension PreviewAudioView { audioView.player = nil delegate?.previewAudioView(self, didConfirmAudio: url) + UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, composerView?.rightButton) } } // MARK: SwipeIndicatorView -public class AudioView: UIView { +public class AudioView: UIView, ComposerLocalizable { public let playButton = tap(UIButton()) { $0.translatesAutoresizingMaskIntoConstraints = false $0.setImage(ComposerAssets.playButtonImage, for: .normal) + $0.accessibilityLabel = localized(.playButtonLabel) NSLayoutConstraint.activate([ $0.widthAnchor.constraint(equalToConstant: Consts.playButtonWidth), @@ -214,6 +219,7 @@ public class AudioView: UIView { public let progressSlider = tap(UISlider()) { $0.translatesAutoresizingMaskIntoConstraints = false + $0.accessibilityTraits = UIAccessibilityTraitAdjustable $0.value = 0 $0.setThumbImage(ComposerAssets.sliderThumbImage, for: .normal) @@ -263,6 +269,10 @@ public class AudioView: UIView { let pause = ComposerAssets.pauseButtonImage let play = ComposerAssets.playButtonImage playButton.setImage(playing ? pause : play, for: .normal) + + let pauseAccessibilityLabel = ComposerView.localized(.pauseButtonLabel) + let playAccessibilityLabel = ComposerView.localized(.playButtonLabel) + playButton.accessibilityLabel = playing ? pauseAccessibilityLabel : playAccessibilityLabel } } @@ -343,10 +353,23 @@ public class AudioView: UIView { } let displayTime = self.playing ? Int(player.currentTime) : Int(player.duration) - self.timeLabel.text = String(format: "%01d:%02d", (displayTime/60) % 60, displayTime % 60) + let displayFormat = String(format: "%01d:%02d", (displayTime/60) % 60, displayTime % 60) + self.timeLabel.text = displayFormat + self.timeLabel.accessibilityLabel = ComposerView.localized(.durationLabel) + self.timeDuration(displayTime) + + self.progressSlider.accessibilityValue = ComposerView.localized(.sliderLabelPosition) + self.timeDuration(Int(player.currentTime)) + + ComposerView.localized(.sliderLabelOf) + self.timeDuration(Int(player.duration)) } } + func timeDuration(_ time: Int) -> String { + let timeFormat = DateComponentsFormatter() + timeFormat.allowedUnits = [.minute, .second] + timeFormat.unitsStyle = .spellOut + guard let formattedTime = timeFormat.string(from: Double(time)) else { return "" } + return formattedTime + } + struct Consts { static let layerCornerRadius: CGFloat = 4 @@ -397,3 +420,30 @@ extension AudioView { } } + +// MARK: Accessibility + +extension AudioView { + + func valueUpdated() { + guard let player = self.player else { return } + let displayTime = self.playing ? Int(progressSlider.value) : Int(player.duration) + let displayFormat = String(format: "%01d:%02d", (displayTime/60) % 60, displayTime % 60) + timeLabel.text = displayFormat + progressSlider.sendActions(for: .valueChanged) + } + + override public func accessibilityIncrement() { + super.accessibilityIncrement() + + progressSlider.setValue(progressSlider.value + 10, animated: true) + valueUpdated() + } + + override public func accessibilityDecrement() { + super.accessibilityDecrement() + + progressSlider.setValue(progressSlider.value - 10, animated: true) + valueUpdated() + } +} diff --git a/Pods/RocketChatViewController/Composer/Classes/Overlays/RecordAudioView.swift b/Pods/RocketChatViewController/Composer/Classes/Overlays/RecordAudioView.swift index 6d1eee5f5d..340ba78fa1 100644 --- a/Pods/RocketChatViewController/Composer/Classes/Overlays/RecordAudioView.swift +++ b/Pods/RocketChatViewController/Composer/Classes/Overlays/RecordAudioView.swift @@ -13,7 +13,7 @@ public protocol RecordAudioViewDelegate: class { func recordAudioViewDidCancel(_ view: RecordAudioView) } -public class RecordAudioView: UIView { +public class RecordAudioView: UIView, ComposerLocalizable { public weak var composerView: ComposerView? public weak var delegate: RecordAudioViewDelegate? @@ -25,11 +25,15 @@ public class RecordAudioView: UIView { public var timer: Timer? + public let audioView = AudioView() + public var time: TimeInterval = 0 { didSet { let minutes = Int(time) / 60 let seconds = time - Double(minutes) * 60 - timeLabel.text = String(format: "%01i:%02i", minutes, Int(seconds)) + let displayFormat = String(format: "%01i:%02i", minutes, Int(seconds)) + timeLabel.text = displayFormat + timeLabel.accessibilityLabel = ComposerView.localized(.durationLabel) + audioView.timeDuration(Int(time)) } } @@ -51,6 +55,7 @@ public class RecordAudioView: UIView { public let micButton = tap(UIButton()) { $0.translatesAutoresizingMaskIntoConstraints = false + $0.accessibilityLabel = localized(.redMicButtonLabel) NSLayoutConstraint.activate([ $0.widthAnchor.constraint(equalToConstant: 40), @@ -266,6 +271,7 @@ extension RecordAudioView { @objc func swipeRecognized() { dismiss() + UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, composerView?.rightButton) } } @@ -275,6 +281,7 @@ public class SwipeIndicatorView: UIView, ComposerLocalizable { public let imageView = tap(UIImageView()) { $0.translatesAutoresizingMaskIntoConstraints = false $0.image = ComposerAssets.grayArrowLeftButtonImage + $0.accessibilityElementsHidden = true NSLayoutConstraint.activate([ $0.widthAnchor.constraint(equalToConstant: Consts.imageViewWidth), @@ -284,6 +291,9 @@ public class SwipeIndicatorView: UIView, ComposerLocalizable { public let label = tap(UILabel()) { $0.translatesAutoresizingMaskIntoConstraints = false + $0.isAccessibilityElement = true + $0.accessibilityTraits = UIAccessibilityTraitAllowsDirectInteraction + $0.accessibilityLabel = localized(.swipeLabel) $0.text = localized(.swipeIndicatorViewTitle) $0.font = .preferredFont(forTextStyle: .body) diff --git a/Pods/RocketChatViewController/Composer/Classes/Views/ComposerView.swift b/Pods/RocketChatViewController/Composer/Classes/Views/ComposerView.swift index fa13f7600f..e61e7cfc6c 100644 --- a/Pods/RocketChatViewController/Composer/Classes/Views/ComposerView.swift +++ b/Pods/RocketChatViewController/Composer/Classes/Views/ComposerView.swift @@ -104,7 +104,7 @@ public class ComposerView: UIView, ComposerLocalizable { $0.placeholderLabel.text = localized(.textViewPlaceholder) $0.placeholderLabel.font = .preferredFont(forTextStyle: .body) $0.placeholderLabel.adjustsFontForContentSizeCategory = true - $0.placeholderLabel.isAccessibilityElement = false + $0.placeholderLabel.accessibilityElementsHidden = true } /** @@ -297,6 +297,10 @@ public extension ComposerView { rightButton.isUserInteractionEnabled = false isTextInputEnabled = false + leftButton.accessibilityElementsHidden = true + rightButton.accessibilityElementsHidden = true + textView.accessibilityElementsHidden = true + currentDelegate.composerView(self, willConfigureOverlayView: overlayView, with: userData) currentDelegate.composerView(self, didConfigureOverlayView: overlayView) } @@ -307,6 +311,10 @@ public extension ComposerView { leftButton.isUserInteractionEnabled = true rightButton.isUserInteractionEnabled = true isTextInputEnabled = true + + leftButton.accessibilityElementsHidden = false + rightButton.accessibilityElementsHidden = false + textView.accessibilityElementsHidden = false } } diff --git a/Rocket.Chat/Controllers/Chat/MessagesViewController.swift b/Rocket.Chat/Controllers/Chat/MessagesViewController.swift index 2c45cec6a5..0ff3e57b5c 100644 --- a/Rocket.Chat/Controllers/Chat/MessagesViewController.swift +++ b/Rocket.Chat/Controllers/Chat/MessagesViewController.swift @@ -149,6 +149,7 @@ final class MessagesViewController: RocketChatViewController, MessagesListProtoc let button = UIButton() button.frame = CGRect(x: .greatestFiniteMagnitude, y: .greatestFiniteMagnitude, width: buttonScrollToBottomSize, height: buttonScrollToBottomSize) button.setImage(UIImage(named: "Float Button light"), for: .normal) + button.accessibilityElementsHidden = true button.addTarget(self, action: #selector(buttonScrollToBottomDidPressed), for: .touchUpInside) return button }() diff --git a/Rocket.Chat/Helpers/RCDateFormatter.swift b/Rocket.Chat/Helpers/RCDateFormatter.swift index dd17003e1d..78c69db83c 100644 --- a/Rocket.Chat/Helpers/RCDateFormatter.swift +++ b/Rocket.Chat/Helpers/RCDateFormatter.swift @@ -28,4 +28,12 @@ final class RCDateFormatter { dateFormatter.timeStyle = timeStyle return self.dateFormatter.string(from: date) } + + static func timeDuration(_ time: Int) -> String { + let timeFormat = DateComponentsFormatter() + timeFormat.allowedUnits = [.minute, .second] + timeFormat.unitsStyle = .spellOut + guard let formattedTime = timeFormat.string(from: Double(time)) else { return "" } + return formattedTime + } } diff --git a/Rocket.Chat/Resources/cs.lproj/VoiceOver.strings b/Rocket.Chat/Resources/cs.lproj/VoiceOver.strings index 9837f1bce0..28ab1b22ea 100644 --- a/Rocket.Chat/Resources/cs.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/cs.lproj/VoiceOver.strings @@ -47,3 +47,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/de.lproj/VoiceOver.strings b/Rocket.Chat/Resources/de.lproj/VoiceOver.strings index 416806c64b..b9616a4ed2 100644 --- a/Rocket.Chat/Resources/de.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/de.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/el.lproj/VoiceOver.strings b/Rocket.Chat/Resources/el.lproj/VoiceOver.strings index 2551268bf5..219afaf038 100644 --- a/Rocket.Chat/Resources/el.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/el.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/en.lproj/VoiceOver.strings b/Rocket.Chat/Resources/en.lproj/VoiceOver.strings index 95c94ada76..3c4baa3714 100644 --- a/Rocket.Chat/Resources/en.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/en.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; "message.threads.label" = "Threads"; "message.chat.title.hint" = "Double tap to open channel options"; +"message.audio.play.label" = "Play"; +"message.audio.pause.label" = "Pause"; +"message.audio.duration.label" = "Duration,"; diff --git a/Rocket.Chat/Resources/es.lproj/VoiceOver.strings b/Rocket.Chat/Resources/es.lproj/VoiceOver.strings index d6bf232c6d..e93ea891b8 100644 --- a/Rocket.Chat/Resources/es.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/es.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/fr.lproj/VoiceOver.strings b/Rocket.Chat/Resources/fr.lproj/VoiceOver.strings index 9436ebc611..e3d7c4c624 100644 --- a/Rocket.Chat/Resources/fr.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/fr.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/it.lproj/VoiceOver.strings b/Rocket.Chat/Resources/it.lproj/VoiceOver.strings index 2e0d526b00..12db00538f 100644 --- a/Rocket.Chat/Resources/it.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/it.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/ja.lproj/VoiceOver.strings b/Rocket.Chat/Resources/ja.lproj/VoiceOver.strings index b70947585f..4caddd4126 100644 --- a/Rocket.Chat/Resources/ja.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/ja.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/pl.lproj/VoiceOver.strings b/Rocket.Chat/Resources/pl.lproj/VoiceOver.strings index af140a3598..4e85cf4a7f 100644 --- a/Rocket.Chat/Resources/pl.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/pl.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/pt-BR.lproj/VoiceOver.strings b/Rocket.Chat/Resources/pt-BR.lproj/VoiceOver.strings index 7d80745784..0b21566c8a 100644 --- a/Rocket.Chat/Resources/pt-BR.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/pt-BR.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/pt-PT.lproj/VoiceOver.strings b/Rocket.Chat/Resources/pt-PT.lproj/VoiceOver.strings index 7d80745784..0b21566c8a 100644 --- a/Rocket.Chat/Resources/pt-PT.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/pt-PT.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/ru.lproj/VoiceOver.strings b/Rocket.Chat/Resources/ru.lproj/VoiceOver.strings index 486b7d80dd..8d205e3ef4 100644 --- a/Rocket.Chat/Resources/ru.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/ru.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/zh-Hans.lproj/VoiceOver.strings b/Rocket.Chat/Resources/zh-Hans.lproj/VoiceOver.strings index e7a8661ac5..99379d64e2 100644 --- a/Rocket.Chat/Resources/zh-Hans.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/zh-Hans.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Resources/zh-Hant.lproj/VoiceOver.strings b/Rocket.Chat/Resources/zh-Hant.lproj/VoiceOver.strings index fd93a1cc8a..3665fc75de 100644 --- a/Rocket.Chat/Resources/zh-Hant.lproj/VoiceOver.strings +++ b/Rocket.Chat/Resources/zh-Hant.lproj/VoiceOver.strings @@ -46,3 +46,6 @@ "message.search.label" = "Search"; // TODO "message.threads.label" = "Threads"; // TODO "message.chat.title.hint" = "Double tap to open channel options"; // TODO +"message.audio.play.label" = "Play"; // TODO +"message.audio.pause.label" = "Pause"; // TODO +"message.audio.duration.label" = "Duration,"; // TODO diff --git a/Rocket.Chat/Views/Cells/Chat/ChatMessageAudioView.swift b/Rocket.Chat/Views/Cells/Chat/ChatMessageAudioView.swift index f7948d05f2..6985cf31ca 100644 --- a/Rocket.Chat/Views/Cells/Chat/ChatMessageAudioView.swift +++ b/Rocket.Chat/Views/Cells/Chat/ChatMessageAudioView.swift @@ -73,6 +73,8 @@ final class ChatMessageAudioView: ChatMessageAttachmentView { let pause = #imageLiteral(resourceName: "Player Pause").withRenderingMode(.alwaysTemplate) let play = #imageLiteral(resourceName: "Player Play").withRenderingMode(.alwaysTemplate) playButton.setImage(playing ? pause : play, for: .normal) + playButton.accessibilityLabel = playing ? + VOLocalizedString("message.audio.pause.label") : VOLocalizedString("message.audio.play.label") applyTheme() } } @@ -99,7 +101,11 @@ final class ChatMessageAudioView: ChatMessageAttachmentView { } let displayTime = self.playing ? Int(player.currentTime) : Int(player.duration) - self.timeLabel.text = String(format: "%02d:%02d", (displayTime/60) % 60, displayTime % 60) + let displayFormat = String(format: "%02d:%02d", (displayTime/60) % 60, displayTime % 60) + self.timeLabel.text = displayFormat + if let durationLabel = VOLocalizedString("message.audio.duration.label") { + self.timeLabel.accessibilityLabel = durationLabel + RCDateFormatter.timeDuration(displayTime) + } } } diff --git a/Rocket.Chat/Views/Chat/New Chat/Cells/BaseAudioMessageCell.swift b/Rocket.Chat/Views/Chat/New Chat/Cells/BaseAudioMessageCell.swift index 083efc01b9..e73fa42860 100644 --- a/Rocket.Chat/Views/Chat/New Chat/Cells/BaseAudioMessageCell.swift +++ b/Rocket.Chat/Views/Chat/New Chat/Cells/BaseAudioMessageCell.swift @@ -34,7 +34,11 @@ class BaseAudioMessageCell: BaseMessageCell { } let displayTime = self.playing ? Int(player.currentTime) : Int(player.duration) - audioTimeLabel.text = String(format: "%02d:%02d", (displayTime/60) % 60, displayTime % 60) + let displayFormat = String(format: "%02d:%02d", (displayTime/60) % 60, displayTime % 60) + audioTimeLabel.text = displayFormat + if let durationLabel = VOLocalizedString("message.audio.duration.label") { + audioTimeLabel.accessibilityLabel = durationLabel + RCDateFormatter.timeDuration(displayTime) + } } } @@ -54,11 +58,13 @@ class BaseAudioMessageCell: BaseMessageCell { if playing { let image = UIImage(named: "Player Pause")?.withRenderingMode(.alwaysTemplate) buttonPlay.imageView?.tintColor = theme.actionTintColor + buttonPlay.accessibilityLabel = VOLocalizedString("message.audio.pause.label") buttonPlay.setImage(image, for: .normal) player?.play() } else { let image = UIImage(named: "Player Play")?.withRenderingMode(.alwaysTemplate) buttonPlay.imageView?.tintColor = theme.actionTintColor + buttonPlay.accessibilityLabel = VOLocalizedString("message.audio.play.label") buttonPlay.setImage(image, for: .normal) player?.stop() }