Browse Source

Merge pull request #690 from deltachat/fix_voice_over_on_recording2

improve accessibility of voice message recording, alternative
cyBerta 5 years ago
parent
commit
a5f32e9889

+ 7 - 0
deltachat-ios/Controller/AudioRecorderController.swift

@@ -150,6 +150,13 @@ class AudioRecorderController: UIViewController, AVAudioRecorderDelegate {
         validateMicrophoneAccess()
     }
 
+    override func viewDidAppear(_ animated: Bool) {
+        super.viewDidAppear(animated)
+        if UIAccessibility.isVoiceOverRunning {
+            UIAccessibility.post(notification: .layoutChanged, argument: self.doneButton)
+        }
+     }
+
     override func viewWillDisappear(_ animated: Bool) {
         super.viewWillDisappear(animated)
 

+ 9 - 1
deltachat-ios/Controller/ChatViewController.swift

@@ -1107,7 +1107,15 @@ extension ChatViewController: MessagesLayoutDelegate {
             alert.addAction(locationStreamingAction)
         }
         alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
-        self.present(alert, animated: true, completion: nil)
+        self.present(alert, animated: true, completion: {
+            // unfortunately, voiceMessageAction.accessibilityHint does not work,
+            // but this hack does the trick
+            if UIAccessibility.isVoiceOverRunning {
+                if let view = voiceMessageAction.value(forKey: "__representer") as? UIView {
+                    view.accessibilityHint = String.localized("a11y_voice_message_hint_ios")
+                }
+            }
+        })
     }
 
     private func documentActionPressed(_ action: UIAlertAction) {

+ 1 - 0
deltachat-ios/en.lproj/Localizable.strings

@@ -649,3 +649,4 @@
 "import_contacts" = "Import device contacts";
 "import_contacts_message" = "To chat with contacts from your device open Settings and enable Contacts.";
 "stop_sharing_location" = "Stop sharing location";
+"a11y_voice_message_hint_ios" = "After recording double-tap to send. To discard the recording scrub left-right with two fingers.";

+ 1 - 0
tools/untranslated.xml

@@ -5,4 +5,5 @@
     <string name="import_contacts">Import device contacts</string>
     <string name="import_contacts_message">To chat with contacts from your device open Settings and enable Contacts.</string>
     <string name="stop_sharing_location">Stop sharing location</string>
+    <string name="a11y_voice_message_hint_ios">After recording double-tap to send. To discard the recording scrub left-right with two fingers.</string>
 </resources>