Private
Public Access
1
0

Plumb guid down for deduplication on the conversation level

This commit is contained in:
James Magahern
2019-01-04 13:08:28 -08:00
parent dba4910a82
commit 6aaa2ff5b3
3 changed files with 6 additions and 23 deletions

View File

@@ -43,10 +43,10 @@
// Load messages
[chat loadMessagesBeforeDate:[NSDate date] limit:50 loadImmediately:YES];
for (IMMessageItem *imMessage in [[chat chatItems] messages]) {
NSDictionary *messageDict = [imMessage mbim_dictionaryRepresentation];
[[chat chatItems] enumerateMessagesWithOptions:0 usingBlock:^(IMMessage *message, BOOL *stop) {
NSDictionary *messageDict = [message mbim_dictionaryRepresentation];
[messages addObject:messageDict];
}
}];
}
});

View File

@@ -16,9 +16,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
@interface IMMessageItem (Encoded)
- (NSDictionary *)mbim_dictionaryRepresentation;
@end
NS_ASSUME_NONNULL_END

View File

@@ -16,21 +16,8 @@
NSMutableDictionary *messageDict = [NSMutableDictionary dictionary];
messageDict[@"text"] = [[self text] string];
messageDict[@"date"] = MBIMWebServerFormatISO8601([self time]);
messageDict[@"sender"] = [[self sender] displayID];
return messageDict;
}
@end
@implementation IMMessageItem (Encoded)
- (NSDictionary *)mbim_dictionaryRepresentation
{
NSMutableDictionary *messageDict = [NSMutableDictionary dictionary];
messageDict[@"text"] = [[self body] string];
messageDict[@"date"] = MBIMWebServerFormatISO8601([self time]);
messageDict[@"sender"] = [self sender];
messageDict[@"sender"] = ([self isFromMe] ? nil : [[self sender] displayID]); // TODO: nil sender is still a weird way to represent this...
messageDict[@"guid"] = [self guid];
if ([self fileTransferGUIDs]) {
// Support only images right now
@@ -51,3 +38,4 @@
}
@end