diff options
author | Vitaly Takmazov | 2016-11-15 14:21:27 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-15 14:21:27 +0300 |
commit | 51d9de02265d6cc9d6045d79497d2a987ae2f7f7 (patch) | |
tree | d7dd2e534452cab45b8ebdba1e52c498951c5035 /juick-notifications/src/main/java/com | |
parent | 32a6feb195171e06d60117ad758cc8beb50e5ca3 (diff) |
core classes are now serializeable with JAXB (to use as babbler extension)
Diffstat (limited to 'juick-notifications/src/main/java/com')
-rw-r--r-- | juick-notifications/src/main/java/com/juick/components/Notifications.java | 26 |
1 files changed, 13 insertions, 13 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 b7e6b2b8..d37f7a25 100644 --- a/juick-notifications/src/main/java/com/juick/components/Notifications.java +++ b/juick-notifications/src/main/java/com/juick/components/Notifications.java @@ -128,20 +128,20 @@ public class Notifications implements InitializingBean, DisposableBean, Stream.S @Override public void onMessage(final com.juick.xmpp.Message msg) { JuickMessage jmsg = (JuickMessage) msg.getChild(JuickMessage.XMLNS); - boolean isPM = jmsg.getMID() == 0; - boolean isReply = jmsg.getRID() > 0; + boolean isPM = jmsg.getMid() == 0; + boolean isReply = jmsg.getRid() > 0; int pmTo = 0; /*** ANDROID ***/ final List<String> regids = new ArrayList<>(); if (isPM) { regids.addAll(rest.exchange(String.format("http://api.juick.com/notifications?type=gcm&uid=%s", - jmsg.getUser().getUID()), + jmsg.getUser().getUid()), HttpMethod.GET, null, new ParameterizedTypeReference<List<String>>() { }).getBody()); } else { regids.addAll(rest.exchange(String.format("http://api.juick.com/notifications?type=gcm&uid=%s&mid=%s", - jmsg.getUser().getUID(), jmsg.getMID()), + jmsg.getUser().getUid(), jmsg.getMid()), HttpMethod.GET, null, new ParameterizedTypeReference<List<String>>() { }).getBody()); } @@ -170,12 +170,12 @@ public class Notifications implements InitializingBean, DisposableBean, Stream.S final List<String> urls = new ArrayList<>(); if (isPM) { urls.addAll(rest.exchange(String.format("http://api.juick.com/notifications?type=mpns&uid=%s", - jmsg.getUser().getUID()), + jmsg.getUser().getUid()), HttpMethod.GET, null, new ParameterizedTypeReference<List<String>>() { }).getBody()); } else { urls.addAll(rest.exchange(String.format("http://api.juick.com/notifications?type=mpns&uid=%s&mid=%s", - jmsg.getUser().getUID(), jmsg.getMID()), + jmsg.getUser().getUid(), jmsg.getMid()), HttpMethod.GET, null, new ParameterizedTypeReference<List<String>>() { }).getBody()); } @@ -185,8 +185,8 @@ public class Notifications implements InitializingBean, DisposableBean, Stream.S } else { try { String wnsToken = getWnsAccessToken(); - String text1 = "@" + jmsg.getUser().getUName(); - if (!jmsg.Tags.isEmpty()) { + String text1 = "@" + jmsg.getUser().getName(); + if (!jmsg.getTags().isEmpty()) { text1 += ":" + XmlUtils.escape(jmsg.getTagsString()); } String text2 = XmlUtils.escape(jmsg.getText()); @@ -194,13 +194,13 @@ public class Notifications implements InitializingBean, DisposableBean, Stream.S + "<toast>" + "<visual>" + "<binding template=\"ToastImageAndText02\">" - + "<image id=\"1\" src=\"http://i.juick.com/as/" + jmsg.getUser().getUID() + ".png\" />" + + "<image id=\"1\" src=\"http://i.juick.com/as/" + jmsg.getUser().getUid() + ".png\" />" + "<text id=\"1\">" + text1 + "</text>" + "<text id=\"2\">" + text2 + "</text>" + "</binding>" + "</visual>" + "<commands>" - + "<command arguments=\"?mid=" + jmsg.getMID() + "\" />" + + "<command arguments=\"?mid=" + jmsg.getMid() + "\" />" + "</commands>" + "</toast>"; logger.trace(xml); @@ -217,12 +217,12 @@ public class Notifications implements InitializingBean, DisposableBean, Stream.S final List<String> tokens = new ArrayList<>(); if (isPM) { tokens.addAll(rest.exchange(String.format("http://api.juick.com/notifications?type=apns&uid=%s", - jmsg.getUser().getUID()), + jmsg.getUser().getUid()), HttpMethod.GET, null, new ParameterizedTypeReference<List<String>>() { }).getBody()); } else { tokens.addAll(rest.exchange(String.format("http://api.juick.com/notifications?type=apns&uid=%s&mid=%s", - jmsg.getUser().getUID(), jmsg.getMID()), + jmsg.getUser().getUid(), jmsg.getMid()), HttpMethod.GET, null, new ParameterizedTypeReference<List<String>>() { }).getBody()); } @@ -230,7 +230,7 @@ public class Notifications implements InitializingBean, DisposableBean, Stream.S ApnsService service = APNS.newService().withCert("/etc/juick/ios.p12", "juick") .withSandboxDestination().build(); for (String token : tokens) { - String payload = APNS.newPayload().alertTitle("@" + jmsg.getUser().getUName()).alertBody(jmsg.getText()).build(); + String payload = APNS.newPayload().alertTitle("@" + jmsg.getUser().getName()).alertBody(jmsg.getText()).build(); logger.info("APNS: " + token); service.push(token, payload); } |