Fix "can't send same GIF twice" issue.

// FREEBIE
pull/1/head
Matthew Chen 7 years ago
parent fb360cd41f
commit fb4d43d542

@ -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];

@ -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;

@ -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);

Loading…
Cancel
Save