use of org.lpw.ranch.push.ios.IosModel in project ranch by heisedebaise.
the class IosSenderImpl method send.
@Override
public boolean send(PushModel push, String receiver, JSONObject args) {
IosModel ios = iosService.find(push.getAppCode(), args.getIntValue("destination"));
if (ios == null)
return false;
ApnsService service = iosService.getApnsService(ios.getAppCode(), ios.getDestination());
if (service == null)
return false;
PayloadBuilder payloadBuilder = APNS.newPayload();
payloadBuilder.alertTitle(pushService.parse(PushService.Type.Subject, push.getKey(), push.getSubject(), args));
payloadBuilder.alertBody(pushService.parse(PushService.Type.Content, push.getKey(), push.getContent(), args));
payloadBuilder.badge((json.containsKey(args, "badge") ? args.getIntValue("badge") : 1) + 1);
payloadBuilder.sound(json.containsKey(args, "sound") ? args.getString("sound") : "default");
service.push(receiver, payloadBuilder.build());
return true;
}
Aggregations