request confirmation when calling changed SN

...rather than failing with "SN Changed" error

// FREEBIE
This commit is contained in:
Michael Kirk 2017-05-26 16:32:04 -07:00
parent ced9125303
commit 47783a9df0
2 changed files with 26 additions and 4 deletions

View File

@ -1583,6 +1583,7 @@ typedef enum : NSUInteger {
}
- (void)showConfirmIdentityUIForRecipientIdentity:(OWSRecipientIdentity *)recipientIdentity
confirmationText:(NSString *)confirmationText
completion:(void (^)(BOOL didConfirmedIdentity))completionHandler
{
NSString *displayName = [self.contactsManager displayNameForPhoneIdentifier:recipientIdentity.recipientId];
@ -1603,9 +1604,7 @@ typedef enum : NSUInteger {
[actionSheet
addAction:[UIAlertAction
actionWithTitle:
NSLocalizedString(@"SAFETY_NUMBER_CHANGED_CONFIRM_SEND_ACTION",
@"button title to confirm sending to a recipient whose safety number recently changed")
actionWithTitle:confirmationText
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) {
DDLogInfo(@"%@ Confirmed sending identity: %@", self.tag, recipientIdentity);
@ -1688,6 +1687,22 @@ typedef enum : NSUInteger {
return;
}
OWSRecipientIdentity *unconfirmedIdentityThatShouldBlockSending = [self unconfirmedIdentityThatShouldBlockSending];
if (unconfirmedIdentityThatShouldBlockSending != nil) {
__weak MessagesViewController *weakSelf = self;
[self showConfirmIdentityUIForRecipientIdentity:unconfirmedIdentityThatShouldBlockSending
confirmationText:NSLocalizedString(@"SAFETY_NUMBER_CHANGED_CONFIRM_CALL_ACTION",
@"button title to confirm calling a recipient whose safety "
@"number recently changed")
completion:^(BOOL didConfirmedIdentity) {
if (didConfirmedIdentity) {
[weakSelf callAction:sender];
}
}];
return;
}
[self.outboundCallInitiator initiateCallWithRecipientId:self.thread.contactIdentifier];
}
@ -1737,6 +1752,9 @@ typedef enum : NSUInteger {
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 didPressSendButton:button

View File

@ -1051,6 +1051,9 @@
/* Generic text for button that retries whatever the last action was. */
"RETRY_BUTTON_TEXT" = "Retry";
/* button title to confirm calling a recipient whose safety number recently changed */
"SAFETY_NUMBER_CHANGED_CONFIRM_CALL_ACTION" = "Confirm and Call";
/* button title to confirm sending to a recipient whose safety number recently changed */
"SAFETY_NUMBER_CHANGED_CONFIRM_SEND_ACTION" = "Confirm and Send";
@ -1363,7 +1366,8 @@
/* Label indicating the phone number currently being verified. */
"VERIFICATION_PHONE_NUMBER_FORMAT" = "Enter the verification code we sent to %@.";
/* table cell label in conversation settings */
/* Action sheet item
table cell label in conversation settings */
"VERIFY_PRIVACY" = "Show Safety Number";
/* Indicates how to cancel a voice message. */