From 51d9de02265d6cc9d6045d79497d2a987ae2f7f7 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 15 Nov 2016 14:21:27 +0300 Subject: core classes are now serializeable with JAXB (to use as babbler extension) --- .../java/com/juick/components/Notifications.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'juick-notifications/src/main/java/com/juick/components') 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 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>() { }).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>() { }).getBody()); } @@ -170,12 +170,12 @@ public class Notifications implements InitializingBean, DisposableBean, Stream.S final List 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>() { }).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>() { }).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 + "" + "" + "" - + "" + + "" + "" + text1 + "" + "" + text2 + "" + "" + "" + "" - + "" + + "" + "" + ""; logger.trace(xml); @@ -217,12 +217,12 @@ public class Notifications implements InitializingBean, DisposableBean, Stream.S final List 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>() { }).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>() { }).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); } -- cgit v1.2.3