Open raderio opened 7 years ago
This also will be useful not to wait to add mutable content properties
And will fix https://github.com/notnoop/java-apns/issues/321 https://github.com/notnoop/java-apns/issues/328
I make a hook to "intercept" the payload generated:
String payload = builderPayload.build();
try {
ObjectMapper mapper = new ObjectMapper();
JavaType type = mapper.getTypeFactory().constructParametricType(Map.class, String.class, Object.class);
Map<String, Object> root = mapper.readValue(payload, type);
Map<String, Object> apns = (Map<String, Object>) root.get("aps");
apns.put("apns-collapse-id", mensagemTO.getIdFuncionalidade());
payload = mapper.writeValueAsString(root);
}catch (Exception e){
logger.error("Montando mensagem", e);
}
As https://stackoverflow.com/questions/44560851/apns-collapse-id-not-merging-multiple-notifications-ios-10 said, "apns-collapse-id" is NOT supported in legacy binary interface, does it really work? @ovictorpinto
@keilon collapse-id don't work this way. But the hook to insert a property works =]
Sometimes Apple can add some new properties to APS object. In order to be able to use that new properties as soon as possible it will be good to add support for custom APS properties.
For example now we can add properties to payload
How will be to add properties to APS