mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Merge branch 'charlesmchen/udIndicators' into hotfix/2.31.1
This commit is contained in:
commit
eb101e7583
|
@ -528,12 +528,18 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
}
|
||||
|
||||
// Send delivery receipts for "valid data" messages received via UD.
|
||||
BOOL wasReceivedByUD = envelope.type == SSKProtoEnvelopeTypeUnidentifiedSender;
|
||||
BOOL wasReceivedByUD = [self wasReceivedByUD:envelope];
|
||||
if (wasReceivedByUD) {
|
||||
[self.outgoingReceiptManager enqueueDeliveryReceiptForEnvelope:envelope];
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)wasReceivedByUD:(SSKProtoEnvelope *)envelope
|
||||
{
|
||||
return (
|
||||
envelope.type == SSKProtoEnvelopeTypeUnidentifiedSender && (!envelope.hasSource || envelope.source.length < 1));
|
||||
}
|
||||
|
||||
- (void)sendGroupInfoRequest:(NSData *)groupId
|
||||
envelope:(SSKProtoEnvelope *)envelope
|
||||
transaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
|
@ -1121,7 +1127,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
NSData *groupId = dataMessage.group ? dataMessage.group.id : nil;
|
||||
OWSContact *_Nullable contact = [OWSContacts contactForDataMessage:dataMessage transaction:transaction];
|
||||
NSNumber *_Nullable serverTimestamp = (envelope.hasServerTimestamp ? @(envelope.serverTimestamp) : nil);
|
||||
BOOL wasReceivedByUD = envelope.type == SSKProtoEnvelopeTypeUnidentifiedSender;
|
||||
BOOL wasReceivedByUD = [self wasReceivedByUD:envelope];
|
||||
|
||||
if (dataMessage.group.type == SSKProtoGroupContextTypeRequestInfo) {
|
||||
[self handleGroupInfoRequest:envelope dataMessage:dataMessage transaction:transaction];
|
||||
|
|
|
@ -1053,6 +1053,25 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
|
|||
}
|
||||
}
|
||||
|
||||
for (NSDictionary *deviceMessage in deviceMessages) {
|
||||
NSNumber *_Nullable messageType = deviceMessage[@"type"];
|
||||
OWSAssertDebug(messageType);
|
||||
BOOL hasValidMessageType;
|
||||
if (messageSend.isUDSend) {
|
||||
hasValidMessageType = [messageType isEqualToNumber:@(TSUnidentifiedSenderMessageType)];
|
||||
} else {
|
||||
hasValidMessageType = ([messageType isEqualToNumber:@(TSEncryptedWhisperMessageType)] ||
|
||||
[messageType isEqualToNumber:@(TSPreKeyWhisperMessageType)]);
|
||||
}
|
||||
|
||||
if (!hasValidMessageType) {
|
||||
OWSFailDebug(@"Invalid message type: %@", messageType);
|
||||
NSError *error = OWSErrorMakeFailedToSendOutgoingMessageError();
|
||||
[error setIsRetryable:NO];
|
||||
return messageSend.failure(error);
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceMessages.count == 0) {
|
||||
// This might happen:
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue