diff options
author | Vitaly Takmazov | 2016-11-22 17:49:03 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-22 17:49:03 +0300 |
commit | aa3c1a06ed46f49b617e2956b6cf9a1b0d367fb0 (patch) | |
tree | 722163db0e9b060a5c4f7902fd422c0c2b13032e /juick-notifications/src/main/java/com/juick/components/Notifications.java | |
parent | 8b267a3b630f5843623801f42eb90d0ad6a9d849 (diff) |
add APNS feedback component
Diffstat (limited to 'juick-notifications/src/main/java/com/juick/components/Notifications.java')
-rw-r--r-- | juick-notifications/src/main/java/com/juick/components/Notifications.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/juick-notifications/src/main/java/com/juick/components/Notifications.java b/juick-notifications/src/main/java/com/juick/components/Notifications.java index ebc69bd1..cb120ce9 100644 --- a/juick-notifications/src/main/java/com/juick/components/Notifications.java +++ b/juick-notifications/src/main/java/com/juick/components/Notifications.java @@ -48,6 +48,7 @@ import rocks.xmpp.core.session.XmppSessionConfiguration; import rocks.xmpp.extensions.component.accept.ExternalComponent; import javax.annotation.PostConstruct; +import javax.inject.Inject; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -70,10 +71,12 @@ public class Notifications implements AutoCloseable { private final int xmppPort; private final String xmppPushPassword; + @Inject + private ApnsService apns; + public Notifications(final Environment env, final RestTemplate rest) { this.rest = rest; - wns_application_sip = env.getProperty("wns_application_sip", ""); wns_client_secret = env.getProperty("wns_client_secret", ""); GCMSender = new Sender(env.getProperty("gcm_key", ""), Endpoint.GCM); @@ -191,12 +194,10 @@ public class Notifications implements AutoCloseable { }).getBody()); } if (!tokens.isEmpty()) { - ApnsService service = APNS.newService().withCert("/etc/juick/ios.p12", "juick") - .withSandboxDestination().build(); for (String token : tokens) { String payload = APNS.newPayload().alertTitle("@" + jmsg.getUser().getName()).alertBody(jmsg.getText()).build(); logger.info("APNS: " + token); - service.push(token, payload); + apns.push(token, payload); } } else { logger.info("APNS: no recipients"); |