diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 2846bc765..d123a1ead 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -2330,9 +2330,6 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { OWSAssert([NSThread isMainThread]); OWSAssert(message); - [self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [message saveWithTransaction:transaction]; - }]; [self updateLastVisibleTimestamp:message.timestampForSorting]; self.lastMessageSentDate = [NSDate new]; [self clearUnreadMessagesIndicator]; diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m index 6ca452bc7..ea1974ea7 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m @@ -326,7 +326,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) } else { NSString *_Nullable attachmentId = interaction.attachmentIds.firstObject; if (attachmentId.length > 0) { - TSAttachment *attachment = [TSAttachment fetchObjectWithUniqueID:attachmentId]; + TSAttachment *_Nullable attachment = [TSAttachment fetchObjectWithUniqueID:attachmentId]; if ([attachment isKindOfClass:[TSAttachmentStream class]]) { self.attachmentStream = (TSAttachmentStream *)attachment; @@ -364,10 +364,15 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) self.messageCellType = OWSMessageCellType_DownloadingAttachment; self.attachmentPointer = (TSAttachmentPointer *)attachment; return; + } else { + OWSFail(@"%@ Unknown attachment type", self.tag); } + } else { + OWSFail(@"%@ Message has neither attachment nor body", self.tag); } } + DDLogVerbose(@"%@ interaction: %@", self.tag, interaction.description); OWSFail(@"%@ Unknown cell type", self.tag); self.messageCellType = OWSMessageCellType_Unknown; diff --git a/SignalServiceKit/src/Util/DataSource.m b/SignalServiceKit/src/Util/DataSource.m index 6649e8461..fa10e14e9 100755 --- a/SignalServiceKit/src/Util/DataSource.m +++ b/SignalServiceKit/src/Util/DataSource.m @@ -300,6 +300,20 @@ NS_ASSUME_NONNULL_BEGIN return instance; } +- (void)setFilePath:(NSString *)filePath +{ + OWSAssert(filePath.length > 0); + +#ifdef DEBUG + BOOL isDirectory; + BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:filePath isDirectory:&isDirectory]; + OWSAssert(exists); + OWSAssert(!isDirectory); +#endif + + _filePath = filePath; +} + - (NSData *)data { OWSAssert(self.filePath);