Check microphone permissions: Clean up

* copy tweaks
* use "settings" instead of "privacy settings" for button text
* include comments in NSLocalizedString param so they can be extracted with genstrings
* style dismiss action as "cancel"

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 70efb5e9ec
commit da8596c1ba

@ -46,7 +46,6 @@ import Foundation
return false return false
} }
// Check for microphone permissions // Check for microphone permissions
// Alternative way without prompting for permissions: // Alternative way without prompting for permissions:
// if AVAudioSession.sharedInstance().recordPermission() == .denied { // if AVAudioSession.sharedInstance().recordPermission() == .denied {
@ -61,15 +60,15 @@ import Foundation
} }
return true return true
} }
/// Cleanup and present alert for no permissions /// Cleanup and present alert for no permissions
private func showNoMicrophonePermissionAlert() { private func showNoMicrophonePermissionAlert() {
let alertTitle = NSLocalizedString("CALL_AUDIO_PERMISSION_TITLE", comment:"Alert Title") let alertTitle = NSLocalizedString("CALL_AUDIO_PERMISSION_TITLE", comment:"Alert title when calling and permissions for microphone are missing")
let alertMessage = NSLocalizedString("CALL_AUDIO_PERMISSION_MESSAGE", comment:"Alert message") let alertMessage = NSLocalizedString("CALL_AUDIO_PERMISSION_MESSAGE", comment:"Alert message when calling and permissions for microphone are missing")
let alertController = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: .alert) let alertController = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: .alert)
let dismiss = NSLocalizedString("DISMISS_BUTTON_TEXT", comment: "Generic short text for button to dismiss a dialog") let dismiss = NSLocalizedString("DISMISS_BUTTON_TEXT", comment: "Generic short text for button to dismiss a dialog")
let dismissAction = UIAlertAction(title: dismiss, style: .default) let dismissAction = UIAlertAction(title: dismiss, style: .cancel)
let settingsString = NSLocalizedString("CALL_VIEW_SETTINGS_NAG_SHOW_CALL_SETTINGS", comment: "Settings button text") let settingsString = NSLocalizedString("OPEN_SETTINGS_BUTTON", comment: "Button text which opens the settings app")
let settingsAction = UIAlertAction(title: settingsString, style: .default) { _ in let settingsAction = UIAlertAction(title: settingsString, style: .default) { _ in
UIApplication.shared.openURL(URL(string: UIApplicationOpenSettingsURLString)!) UIApplication.shared.openURL(URL(string: UIApplicationOpenSettingsURLString)!)
} }

@ -160,11 +160,11 @@
/* Title format for action sheet that offers to block an unknown user.Embeds {{the unknown user's name or phone number}}. */ /* Title format for action sheet that offers to block an unknown user.Embeds {{the unknown user's name or phone number}}. */
"BLOCK_OFFER_ACTIONSHEET_TITLE_FORMAT" = "Block %@?"; "BLOCK_OFFER_ACTIONSHEET_TITLE_FORMAT" = "Block %@?";
/* Alert message */ /* Alert message when calling and permissions for microphone are missing */
"CALL_AUDIO_PERMISSION_MESSAGE" = "Signal requires access to your microphone to make calls. You can grant this permission in the Settings app"; "CALL_AUDIO_PERMISSION_MESSAGE" = "Signal requires access to your microphone to make calls. You can grant this permission in the Settings app.";
/* Alert Title */ /* Alert title when calling and permissions for microphone are missing */
"CALL_AUDIO_PERMISSION_TITLE" = "Call failed"; "CALL_AUDIO_PERMISSION_TITLE" = "Microphone Access Required";
/* Accessibilty label for placing call button */ /* Accessibilty label for placing call button */
"CALL_LABEL" = "Call"; "CALL_LABEL" = "Call";
@ -184,8 +184,7 @@
/* Label for button that dismiss the call view's settings nag. */ /* Label for button that dismiss the call view's settings nag. */
"CALL_VIEW_SETTINGS_NAG_NOT_NOW_BUTTON" = "Not Now"; "CALL_VIEW_SETTINGS_NAG_NOT_NOW_BUTTON" = "Not Now";
/* Label for button that shows the privacy settings /* Label for button that shows the privacy settings */
Settings button text */
"CALL_VIEW_SETTINGS_NAG_SHOW_CALL_SETTINGS" = "Show Privacy Settings"; "CALL_VIEW_SETTINGS_NAG_SHOW_CALL_SETTINGS" = "Show Privacy Settings";
/* notification action */ /* notification action */

Loading…
Cancel
Save