mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fix ttl not being set in friend requests.
This commit is contained in:
parent
b5cc66262d
commit
8c8f6231a5
|
@ -7,7 +7,7 @@ public extension LokiAPI {
|
|||
let destination: String
|
||||
/// The content of the message.
|
||||
let data: LosslessStringConvertible
|
||||
/// The time to live for the message.
|
||||
/// The time to live for the message in seconds.
|
||||
let ttl: UInt64
|
||||
/// 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
|
||||
@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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1773,6 +1773,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
|
||||
SignalRecipient *recipient = messageSend.recipient;
|
||||
NSString *recipientId = recipient.recipientId;
|
||||
TSOutgoingMessage *message = messageSend.message;
|
||||
|
||||
FallBackSessionCipher *cipher = [[FallBackSessionCipher alloc] initWithRecipientId:recipientId identityKeyStore:self.identityManager];
|
||||
|
||||
|
@ -1790,7 +1791,8 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
content:serializedMessage
|
||||
isSilent:false
|
||||
isOnline:false
|
||||
registrationId:0];
|
||||
registrationId:0
|
||||
ttl:message.ttl];
|
||||
|
||||
NSError *error;
|
||||
NSDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:messageParams error:&error];
|
||||
|
@ -1884,14 +1886,12 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
content:serializedMessage
|
||||
isSilent:isSilent
|
||||
isOnline:isOnline
|
||||
registrationId:[cipher throws_remoteRegistrationId:transaction]];
|
||||
|
||||
// Loki: Add the ttl to the message params
|
||||
messageParams.ttl = message.ttl;
|
||||
registrationId:[cipher throws_remoteRegistrationId:transaction]
|
||||
ttl:message.ttl];
|
||||
|
||||
NSError *error;
|
||||
NSDictionary *jsonDict = [MTLJSONAdapter JSONDictionaryFromModel:messageParams error:&error];
|
||||
|
||||
|
||||
if (error) {
|
||||
OWSProdError([OWSAnalyticsEvents messageSendErrorCouldNotSerializeMessageJson]);
|
||||
return nil;
|
||||
|
|
|
@ -23,7 +23,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
@property (nonatomic, readonly) NSString *content;
|
||||
@property (nonatomic, readonly) BOOL silent;
|
||||
@property (nonatomic, readonly) BOOL online;
|
||||
@property (nonatomic) uint ttl;
|
||||
|
||||
// Loki: Message ttl
|
||||
@property (nonatomic, readonly) uint ttl;
|
||||
|
||||
- (instancetype)initWithType:(TSWhisperMessageType)type
|
||||
recipientId:(NSString *)destination
|
||||
|
@ -31,7 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
content:(NSData *)content
|
||||
isSilent:(BOOL)isSilent
|
||||
isOnline:(BOOL)isOnline
|
||||
registrationId:(int)registrationId;
|
||||
registrationId:(int)registrationId
|
||||
ttl:(uint)ttl;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
isSilent:(BOOL)isSilent
|
||||
isOnline:(BOOL)isOnline
|
||||
registrationId:(int)registrationId
|
||||
ttl:(uint)ttl
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
@ -36,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
_content = [content base64EncodedString];
|
||||
_silent = isSilent;
|
||||
_online = isOnline;
|
||||
_ttl = 0;
|
||||
_ttl = ttl;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue