support sealed sender (envelopes with no source) for push notification

pull/87/head
Ryan ZHAO 5 years ago
parent d47698dbed
commit 24f31081d1

@ -230,6 +230,8 @@ public class MessageFetcherJob: NSObject {
request = OWSRequestFactory.acknowledgeMessageDeliveryRequest(withServerGuid: serverGuid) request = OWSRequestFactory.acknowledgeMessageDeliveryRequest(withServerGuid: serverGuid)
} else if let source = envelope.source, source.count > 0, envelope.timestamp > 0 { } else if let source = envelope.source, source.count > 0, envelope.timestamp > 0 {
request = OWSRequestFactory.acknowledgeMessageDeliveryRequest(withSource: source, timestamp: envelope.timestamp) request = OWSRequestFactory.acknowledgeMessageDeliveryRequest(withSource: source, timestamp: envelope.timestamp)
} else if envelope.type == .unidentifiedSender, envelope.timestamp > 0 {
request = OWSRequestFactory.acknowledgeMessageDeliveryRequest(withSource: envelope.source!, timestamp: envelope.timestamp)
} else { } else {
owsFailDebug("Cannot ACK message which has neither source, nor server GUID and timestamp.") owsFailDebug("Cannot ACK message which has neither source, nor server GUID and timestamp.")
return return

@ -64,7 +64,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (TSRequest *)acknowledgeMessageDeliveryRequestWithSource:(NSString *)source timestamp:(UInt64)timestamp + (TSRequest *)acknowledgeMessageDeliveryRequestWithSource:(NSString *)source timestamp:(UInt64)timestamp
{ {
OWSAssertDebug(source.length > 0); // OWSAssertDebug(source.length > 0);
OWSAssertDebug(timestamp > 0); OWSAssertDebug(timestamp > 0);
NSString *path = [NSString stringWithFormat:@"v1/messages/%@/%llu", source, timestamp]; NSString *path = [NSString stringWithFormat:@"v1/messages/%@/%llu", source, timestamp];

Loading…
Cancel
Save