From 2d7f03a1c815ad2152fedddc371f11b03d712fd4 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Fri, 26 May 2017 16:56:24 -0700 Subject: [PATCH] interstitial SN confirmation for attachments/voicenotes // FREEBIE --- .../ViewControllers/MessagesViewController.m | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/Signal/src/ViewControllers/MessagesViewController.m b/Signal/src/ViewControllers/MessagesViewController.m index 94c7f0d01..953e01ff4 100644 --- a/Signal/src/ViewControllers/MessagesViewController.m +++ b/Signal/src/ViewControllers/MessagesViewController.m @@ -1702,7 +1702,6 @@ typedef enum : NSUInteger { return; } - [self.outboundCallInitiator initiateCallWithRecipientId:self.thread.contactIdentifier]; } @@ -3706,6 +3705,20 @@ typedef enum : NSUInteger { return; } + OWSRecipientIdentity *unconfirmedIdentityThatShouldBlockSending = [self unconfirmedIdentityThatShouldBlockSending]; + if (unconfirmedIdentityThatShouldBlockSending != nil) { + __weak MessagesViewController *weakSelf = self; + [self showConfirmIdentityUIForRecipientIdentity:unconfirmedIdentityThatShouldBlockSending + confirmationText:NSLocalizedString(@"CONFIRMATION_TITLE", + @"Generic button text to proceed with an action") + completion:^(BOOL didConfirmedIdentity) { + if (didConfirmedIdentity) { + [weakSelf didPressAccessoryButton:nil]; + } + }]; + return; + } + UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; @@ -3946,6 +3959,23 @@ typedef enum : NSUInteger { return; } + OWSRecipientIdentity *unconfirmedIdentityThatShouldBlockSending = + [self unconfirmedIdentityThatShouldBlockSending]; + if (unconfirmedIdentityThatShouldBlockSending != nil) { + __weak MessagesViewController *weakSelf = self; + [self showConfirmIdentityUIForRecipientIdentity:unconfirmedIdentityThatShouldBlockSending + confirmationText:NSLocalizedString( + @"SAFETY_NUMBER_CHANGED_CONFIRM_SEND_ACTION", + @"button title to confirm sending to a recipient whose " + @"safety number recently changed") + completion:^(BOOL didConfirmedIdentity) { + if (didConfirmedIdentity) { + [weakSelf tryToSendAttachmentIfApproved:attachment]; + } + }]; + return; + } + if (attachment == nil || [attachment hasError]) { DDLogWarn(@"%@ %s Invalid attachment: %@.", self.tag,