From 116ab83b958025eb6620c6230026f64bde1f3c69 Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Thu, 9 Jul 2020 13:52:25 -0400 Subject: [PATCH] Include a PushType header when sending APNs notifications. --- .../org/whispersystems/textsecuregcm/push/APNSender.java | 3 ++- .../textsecuregcm/push/RetryingApnsClient.java | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/push/APNSender.java b/service/src/main/java/org/whispersystems/textsecuregcm/push/APNSender.java index faae2a6d6..7ca016050 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/push/APNSender.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/push/APNSender.java @@ -92,7 +92,8 @@ public class APNSender implements Managed { ListenableFuture future = apnsClient.send(message.getApnId(), topic, message.getMessage(), - Instant.ofEpochMilli(message.getExpirationTime())); + Instant.ofEpochMilli(message.getExpirationTime()), + message.isVoip()); Futures.addCallback(future, new FutureCallback() { @Override diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/push/RetryingApnsClient.java b/service/src/main/java/org/whispersystems/textsecuregcm/push/RetryingApnsClient.java index 706e43ca7..91a1419e8 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/push/RetryingApnsClient.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/push/RetryingApnsClient.java @@ -7,6 +7,7 @@ import com.eatthepath.pushy.apns.ApnsClient; import com.eatthepath.pushy.apns.ApnsClientBuilder; import com.eatthepath.pushy.apns.DeliveryPriority; import com.eatthepath.pushy.apns.PushNotificationResponse; +import com.eatthepath.pushy.apns.PushType; import com.eatthepath.pushy.apns.auth.ApnsSigningKey; import com.eatthepath.pushy.apns.metrics.dropwizard.DropwizardApnsClientMetricsListener; import com.eatthepath.pushy.apns.util.SimpleApnsPushNotification; @@ -54,9 +55,9 @@ public class RetryingApnsClient { this.apnsClient = apnsClient; } - ListenableFuture send(final String apnId, final String topic, final String payload, final Instant expiration) { + ListenableFuture send(final String apnId, final String topic, final String payload, final Instant expiration, final boolean isVoip) { SettableFuture result = SettableFuture.create(); - SimpleApnsPushNotification notification = new SimpleApnsPushNotification(apnId, topic, payload, expiration, DeliveryPriority.IMMEDIATE); + SimpleApnsPushNotification notification = new SimpleApnsPushNotification(apnId, topic, payload, expiration, DeliveryPriority.IMMEDIATE, isVoip ? PushType.VOIP : PushType.ALERT); apnsClient.sendNotification(notification).whenComplete(new ResponseHandler(result));