|
|
@ -6,8 +6,8 @@
|
|
|
|
#import "AppDelegate.h"
|
|
|
|
#import "AppDelegate.h"
|
|
|
|
#import "AttachmentSharing.h"
|
|
|
|
#import "AttachmentSharing.h"
|
|
|
|
#import "BlockListUIUtils.h"
|
|
|
|
#import "BlockListUIUtils.h"
|
|
|
|
#import "DebugUITableViewController.h"
|
|
|
|
|
|
|
|
#import "BlockListViewController.h"
|
|
|
|
#import "BlockListViewController.h"
|
|
|
|
|
|
|
|
#import "DebugUITableViewController.h"
|
|
|
|
#import "Environment.h"
|
|
|
|
#import "Environment.h"
|
|
|
|
#import "FingerprintViewController.h"
|
|
|
|
#import "FingerprintViewController.h"
|
|
|
|
#import "FullImageViewController.h"
|
|
|
|
#import "FullImageViewController.h"
|
|
|
@ -23,6 +23,7 @@
|
|
|
|
#import "OWSIncomingMessageCollectionViewCell.h"
|
|
|
|
#import "OWSIncomingMessageCollectionViewCell.h"
|
|
|
|
#import "OWSMessagesBubblesSizeCalculator.h"
|
|
|
|
#import "OWSMessagesBubblesSizeCalculator.h"
|
|
|
|
#import "OWSOutgoingMessageCollectionViewCell.h"
|
|
|
|
#import "OWSOutgoingMessageCollectionViewCell.h"
|
|
|
|
|
|
|
|
#import "OWSUnknownContactBlockOfferMessage.h"
|
|
|
|
#import "PropertyListPreferences.h"
|
|
|
|
#import "PropertyListPreferences.h"
|
|
|
|
#import "Signal-Swift.h"
|
|
|
|
#import "Signal-Swift.h"
|
|
|
|
#import "SignalKeyingStorage.h"
|
|
|
|
#import "SignalKeyingStorage.h"
|
|
|
@ -383,6 +384,14 @@ typedef enum : NSUInteger {
|
|
|
|
self.senderDisplayName = ME_MESSAGE_IDENTIFIER;
|
|
|
|
self.senderDisplayName = ME_MESSAGE_IDENTIFIER;
|
|
|
|
|
|
|
|
|
|
|
|
[self initializeToolbars];
|
|
|
|
[self initializeToolbars];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ([self.thread isKindOfClass:[TSContactThread class]]) {
|
|
|
|
|
|
|
|
TSContactThread *contactThread = (TSContactThread *)self.thread;
|
|
|
|
|
|
|
|
[ThreadUtil createBlockOfferIfNecessary:contactThread
|
|
|
|
|
|
|
|
storageManager:self.storageManager
|
|
|
|
|
|
|
|
contactsManager:self.contactsManager
|
|
|
|
|
|
|
|
blockingManager:self.blockingManager];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)viewDidLayoutSubviews
|
|
|
|
- (void)viewDidLayoutSubviews
|
|
|
@ -2003,6 +2012,8 @@ typedef enum : NSUInteger {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ([message isKindOfClass:[TSInvalidIdentityKeyErrorMessage class]]) {
|
|
|
|
if ([message isKindOfClass:[TSInvalidIdentityKeyErrorMessage class]]) {
|
|
|
|
[self tappedInvalidIdentityKeyErrorMessage:(TSInvalidIdentityKeyErrorMessage *)message];
|
|
|
|
[self tappedInvalidIdentityKeyErrorMessage:(TSInvalidIdentityKeyErrorMessage *)message];
|
|
|
|
|
|
|
|
} else if ([message isKindOfClass:[OWSUnknownContactBlockOfferMessage class]]) {
|
|
|
|
|
|
|
|
[self tappedUnknownContactBlockOfferMessage:(OWSUnknownContactBlockOfferMessage *)message];
|
|
|
|
} else if (message.errorType == TSErrorMessageInvalidMessage) {
|
|
|
|
} else if (message.errorType == TSErrorMessageInvalidMessage) {
|
|
|
|
[self tappedCorruptedMessage:message];
|
|
|
|
[self tappedCorruptedMessage:message];
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -2050,48 +2061,83 @@ typedef enum : NSUInteger {
|
|
|
|
NSString *titleFormat = NSLocalizedString(@"SAFETY_NUMBERS_ACTIONSHEET_TITLE", @"Action sheet heading");
|
|
|
|
NSString *titleFormat = NSLocalizedString(@"SAFETY_NUMBERS_ACTIONSHEET_TITLE", @"Action sheet heading");
|
|
|
|
NSString *titleText = [NSString stringWithFormat:titleFormat, keyOwner];
|
|
|
|
NSString *titleText = [NSString stringWithFormat:titleFormat, keyOwner];
|
|
|
|
|
|
|
|
|
|
|
|
UIAlertController *actionSheetController = [UIAlertController alertControllerWithTitle:titleText
|
|
|
|
UIAlertController *actionSheetController =
|
|
|
|
message:nil
|
|
|
|
[UIAlertController alertControllerWithTitle:titleText
|
|
|
|
preferredStyle:UIAlertControllerStyleActionSheet];
|
|
|
|
message:nil
|
|
|
|
|
|
|
|
preferredStyle:UIAlertControllerStyleActionSheet];
|
|
|
|
|
|
|
|
|
|
|
|
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"")
|
|
|
|
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"")
|
|
|
|
style:UIAlertActionStyleCancel
|
|
|
|
style:UIAlertActionStyleCancel
|
|
|
|
handler:nil];
|
|
|
|
handler:nil];
|
|
|
|
[actionSheetController addAction:dismissAction];
|
|
|
|
[actionSheetController addAction:dismissAction];
|
|
|
|
|
|
|
|
|
|
|
|
UIAlertAction *showSafteyNumberAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"SHOW_SAFETY_NUMBER_ACTION", @"Action sheet item")
|
|
|
|
UIAlertAction *showSafteyNumberAction =
|
|
|
|
style:UIAlertActionStyleDefault
|
|
|
|
[UIAlertAction actionWithTitle:NSLocalizedString(@"SHOW_SAFETY_NUMBER_ACTION", @"Action sheet item")
|
|
|
|
handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
style:UIAlertActionStyleDefault
|
|
|
|
DDLogInfo(@"%@ Remote Key Changed actions: Show fingerprint display", self.tag);
|
|
|
|
handler:^(UIAlertAction *_Nonnull action) {
|
|
|
|
[self showFingerprintWithTheirIdentityKey:errorMessage.newIdentityKey
|
|
|
|
DDLogInfo(@"%@ Remote Key Changed actions: Show fingerprint display", self.tag);
|
|
|
|
theirSignalId:errorMessage.theirSignalId];
|
|
|
|
[self showFingerprintWithTheirIdentityKey:errorMessage.newIdentityKey
|
|
|
|
}];
|
|
|
|
theirSignalId:errorMessage.theirSignalId];
|
|
|
|
|
|
|
|
}];
|
|
|
|
[actionSheetController addAction:showSafteyNumberAction];
|
|
|
|
[actionSheetController addAction:showSafteyNumberAction];
|
|
|
|
|
|
|
|
|
|
|
|
UIAlertAction *acceptSafetyNumberAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"ACCEPT_NEW_IDENTITY_ACTION", @"Action sheet item")
|
|
|
|
UIAlertAction *acceptSafetyNumberAction = [UIAlertAction
|
|
|
|
style:UIAlertActionStyleDefault
|
|
|
|
actionWithTitle:NSLocalizedString(@"ACCEPT_NEW_IDENTITY_ACTION", @"Action sheet item")
|
|
|
|
handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
style:UIAlertActionStyleDefault
|
|
|
|
DDLogInfo(@"%@ Remote Key Changed actions: Accepted new identity key", self.tag);
|
|
|
|
handler:^(UIAlertAction *_Nonnull action) {
|
|
|
|
[errorMessage acceptNewIdentityKey];
|
|
|
|
DDLogInfo(@"%@ Remote Key Changed actions: Accepted new identity key", self.tag);
|
|
|
|
if ([errorMessage isKindOfClass:[TSInvalidIdentityKeySendingErrorMessage class]]) {
|
|
|
|
[errorMessage acceptNewIdentityKey];
|
|
|
|
[self.messageSender
|
|
|
|
if ([errorMessage isKindOfClass:[TSInvalidIdentityKeySendingErrorMessage class]]) {
|
|
|
|
resendMessageFromKeyError:(TSInvalidIdentityKeySendingErrorMessage *)
|
|
|
|
[self.messageSender
|
|
|
|
errorMessage
|
|
|
|
resendMessageFromKeyError:(TSInvalidIdentityKeySendingErrorMessage *)errorMessage
|
|
|
|
success:^{
|
|
|
|
success:^{
|
|
|
|
DDLogDebug(@"%@ Successfully resent key-error message.", self.tag);
|
|
|
|
DDLogDebug(@"%@ Successfully resent key-error message.", self.tag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
failure:^(NSError *_Nonnull error) {
|
|
|
|
failure:^(NSError *_Nonnull error) {
|
|
|
|
DDLogError(@"%@ Failed to resend key-error message with error:%@",
|
|
|
|
DDLogError(@"%@ Failed to resend key-error message with error:%@", self.tag, error);
|
|
|
|
self.tag,
|
|
|
|
}];
|
|
|
|
error);
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
[actionSheetController addAction:acceptSafetyNumberAction];
|
|
|
|
[actionSheetController addAction:acceptSafetyNumberAction];
|
|
|
|
|
|
|
|
|
|
|
|
[self presentViewController:actionSheetController animated:YES completion:nil];
|
|
|
|
[self presentViewController:actionSheetController animated:YES completion:nil];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)tappedUnknownContactBlockOfferMessage:(OWSUnknownContactBlockOfferMessage *)errorMessage
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
NSString *displayName = [self.contactsManager displayNameForPhoneIdentifier:errorMessage.contactId];
|
|
|
|
|
|
|
|
NSString *title =
|
|
|
|
|
|
|
|
[NSString stringWithFormat:NSLocalizedString(@"BLOCK_OFFER_ACTIONSHEET_TITLE_FORMAT",
|
|
|
|
|
|
|
|
@"Title format for action sheet that offers to block an unknown user."
|
|
|
|
|
|
|
|
@"Embeds {{the unknown user's name or phone number}}."),
|
|
|
|
|
|
|
|
[BlockListUIUtils formatDisplayNameForAlertTitle:displayName]];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIAlertController *actionSheetController =
|
|
|
|
|
|
|
|
[UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIAlertAction *dismissAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"TXT_CANCEL_TITLE", @"")
|
|
|
|
|
|
|
|
style:UIAlertActionStyleCancel
|
|
|
|
|
|
|
|
handler:nil];
|
|
|
|
|
|
|
|
[actionSheetController addAction:dismissAction];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UIAlertAction *blockAction =
|
|
|
|
|
|
|
|
[UIAlertAction actionWithTitle:NSLocalizedString(@"BLOCK_OFFER_ACTIONSHEET_BLOCK_ACTION",
|
|
|
|
|
|
|
|
@"Action sheet that will block an unknown user.")
|
|
|
|
|
|
|
|
style:UIAlertActionStyleDestructive
|
|
|
|
|
|
|
|
handler:^(UIAlertAction *_Nonnull action) {
|
|
|
|
|
|
|
|
DDLogInfo(@"%@ Blocking an unknown user.", self.tag);
|
|
|
|
|
|
|
|
[self.blockingManager addBlockedPhoneNumber:errorMessage.contactId];
|
|
|
|
|
|
|
|
// Delete the block offer.
|
|
|
|
|
|
|
|
[self.storageManager.dbConnection
|
|
|
|
|
|
|
|
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
|
|
|
|
|
|
|
[errorMessage removeWithTransaction:transaction];
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
[actionSheetController addAction:blockAction];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self presentViewController:actionSheetController animated:YES completion:nil];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - UIImagePickerController
|
|
|
|
#pragma mark - UIImagePickerController
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|