From ff7a5f471b85af6327f513815c15ddaf23af2766 Mon Sep 17 00:00:00 2001 From: Jon Chambers Date: Tue, 21 Nov 2023 17:48:38 -0500 Subject: [PATCH] Always use "conserve power" priority for challenge notifications --- .../org/whispersystems/textsecuregcm/push/APNSender.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 d67c2902e..72f7cfa5a 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/push/APNSender.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/push/APNSender.java @@ -121,8 +121,12 @@ public class APNSender implements Managed, PushNotificationSender { pushType = notification.urgent() ? PushType.ALERT : PushType.BACKGROUND; } - final DeliveryPriority deliveryPriority = - (notification.urgent() || isVoip) ? DeliveryPriority.IMMEDIATE : DeliveryPriority.CONSERVE_POWER; + final DeliveryPriority deliveryPriority = switch (notification.notificationType()) { + case NOTIFICATION -> + (notification.urgent() || isVoip) ? DeliveryPriority.IMMEDIATE : DeliveryPriority.CONSERVE_POWER; + case ATTEMPT_LOGIN_NOTIFICATION_HIGH_PRIORITY -> DeliveryPriority.IMMEDIATE; + case CHALLENGE, RATE_LIMIT_CHALLENGE -> DeliveryPriority.CONSERVE_POWER; + }; final String collapseId = (notification.notificationType() == PushNotification.NotificationType.NOTIFICATION && notification.urgent() && !isVoip)