fix open group time for self sent messages

pull/256/head
Ryan ZHAO 5 years ago
parent af7a58cc1f
commit 2f3fa3adf8

@ -16,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)processIncomingSentMessageTranscript:(OWSIncomingSentMessageTranscript *)incomingSentMessageTranscript + (void)processIncomingSentMessageTranscript:(OWSIncomingSentMessageTranscript *)incomingSentMessageTranscript
serverID:(uint64_t)serverID serverID:(uint64_t)serverID
serverTimestamp:(uint64_t)serverTimestamp
attachmentHandler:(void (^)( attachmentHandler:(void (^)(
NSArray<TSAttachmentStream *> *attachmentStreams))attachmentHandler NSArray<TSAttachmentStream *> *attachmentStreams))attachmentHandler
transaction:(YapDatabaseReadWriteTransaction *)transaction; transaction:(YapDatabaseReadWriteTransaction *)transaction;

@ -62,6 +62,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)processIncomingSentMessageTranscript:(OWSIncomingSentMessageTranscript *)transcript + (void)processIncomingSentMessageTranscript:(OWSIncomingSentMessageTranscript *)transcript
serverID:(uint64_t)serverID serverID:(uint64_t)serverID
serverTimestamp:(uint64_t)serverTimestamp
attachmentHandler:(void (^)( attachmentHandler:(void (^)(
NSArray<TSAttachmentStream *> *attachmentStreams))attachmentHandler NSArray<TSAttachmentStream *> *attachmentStreams))attachmentHandler
transaction:(YapDatabaseReadWriteTransaction *)transaction transaction:(YapDatabaseReadWriteTransaction *)transaction
@ -104,6 +105,14 @@ NS_ASSUME_NONNULL_BEGIN
contactShare:transcript.contact contactShare:transcript.contact
linkPreview:transcript.linkPreview]; linkPreview:transcript.linkPreview];
if (transcript.thread.isGroupThread) {
TSGroupThread *thread = (TSGroupThread *)transcript.thread;
if (thread.isPublicChat) {
[outgoingMessage setServerTimestampAsReceiveTimestamp:serverTimestamp];
}
}
if (serverID != 0) { if (serverID != 0) {
outgoingMessage.openGroupServerMessageID = serverID; outgoingMessage.openGroupServerMessageID = serverID;
} }

@ -915,6 +915,7 @@ NS_ASSUME_NONNULL_BEGIN
[OWSRecordTranscriptJob [OWSRecordTranscriptJob
processIncomingSentMessageTranscript:transcript processIncomingSentMessageTranscript:transcript
serverID:0 serverID:0
serverTimestamp:0
attachmentHandler:^(NSArray<TSAttachmentStream *> *attachmentStreams) { attachmentHandler:^(NSArray<TSAttachmentStream *> *attachmentStreams) {
OWSAssertDebug(attachmentStreams.count == 1); OWSAssertDebug(attachmentStreams.count == 1);
TSAttachmentStream *attachmentStream = attachmentStreams.firstObject; TSAttachmentStream *attachmentStream = attachmentStreams.firstObject;
@ -943,6 +944,7 @@ NS_ASSUME_NONNULL_BEGIN
[OWSRecordTranscriptJob [OWSRecordTranscriptJob
processIncomingSentMessageTranscript:transcript processIncomingSentMessageTranscript:transcript
serverID:(serverID ?: 0) serverID:(serverID ?: 0)
serverTimestamp:(uint64_t)envelope.serverTimestamp
attachmentHandler:^(NSArray<TSAttachmentStream *> *attachmentStreams) { attachmentHandler:^(NSArray<TSAttachmentStream *> *attachmentStreams) {
OWSLogDebug(@"successfully fetched transcript attachments: %lu", OWSLogDebug(@"successfully fetched transcript attachments: %lu",
(unsigned long)attachmentStreams.count); (unsigned long)attachmentStreams.count);

Loading…
Cancel
Save