Merge branch 'call-permissions'
This commit is contained in:
commit
d911b6a995
|
@ -46,7 +46,34 @@ import Foundation
|
|||
return false
|
||||
}
|
||||
|
||||
callUIAdapter.startAndShowOutgoingCall(recipientId: recipientId)
|
||||
// Check for microphone permissions
|
||||
// Alternative way without prompting for permissions:
|
||||
// if AVAudioSession.sharedInstance().recordPermission() == .denied {
|
||||
AVAudioSession.sharedInstance().requestRecordPermission { isGranted in
|
||||
// Here the permissions are either granted or denied
|
||||
guard isGranted == true else {
|
||||
Logger.warn("\(self.TAG) aborting due to missing microphone permissions.")
|
||||
self.showNoMicrophonePermissionAlert()
|
||||
return
|
||||
}
|
||||
callUIAdapter.startAndShowOutgoingCall(recipientId: recipientId)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/// Cleanup and present alert for no permissions
|
||||
private func showNoMicrophonePermissionAlert() {
|
||||
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 when calling and permissions for microphone are missing")
|
||||
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 dismissAction = UIAlertAction(title: dismiss, style: .cancel)
|
||||
let settingsString = NSLocalizedString("OPEN_SETTINGS_BUTTON", comment: "Button text which opens the settings app")
|
||||
let settingsAction = UIAlertAction(title: settingsString, style: .default) { _ in
|
||||
UIApplication.shared.openURL(URL(string: UIApplicationOpenSettingsURLString)!)
|
||||
}
|
||||
alertController.addAction(dismissAction)
|
||||
alertController.addAction(settingsAction)
|
||||
UIApplication.shared.frontmostViewController?.present(alertController, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
/* Format string for file extension label in call interstitial view */
|
||||
"ATTACHMENT_APPROVAL_FILE_EXTENSION_FORMAT" = "File type: %@";
|
||||
|
||||
/* Format string for file size label in call interstitial view */
|
||||
/* Format string for file size label in call interstitial view. Embeds: {{file size as 'N mb' or 'N kb'}}. */
|
||||
"ATTACHMENT_APPROVAL_FILE_SIZE_FORMAT" = "Size: %@";
|
||||
|
||||
/* Label for 'send' button in the 'attachment approval' dialog. */
|
||||
|
@ -160,6 +160,12 @@
|
|||
/* 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 %@?";
|
||||
|
||||
/* 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.";
|
||||
|
||||
/* Alert title when calling and permissions for microphone are missing */
|
||||
"CALL_AUDIO_PERMISSION_TITLE" = "Microphone Access Required";
|
||||
|
||||
/* Accessibilty label for placing call button */
|
||||
"CALL_LABEL" = "Call";
|
||||
|
||||
|
@ -229,12 +235,6 @@
|
|||
/* table cell label in conversation settings */
|
||||
"CONVERSATION_SETTINGS_BLOCK_THIS_USER" = "Block this user";
|
||||
|
||||
/* The message of the 'text message too large' alert. */
|
||||
"CONVERSATION_VIEW_TEXT_MESSAGE_TOO_LARGE_ALERT_MESSAGE" = "This message is too long to send.";
|
||||
|
||||
/* The title of the 'text message too large' alert. */
|
||||
"CONVERSATION_VIEW_TEXT_MESSAGE_TOO_LARGE_ALERT_TITLE" = "Error";
|
||||
|
||||
/* ActionSheet title */
|
||||
"CORRUPTED_SESSION_DESCRIPTION" = "Resetting your session will allow you to receive future messages from %@, but it will not recover any already corrupted messages.";
|
||||
|
||||
|
|
Loading…
Reference in New Issue