fix end session message init function

pull/248/head
Ryan ZHAO 4 years ago
parent e2157dacbf
commit 5afdd81806

@ -21,6 +21,8 @@ NS_SWIFT_NAME(EndSessionMessage)
contactShare:(nullable OWSContact *)contactShare
linkPreview:(nullable OWSLinkPreview *)linkPreview NS_UNAVAILABLE;
- (instancetype)initInThread:(nullable TSThread *)thread messageBody:(nullable NSString *)body attachmentId:(nullable NSString *)attachmentId NS_DESIGNATED_INITIALIZER;
// MJK TODO can we remove the sender timestamp?
- (instancetype)initWithTimestamp:(uint64_t)timestamp inThread:(nullable TSThread *)thread NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;

@ -5,6 +5,7 @@
#import "OWSEndSessionMessage.h"
#import "OWSPrimaryStorage+Loki.h"
#import "SignalRecipient.h"
#import <SessionCoreKit/NSDate+OWS.h>
#import <SessionServiceKit/SessionServiceKit-Swift.h>
NS_ASSUME_NONNULL_BEGIN
@ -31,6 +32,26 @@ NS_ASSUME_NONNULL_BEGIN
linkPreview:nil];
}
- (instancetype)initInThread:(nullable TSThread *)thread messageBody:(nullable NSString *)body attachmentId:(nullable NSString *)attachmentId
{
NSMutableArray<NSString *> *attachmentIds = [NSMutableArray new];
if (attachmentId) {
[attachmentIds addObject:attachmentId];
}
return [super initOutgoingMessageWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
messageBody:body
attachmentIds:attachmentIds
expiresInSeconds:0
expireStartedAt:0
isVoiceMessage:NO
groupMetaMessage:TSGroupMetaMessageUnspecified
quotedMessage:nil
contactShare:nil
linkPreview:nil];
}
- (BOOL)shouldBeSaved
{
return NO;

Loading…
Cancel
Save