From 530e8b0547cc6df52254dab4128607e3a530a57c Mon Sep 17 00:00:00 2001 From: Mario Danic Date: Sun, 25 Aug 2019 23:24:18 +0200 Subject: [PATCH] Refactoring & fix for earlier Nc versions Signed-off-by: Mario Danic --- .../com/nextcloud/talk/jobs/NotificationWorker.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java index 6acdbf149..dc27657f8 100644 --- a/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java +++ b/app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java @@ -93,7 +93,6 @@ import java.net.CookieManager; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; -import java.util.Calendar; import java.util.HashMap; import java.util.zip.CRC32; @@ -113,7 +112,7 @@ public class NotificationWorker extends Worker { @Inject OkHttpClient okHttpClient; - NcApi ncApi; + private NcApi ncApi; private DecryptedPushMessage decryptedPushMessage; private Context context; @@ -161,7 +160,11 @@ public class NotificationWorker extends Worker { } else { conversationType = "public"; } - showMessageNotificationWithObjectData(intent); + if (decryptedPushMessage.getNotificationId() != Long.MIN_VALUE) { + showNotificationWithObjectData(intent); + } else { + showNotification(intent); + } } } @@ -177,7 +180,7 @@ public class NotificationWorker extends Worker { } } - private void showMessageNotificationWithObjectData(Intent intent) { + private void showNotificationWithObjectData(Intent intent) { UserEntity userEntity = signatureVerification.getUserEntity(); ncApi.getNotification(credentials, ApiUtils.getUrlForNotificationWithId(userEntity.getBaseUrl(), Long.toString(decryptedPushMessage.getNotificationId()))) @@ -584,7 +587,7 @@ public class NotificationWorker extends Worker { break; case "chat": if (decryptedPushMessage.getNotificationId() != Long.MIN_VALUE) { - showMessageNotificationWithObjectData(intent); + showNotificationWithObjectData(intent); } else { showNotification(intent); }