Don't set content data in LKEphemeralMessage.

pull/33/head
Mikunj 6 years ago
parent d1e02848e6
commit 9ec9b0e27f

@ -1,5 +1,6 @@
#import "LKEphemeralMessage.h" #import "LKEphemeralMessage.h"
#import <SignalCoreKit/NSDate+OWS.h> #import <SignalCoreKit/NSDate+OWS.h>
#import <SignalServiceKit/SignalServiceKit-Swift.h>
@implementation LKEphemeralMessage @implementation LKEphemeralMessage
@ -8,6 +9,20 @@
expiresInSeconds:0 expireStartedAt:0 isVoiceMessage:NO groupMetaMessage:TSGroupMetaMessageUnspecified quotedMessage:nil contactShare:nil linkPreview:nil]; expiresInSeconds:0 expireStartedAt:0 isVoiceMessage:NO groupMetaMessage:TSGroupMetaMessageUnspecified quotedMessage:nil contactShare:nil linkPreview:nil];
} }
// An EphemeralMessage does not have any data message in the content
- (nullable NSData *)buildPlainTextData:(SignalRecipient *)recipient
{
NSError *error;
SSKProtoContentBuilder *contentBuilder = [self contentBuilder:recipient];
NSData *_Nullable contentData = [contentBuilder buildSerializedDataAndReturnError:&error];
if (error || !contentData) {
OWSFailDebug(@"could not serialize protobuf: %@", error);
return nil;
}
return contentData;
}
- (BOOL)shouldSyncTranscript { return NO; } - (BOOL)shouldSyncTranscript { return NO; }
- (BOOL)shouldBeSaved { return NO; } - (BOOL)shouldBeSaved { return NO; }

@ -1512,8 +1512,8 @@ NS_ASSUME_NONNULL_BEGIN
[existingFriendRequestMessage saveFriendRequestStatus:LKMessageFriendRequestStatusAccepted withTransaction:transaction]; [existingFriendRequestMessage saveFriendRequestStatus:LKMessageFriendRequestStatusAccepted withTransaction:transaction];
} }
// The two lines below are equivalent to calling [ThreadUtil enqueueAcceptFriendRequestMessageInThread:thread] // The two lines below are equivalent to calling [ThreadUtil enqueueAcceptFriendRequestMessageInThread:thread]
LKEphemeralMessage *emptyMessage = [[LKEphemeralMessage alloc] initInThread:thread]; LKEphemeralMessage *backgroundMessage = [[LKEphemeralMessage alloc] initInThread:thread];
[self.messageSenderJobQueue addMessage:emptyMessage transaction:transaction]; [self.messageSenderJobQueue addMessage:backgroundMessage transaction:transaction];
} else if (!thread.isContactFriend) { } else if (!thread.isContactFriend) {
// Checking that the sender of the message isn't already a friend is necessary because otherwise // Checking that the sender of the message isn't already a friend is necessary because otherwise
// the following situation can occur: Alice and Bob are friends. Bob loses his database and his // the following situation can occur: Alice and Bob are friends. Bob loses his database and his

Loading…
Cancel
Save