|
|
@ -7,6 +7,7 @@
|
|
|
|
#import "AttachmentSharing.h"
|
|
|
|
#import "AttachmentSharing.h"
|
|
|
|
#import "BlockListUIUtils.h"
|
|
|
|
#import "BlockListUIUtils.h"
|
|
|
|
#import "BlockListViewController.h"
|
|
|
|
#import "BlockListViewController.h"
|
|
|
|
|
|
|
|
#import "ContactsViewHelper.h"
|
|
|
|
#import "DebugUITableViewController.h"
|
|
|
|
#import "DebugUITableViewController.h"
|
|
|
|
#import "Environment.h"
|
|
|
|
#import "Environment.h"
|
|
|
|
#import "FingerprintViewController.h"
|
|
|
|
#import "FingerprintViewController.h"
|
|
|
@ -26,7 +27,6 @@
|
|
|
|
#import "OWSMessageCollectionViewCell.h"
|
|
|
|
#import "OWSMessageCollectionViewCell.h"
|
|
|
|
#import "OWSMessagesBubblesSizeCalculator.h"
|
|
|
|
#import "OWSMessagesBubblesSizeCalculator.h"
|
|
|
|
#import "OWSOutgoingMessageCollectionViewCell.h"
|
|
|
|
#import "OWSOutgoingMessageCollectionViewCell.h"
|
|
|
|
#import "OWSUnknownContactBlockOfferMessage.h"
|
|
|
|
|
|
|
|
#import "OWSUnreadIndicatorCell.h"
|
|
|
|
#import "OWSUnreadIndicatorCell.h"
|
|
|
|
#import "PropertyListPreferences.h"
|
|
|
|
#import "PropertyListPreferences.h"
|
|
|
|
#import "Signal-Swift.h"
|
|
|
|
#import "Signal-Swift.h"
|
|
|
@ -63,12 +63,14 @@
|
|
|
|
#import <SignalServiceKit/ContactsUpdater.h>
|
|
|
|
#import <SignalServiceKit/ContactsUpdater.h>
|
|
|
|
#import <SignalServiceKit/MimeTypeUtil.h>
|
|
|
|
#import <SignalServiceKit/MimeTypeUtil.h>
|
|
|
|
#import <SignalServiceKit/NSTimer+OWS.h>
|
|
|
|
#import <SignalServiceKit/NSTimer+OWS.h>
|
|
|
|
|
|
|
|
#import <SignalServiceKit/OWSAddToContactsOfferMessage.h>
|
|
|
|
#import <SignalServiceKit/OWSAttachmentsProcessor.h>
|
|
|
|
#import <SignalServiceKit/OWSAttachmentsProcessor.h>
|
|
|
|
#import <SignalServiceKit/OWSBlockingManager.h>
|
|
|
|
#import <SignalServiceKit/OWSBlockingManager.h>
|
|
|
|
#import <SignalServiceKit/OWSDisappearingMessagesConfiguration.h>
|
|
|
|
#import <SignalServiceKit/OWSDisappearingMessagesConfiguration.h>
|
|
|
|
#import <SignalServiceKit/OWSFingerprint.h>
|
|
|
|
#import <SignalServiceKit/OWSFingerprint.h>
|
|
|
|
#import <SignalServiceKit/OWSFingerprintBuilder.h>
|
|
|
|
#import <SignalServiceKit/OWSFingerprintBuilder.h>
|
|
|
|
#import <SignalServiceKit/OWSMessageSender.h>
|
|
|
|
#import <SignalServiceKit/OWSMessageSender.h>
|
|
|
|
|
|
|
|
#import <SignalServiceKit/OWSUnknownContactBlockOfferMessage.h>
|
|
|
|
#import <SignalServiceKit/SignalRecipient.h>
|
|
|
|
#import <SignalServiceKit/SignalRecipient.h>
|
|
|
|
#import <SignalServiceKit/TSAccountManager.h>
|
|
|
|
#import <SignalServiceKit/TSAccountManager.h>
|
|
|
|
#import <SignalServiceKit/TSInvalidIdentityKeySendingErrorMessage.h>
|
|
|
|
#import <SignalServiceKit/TSInvalidIdentityKeySendingErrorMessage.h>
|
|
|
@ -586,7 +588,10 @@ typedef enum : NSUInteger {
|
|
|
|
OWSMessagesToolbarContentDelegate,
|
|
|
|
OWSMessagesToolbarContentDelegate,
|
|
|
|
OWSConversationSettingsViewDelegate,
|
|
|
|
OWSConversationSettingsViewDelegate,
|
|
|
|
UIDocumentMenuDelegate,
|
|
|
|
UIDocumentMenuDelegate,
|
|
|
|
UIDocumentPickerDelegate> {
|
|
|
|
UIDocumentPickerDelegate,
|
|
|
|
|
|
|
|
ContactsViewHelperDelegate,
|
|
|
|
|
|
|
|
ContactEditingDelegate,
|
|
|
|
|
|
|
|
CNContactViewControllerDelegate> {
|
|
|
|
UIImage *tappedImage;
|
|
|
|
UIImage *tappedImage;
|
|
|
|
BOOL isGroupConversation;
|
|
|
|
BOOL isGroupConversation;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -640,6 +645,8 @@ typedef enum : NSUInteger {
|
|
|
|
@property (nonatomic) NSDate *lastMessageSentDate;
|
|
|
|
@property (nonatomic) NSDate *lastMessageSentDate;
|
|
|
|
@property (nonatomic) NSTimer *scrollLaterTimer;
|
|
|
|
@property (nonatomic) NSTimer *scrollLaterTimer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic, readonly) ContactsViewHelper *contactsViewHelper;
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@implementation MessagesViewController
|
|
|
|
@implementation MessagesViewController
|
|
|
@ -694,6 +701,7 @@ typedef enum : NSUInteger {
|
|
|
|
_messagesManager = [TSMessagesManager sharedManager];
|
|
|
|
_messagesManager = [TSMessagesManager sharedManager];
|
|
|
|
_networkManager = [TSNetworkManager sharedManager];
|
|
|
|
_networkManager = [TSNetworkManager sharedManager];
|
|
|
|
_blockingManager = [OWSBlockingManager sharedManager];
|
|
|
|
_blockingManager = [OWSBlockingManager sharedManager];
|
|
|
|
|
|
|
|
_contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self];
|
|
|
|
|
|
|
|
|
|
|
|
[self addNotificationListeners];
|
|
|
|
[self addNotificationListeners];
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -813,14 +821,6 @@ typedef enum : NSUInteger {
|
|
|
|
self.automaticallyScrollsToMostRecentMessage = NO;
|
|
|
|
self.automaticallyScrollsToMostRecentMessage = NO;
|
|
|
|
|
|
|
|
|
|
|
|
[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
|
|
|
@ -940,6 +940,9 @@ typedef enum : NSUInteger {
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[super viewWillAppear:animated];
|
|
|
|
[super viewWillAppear:animated];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// In case we're dismissing a CNContactViewController which requires default system appearance
|
|
|
|
|
|
|
|
[UIUtil applySignalAppearence];
|
|
|
|
|
|
|
|
|
|
|
|
// Since we're using a custom back button, we have to do some extra work to manage the interactivePopGestureRecognizer
|
|
|
|
// Since we're using a custom back button, we have to do some extra work to manage the interactivePopGestureRecognizer
|
|
|
|
self.navigationController.interactivePopGestureRecognizer.delegate = self;
|
|
|
|
self.navigationController.interactivePopGestureRecognizer.delegate = self;
|
|
|
|
|
|
|
|
|
|
|
@ -949,6 +952,8 @@ typedef enum : NSUInteger {
|
|
|
|
|
|
|
|
|
|
|
|
[self toggleObservers:YES];
|
|
|
|
[self toggleObservers:YES];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self ensureThreadOffersAndIndicators];
|
|
|
|
|
|
|
|
|
|
|
|
// Triggering modified notification renders "call notification" when leaving full screen call view
|
|
|
|
// Triggering modified notification renders "call notification" when leaving full screen call view
|
|
|
|
[self.thread touch];
|
|
|
|
[self.thread touch];
|
|
|
|
|
|
|
|
|
|
|
@ -2311,6 +2316,9 @@ typedef enum : NSUInteger {
|
|
|
|
case TSErrorMessageAdapter:
|
|
|
|
case TSErrorMessageAdapter:
|
|
|
|
[self handleErrorMessageTap:(TSErrorMessage *)interaction];
|
|
|
|
[self handleErrorMessageTap:(TSErrorMessage *)interaction];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TSInfoMessageAdapter:
|
|
|
|
|
|
|
|
[self handleInfoMessageTap:(TSInfoMessage *)interaction];
|
|
|
|
|
|
|
|
break;
|
|
|
|
case TSCallAdapter:
|
|
|
|
case TSCallAdapter:
|
|
|
|
case TSUnreadIndicatorAdapter:
|
|
|
|
case TSUnreadIndicatorAdapter:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -2549,6 +2557,15 @@ typedef enum : NSUInteger {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)handleInfoMessageTap:(TSInfoMessage *)message
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if ([message isKindOfClass:[OWSAddToContactsOfferMessage class]]) {
|
|
|
|
|
|
|
|
[self tappedAddToContactsOfferMessage:(OWSAddToContactsOfferMessage *)message];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
DDLogInfo(@"%@ Unhandled tap for info message:%@", self.tag, message);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)tappedCorruptedMessage:(TSErrorMessage *)message
|
|
|
|
- (void)tappedCorruptedMessage:(TSErrorMessage *)message
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
@ -2666,6 +2683,70 @@ typedef enum : NSUInteger {
|
|
|
|
[self presentViewController:actionSheetController animated:YES completion:nil];
|
|
|
|
[self presentViewController:actionSheetController animated:YES completion:nil];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)tappedAddToContactsOfferMessage:(OWSAddToContactsOfferMessage *)errorMessage
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!self.contactsManager.supportsContactEditing) {
|
|
|
|
|
|
|
|
DDLogError(@"%@ Contact editing not supported", self.tag);
|
|
|
|
|
|
|
|
OWSAssert(NO);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (![self.thread isKindOfClass:[TSContactThread class]]) {
|
|
|
|
|
|
|
|
DDLogError(@"%@ unexpected thread: %@ in %s", self.tag, self.thread, __PRETTY_FUNCTION__);
|
|
|
|
|
|
|
|
OWSAssert(NO);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TSContactThread *contactThread = (TSContactThread *)self.thread;
|
|
|
|
|
|
|
|
[self.contactsViewHelper presentContactViewControllerForRecipientId:contactThread.contactIdentifier
|
|
|
|
|
|
|
|
fromViewController:self
|
|
|
|
|
|
|
|
editImmediately:YES];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - ContactEditingDelegate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)didFinishEditingContact
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
DDLogDebug(@"%@ %s", self.tag, __PRETTY_FUNCTION__);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - CNContactViewControllerDelegate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)contactViewController:(CNContactViewController *)viewController
|
|
|
|
|
|
|
|
didCompleteWithContact:(nullable CNContact *)contact
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (contact) {
|
|
|
|
|
|
|
|
// Saving normally returns you to the "Show Contact" view
|
|
|
|
|
|
|
|
// which we're not interested in, so we skip it here. There is
|
|
|
|
|
|
|
|
// an unfortunate blip of the "Show Contact" view on slower devices.
|
|
|
|
|
|
|
|
DDLogDebug(@"%@ completed editing contact.", self.tag);
|
|
|
|
|
|
|
|
[self dismissViewControllerAnimated:NO completion:nil];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
DDLogDebug(@"%@ canceled editing contact.", self.tag);
|
|
|
|
|
|
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - ContactsViewHelperDelegate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)contactsViewHelperDidUpdateContacts
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
[self ensureThreadOffersAndIndicators];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- (void)ensureThreadOffersAndIndicators
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
OWSAssert([NSThread isMainThread]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ([self.thread isKindOfClass:[TSContactThread class]]) {
|
|
|
|
|
|
|
|
TSContactThread *contactThread = (TSContactThread *)self.thread;
|
|
|
|
|
|
|
|
[ThreadUtil ensureThreadOffersAndIndicators:contactThread
|
|
|
|
|
|
|
|
storageManager:self.storageManager
|
|
|
|
|
|
|
|
contactsManager:self.contactsManager
|
|
|
|
|
|
|
|
blockingManager:self.blockingManager];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma mark - Attachment Picking: Documents
|
|
|
|
#pragma mark - Attachment Picking: Documents
|
|
|
|
|
|
|
|
|
|
|
|