diff --git a/Signal/src/Storyboard/Main.storyboard b/Signal/src/Storyboard/Main.storyboard
index 0900049f3..aaa675771 100644
--- a/Signal/src/Storyboard/Main.storyboard
+++ b/Signal/src/Storyboard/Main.storyboard
@@ -1519,7 +1519,6 @@
-
diff --git a/Signal/src/util/UIViewController+CameraPermissions.h b/Signal/src/util/UIViewController+CameraPermissions.h
index bd1b6d121..12f8821c2 100644
--- a/Signal/src/util/UIViewController+CameraPermissions.h
+++ b/Signal/src/util/UIViewController+CameraPermissions.h
@@ -10,7 +10,8 @@
NS_ASSUME_NONNULL_BEGIN
@interface UIViewController (CameraPermissions)
--(void)ows_askForCameraPermissions:(void(^)())permissionsGrantedCallback;
+- (void)ows_askForCameraPermissions:(void (^)())permissionsGrantedCallback
+ alertActionHandler:(nullable void (^)())alertActionHandler;
@end
NS_ASSUME_NONNULL_END
diff --git a/Signal/src/util/UIViewController+CameraPermissions.m b/Signal/src/util/UIViewController+CameraPermissions.m
index 575613e9c..0ee816b55 100644
--- a/Signal/src/util/UIViewController+CameraPermissions.m
+++ b/Signal/src/util/UIViewController+CameraPermissions.m
@@ -13,7 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
@implementation UIViewController (CameraPermissions)
--(void)ows_askForCameraPermissions:(void(^)())permissionsGrantedCallback
+- (void)ows_askForCameraPermissions:(void (^)())permissionsGrantedCallback
+ alertActionHandler:(nullable void (^)())alertActionHandler
{
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
DDLogError(@"Camera ImagePicker source not available");
@@ -21,13 +22,25 @@ NS_ASSUME_NONNULL_BEGIN
}
AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if (status == AVAuthorizationStatusDenied) {
- UIAlertController* alert = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"CAMERA_PERMISSION_TITLE",nil) message:NSLocalizedString(@"CAMERA_PERMISSION_MESSAGE",nil) preferredStyle:UIAlertControllerStyleAlert];
-
- [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CAMERA_PERMISSION_PROCEED",nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+ UIAlertController* alert = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"MISSING_CAMERA_PERMISSION_TITLE", @"Alert title")
+ message:NSLocalizedString(@"MISSING_CAMERA_PERMISSION_MESSAGE", @"Alert body")
+ preferredStyle:UIAlertControllerStyleAlert];
+
+ NSString *settingsTitle = NSLocalizedString(@"OPEN_SETTINGS_BUTTON", @"Button text which opens the settings app");
+ UIAlertAction *openSettingsAction = [UIAlertAction actionWithTitle:settingsTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
- }]];
- [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"CAMERA_PERMISSION_CANCEL",nil) style:UIAlertActionStyleCancel handler:nil]];
- [self presentViewController:alert animated:YES completion:[UIUtil modalCompletionBlock]];
+ if (alertActionHandler) {
+ alertActionHandler();
+ }
+ }];
+ [alert addAction:openSettingsAction];
+
+ UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"DISMISS_BUTTON_TEXT", nil)
+ style:UIAlertActionStyleCancel
+ handler:alertActionHandler];
+ [alert addAction:dismissAction];
+
+ [self presentViewController:alert animated:YES completion:nil];
} else if (status == AVAuthorizationStatusAuthorized) {
permissionsGrantedCallback();
} else if (status == AVAuthorizationStatusNotDetermined) {
diff --git a/Signal/src/view controllers/FingerprintViewController.m b/Signal/src/view controllers/FingerprintViewController.m
index 257465a43..fca41dc7c 100644
--- a/Signal/src/view controllers/FingerprintViewController.m
+++ b/Signal/src/view controllers/FingerprintViewController.m
@@ -153,7 +153,8 @@ NS_ASSUME_NONNULL_BEGIN
completion:nil];
[self.qrScanningController startCapture];
- }];
+ }
+ alertActionHandler:nil];
}
// pragma mark - OWSQRScannerDelegate
diff --git a/Signal/src/view controllers/MessagesViewController.m b/Signal/src/view controllers/MessagesViewController.m
index 9cdd1c794..8d955402b 100644
--- a/Signal/src/view controllers/MessagesViewController.m
+++ b/Signal/src/view controllers/MessagesViewController.m
@@ -1569,8 +1569,8 @@ typedef enum : NSUInteger {
picker.allowsEditing = NO;
picker.delegate = self;
[self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]];
-
- }];
+ }
+ alertActionHandler:nil];
}
- (void)chooseFromLibrary {
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
diff --git a/Signal/src/view controllers/OWSLinkedDevicesTableViewController.m b/Signal/src/view controllers/OWSLinkedDevicesTableViewController.m
index 129317589..8ec8e9986 100644
--- a/Signal/src/view controllers/OWSLinkedDevicesTableViewController.m
+++ b/Signal/src/view controllers/OWSLinkedDevicesTableViewController.m
@@ -255,9 +255,15 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1;
{
[self ows_askForCameraPermissions:^{
[self performSegueWithIdentifier:@"LinkDeviceSegue" sender:self];
- }];
+ }
+ alertActionHandler:^{
+ // HACK to unselect rows when swiping back
+ // http://stackoverflow.com/questions/19379510/uitableviewcell-doesnt-get-deselected-when-swiping-back-quickly
+ [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:YES];
+ }];
}
}
+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == OWSLinkedDevicesTableViewControllerSectionAddDevice) {
diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings
index 803eea0f7..0c2941be5 100644
Binary files a/Signal/translations/en.lproj/Localizable.strings and b/Signal/translations/en.lproj/Localizable.strings differ