Align push notification types and delivery priorities
This commit is contained in:
parent
db17693ba7
commit
34a943832a
|
@ -113,21 +113,28 @@ public class APNSender implements Managed, PushNotificationSender {
|
||||||
.build();
|
.build();
|
||||||
};
|
};
|
||||||
|
|
||||||
final PushType pushType;
|
final PushType pushType = switch (notification.notificationType()) {
|
||||||
|
case NOTIFICATION -> {
|
||||||
if (isVoip) {
|
if (isVoip) {
|
||||||
pushType = PushType.VOIP;
|
yield PushType.VOIP;
|
||||||
} else {
|
} else {
|
||||||
pushType = notification.urgent() ? PushType.ALERT : PushType.BACKGROUND;
|
yield notification.urgent() ? PushType.ALERT : PushType.BACKGROUND;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
final DeliveryPriority deliveryPriority = switch (notification.notificationType()) {
|
case ATTEMPT_LOGIN_NOTIFICATION_HIGH_PRIORITY -> PushType.ALERT;
|
||||||
case NOTIFICATION ->
|
case CHALLENGE, RATE_LIMIT_CHALLENGE -> PushType.BACKGROUND;
|
||||||
(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 DeliveryPriority deliveryPriority;
|
||||||
|
|
||||||
|
if (pushType == PushType.BACKGROUND) {
|
||||||
|
deliveryPriority = DeliveryPriority.CONSERVE_POWER;
|
||||||
|
} else {
|
||||||
|
deliveryPriority = (notification.urgent() || isVoip)
|
||||||
|
? DeliveryPriority.IMMEDIATE
|
||||||
|
: DeliveryPriority.CONSERVE_POWER;
|
||||||
|
}
|
||||||
|
|
||||||
final String collapseId =
|
final String collapseId =
|
||||||
(notification.notificationType() == PushNotification.NotificationType.NOTIFICATION && notification.urgent() && !isVoip)
|
(notification.notificationType() == PushNotification.NotificationType.NOTIFICATION && notification.urgent() && !isVoip)
|
||||||
? "incoming-message" : null;
|
? "incoming-message" : null;
|
||||||
|
|
Loading…
Reference in New Issue