Adding support for removing old tokens #755
Adding support for removing old tokens #755
Conversation
@@ -137,6 +139,9 @@ public Response crossOriginForInstallations(@Context HttpHeaders headers) { | |||
* @param entity {@link Installation} for Device registration | |||
* @return registered {@link Installation} | |||
* | |||
* @requestheader x-ag-old-token the old push service dependant token (ie InstanceID in FCM). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunaltey, we also need a JavaDoc @param
here, since the build is failing :/(
@@ -171,6 +177,11 @@ public Response registerInstallation( | |||
// otherwise we register a new installation: | |||
logger.trace("Mobile Application on device was launched"); | |||
|
|||
//The token has changed, remove the old one | |||
if (!oldToken.isEmpty() && !oldToken.equals(entity.getDeviceToken())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would a device send its current token as the old one ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the device isn't making a similar check on its end.
@@ -171,6 +177,11 @@ public Response registerInstallation( | |||
// otherwise we register a new installation: | |||
logger.trace("Mobile Application on device was launched"); | |||
|
|||
//The token has changed, remove the old one | |||
if (!oldToken.isEmpty() && !oldToken.equals(entity.getDeviceToken())) { | |||
clientInstallationService.removeInstallationForVariantByDeviceToken(variant.getVariantID(), oldToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add a log here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@secondsun you can easily test if it breaks, using CURL:
馃榿 |
btw. tested with
@secondsun @corinnekrych workz! |
@matzew @danielpassos 馃憮 ?
@corinnekrych or someone else, can you confirm this doesn't cause any regressions with iOS?