Fix ttl not being set in friend requests.

pull/18/head
Mikunj 6 years ago
parent b5cc66262d
commit 8c8f6231a5

@ -7,7 +7,7 @@ public extension LokiAPI {
let destination: String let destination: String
/// The content of the message. /// The content of the message.
let data: LosslessStringConvertible let data: LosslessStringConvertible
/// The time to live for the message. /// The time to live for the message in seconds.
let ttl: UInt64 let ttl: UInt64
/// When the proof of work was calculated, if applicable. /// When the proof of work was calculated, if applicable.
/// ///

@ -144,7 +144,7 @@ typedef NS_ENUM(NSInteger, TSGroupMetaMessage) {
// Loki: Bool to indicate if proof of work is being calculated for this message // Loki: Bool to indicate if proof of work is being calculated for this message
@property (atomic, readonly) BOOL isCalculatingPoW; @property (atomic, readonly) BOOL isCalculatingPoW;
// Loki: Time to live for the message // Loki: Time to live for the message in seconds
@property (nonatomic, readonly) uint ttl; @property (nonatomic, readonly) uint ttl;
/** /**

@ -1773,6 +1773,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
SignalRecipient *recipient = messageSend.recipient; SignalRecipient *recipient = messageSend.recipient;
NSString *recipientId = recipient.recipientId; NSString *recipientId = recipient.recipientId;
TSOutgoingMessage *message = messageSend.message;
FallBackSessionCipher *cipher = [[FallBackSessionCipher alloc] initWithRecipientId:recipientId identityKeyStore:self.identityManager]; FallBackSessionCipher *cipher = [[FallBackSessionCipher alloc] initWithRecipientId:recipientId identityKeyStore:self.identityManager];
@ -1790,7 +1791,8 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
content:serializedMessage content:serializedMessage
isSilent:false isSilent:false
isOnline:false isOnline:false
registrationId:0]; registrationId:0
ttl:message.ttl];
NSError *error; NSError *error;
NSDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:messageParams error:&error]; NSDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:messageParams error:&error];
@ -1884,10 +1886,8 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
content:serializedMessage content:serializedMessage
isSilent:isSilent isSilent:isSilent
isOnline:isOnline isOnline:isOnline
registrationId:[cipher throws_remoteRegistrationId:transaction]]; registrationId:[cipher throws_remoteRegistrationId:transaction]
ttl:message.ttl];
// Loki: Add the ttl to the message params
messageParams.ttl = message.ttl;
NSError *error; NSError *error;
NSDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:messageParams error:&error]; NSDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:messageParams error:&error];

@ -23,7 +23,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) NSString *content; @property (nonatomic, readonly) NSString *content;
@property (nonatomic, readonly) BOOL silent; @property (nonatomic, readonly) BOOL silent;
@property (nonatomic, readonly) BOOL online; @property (nonatomic, readonly) BOOL online;
@property (nonatomic) uint ttl;
// Loki: Message ttl
@property (nonatomic, readonly) uint ttl;
- (instancetype)initWithType:(TSWhisperMessageType)type - (instancetype)initWithType:(TSWhisperMessageType)type
recipientId:(NSString *)destination recipientId:(NSString *)destination
@ -31,7 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
content:(NSData *)content content:(NSData *)content
isSilent:(BOOL)isSilent isSilent:(BOOL)isSilent
isOnline:(BOOL)isOnline isOnline:(BOOL)isOnline
registrationId:(int)registrationId; registrationId:(int)registrationId
ttl:(uint)ttl;
@end @end

@ -22,6 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
isSilent:(BOOL)isSilent isSilent:(BOOL)isSilent
isOnline:(BOOL)isOnline isOnline:(BOOL)isOnline
registrationId:(int)registrationId registrationId:(int)registrationId
ttl:(uint)ttl
{ {
self = [super init]; self = [super init];
@ -36,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
_content = [content base64EncodedString]; _content = [content base64EncodedString];
_silent = isSilent; _silent = isSilent;
_online = isOnline; _online = isOnline;
_ttl = 0; _ttl = ttl;
return self; return self;
} }

Loading…
Cancel
Save