Only update devices that aren't already disabled

This commit is contained in:
Jon Chambers
2023-10-24 15:29:03 -04:00
committed by GitHub
parent 21125c2f5a
commit e4de6bf4a7
2 changed files with 95 additions and 7 deletions

View File

@@ -112,7 +112,7 @@ public class ProcessPushNotificationFeedbackCommand extends AbstractSinglePassCr
}
@VisibleForTesting
boolean deviceNeedsUpdate(final Device device) {
boolean pushFeedbackIntervalElapsed(final Device device) {
// After we get an indication that a device may have uninstalled the Signal app (`uninstalledFeedbackTimestamp` is
// non-zero), check back in after a few days to see what ultimately happened.
return device.getUninstalledFeedbackTimestamp() != 0 &&
@@ -129,6 +129,11 @@ public class ProcessPushNotificationFeedbackCommand extends AbstractSinglePassCr
return Instant.ofEpochMilli(device.getLastSeen()).plus(MAX_TOKEN_REFRESH_DELAY).isBefore(clock.instant());
}
@VisibleForTesting
boolean deviceNeedsUpdate(final Device device) {
return pushFeedbackIntervalElapsed(device) && (device.isEnabled() || device.getLastSeen() > device.getUninstalledFeedbackTimestamp());
}
@VisibleForTesting
static Optional<String> getUserAgent(final Device device) {
if (StringUtils.isNotBlank(device.getApnId())) {