From ccc36c021be070b5e2e4a8c924091d746edc0560 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Tue, 1 Dec 2020 17:00:50 +1100 Subject: [PATCH] Resolve some leftover TODOs --- .../ConversationViewController.m | 49 ++----------------- SessionMessagingKit/To Do/TSAccountManager.h | 1 - SessionMessagingKit/To Do/TSAccountManager.m | 31 ------------ 3 files changed, 5 insertions(+), 76 deletions(-) diff --git a/Session/Signal/ConversationView/ConversationViewController.m b/Session/Signal/ConversationView/ConversationViewController.m index 00e61a9ef..0c9327df3 100644 --- a/Session/Signal/ConversationView/ConversationViewController.m +++ b/Session/Signal/ConversationView/ConversationViewController.m @@ -1451,20 +1451,7 @@ typedef enum : NSUInteger { - (void)handleFailedDownloadTapForMessage:(TSMessage *)message { - OWSAssert(message); - - // TODO TODO TODO - -// [self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { -// [self.attachmentDownloads downloadAttachmentsForMessage:message -// transaction:transaction -// success:^(NSArray *attachmentStreams) { -// OWSLogInfo(@"Successfully redownloaded attachment in thread: %@", message.thread); -// } -// failure:^(NSError *error) { -// OWSLogWarn(@"Failed to redownload message with error: %@", error); -// }]; -// }]; + // Do nothing } - (void)handleUnsentMessageTap:(TSOutgoingMessage *)message @@ -1481,7 +1468,9 @@ typedef enum : NSUInteger { [self remove:message]; }]; [actionSheet addAction:deleteMessageAction]; - + + // TODO TODO TODO + // UIAlertAction *resendMessageAction = [UIAlertAction // actionWithTitle:NSLocalizedString(@"SEND_AGAIN_BUTTON", @"") // accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"send_again") @@ -1908,35 +1897,7 @@ typedef enum : NSUInteger { quotedReply:(OWSQuotedReplyModel *)quotedReply failedThumbnailDownloadAttachmentPointer:(TSAttachmentPointer *)attachmentPointer { - OWSAssertIsOnMainThread(); - OWSAssertDebug(viewItem); - OWSAssertDebug(attachmentPointer); - - TSMessage *message = (TSMessage *)viewItem.interaction; - if (![message isKindOfClass:[TSMessage class]]) { - OWSFailDebug(@"message had unexpected class: %@", message.class); - return; - } - - // TODO TODO TODO - -// [self.uiDatabaseConnection asyncReadWithBlock:^(YapDatabaseReadTransaction *transaction) { -// [self.attachmentDownloads downloadAttachmentPointer:attachmentPointer -// success:^(NSArray *attachmentStreams) { -// OWSAssertDebug(attachmentStreams.count == 1); -// TSAttachmentStream *attachmentStream = attachmentStreams.firstObject; -// [LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *postSuccessTransaction) { -// [message setQuotedMessageThumbnailAttachmentStream:attachmentStream]; -// [message saveWithTransaction:postSuccessTransaction]; -// }]; -// } -// failure:^(NSError *error) { -// OWSLogWarn(@"Failed to redownload thumbnail with error: %@", error); -// [LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *postSuccessTransaction) { -// [message touchWithTransaction:postSuccessTransaction]; -// }]; -// }]; -// }]; + // Do nothing } - (void)didTapConversationItem:(id)viewItem quotedReply:(OWSQuotedReplyModel *)quotedReply diff --git a/SessionMessagingKit/To Do/TSAccountManager.h b/SessionMessagingKit/To Do/TSAccountManager.h index d660f5801..fae863d46 100644 --- a/SessionMessagingKit/To Do/TSAccountManager.h +++ b/SessionMessagingKit/To Do/TSAccountManager.h @@ -148,7 +148,6 @@ typedef NS_ENUM(NSUInteger, OWSRegistrationState) { // Re-registration is the process of re-registering _with the same phone number_. // Returns YES on success. -- (BOOL)resetForReregistration; - (nullable NSString *)reregisterationPhoneNumber; - (BOOL)isReregistering; diff --git a/SessionMessagingKit/To Do/TSAccountManager.m b/SessionMessagingKit/To Do/TSAccountManager.m index 43d697fa5..2ee6e4b8c 100644 --- a/SessionMessagingKit/To Do/TSAccountManager.m +++ b/SessionMessagingKit/To Do/TSAccountManager.m @@ -404,37 +404,6 @@ NSString *const TSAccountManager_NeedsAccountAttributesUpdateKey = @"TSAccountMa [self postRegistrationStateDidChangeNotification]; } -#pragma mark - Re-registration - -- (BOOL)resetForReregistration -{ - @synchronized(self) { - NSString *_Nullable localNumber = self.localNumber; - if (!localNumber) { - return NO; - } - - _isRegistered = NO; - _cachedLocalNumber = nil; - _phoneNumberAwaitingVerification = nil; - _cachedIsDeregistered = nil; - [LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [transaction removeAllObjectsInCollection:TSAccountManager_UserAccountCollection]; - - // TODO TODO TODO -// [[OWSPrimaryStorage sharedManager] resetSessionStore:transaction]; - - [transaction setObject:localNumber - forKey:TSAccountManager_ReregisteringPhoneNumberKey - inCollection:TSAccountManager_UserAccountCollection]; - }]; - - [self postRegistrationStateDidChangeNotification]; - - return YES; - } -} - - (nullable NSString *)reregisterationPhoneNumber { NSString *_Nullable result = [self.dbConnection stringForKey:TSAccountManager_ReregisteringPhoneNumberKey