瀏覽代碼

Refactoring & fix for earlier Nc versions

Signed-off-by: Mario Danic <mario@lovelyhq.com>
Mario Danic 5 年之前
父節點
當前提交
530e8b0547
共有 1 個文件被更改,包括 8 次插入5 次删除
  1. 8 5
      app/src/main/java/com/nextcloud/talk/jobs/NotificationWorker.java

+ 8 - 5
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);
                                     }