Page MenuHomePhabricator

D4070.diff
No OneTemporary

D4070.diff

diff --git a/native/android/app/src/main/java/app/comm/android/CommNotificationsHandler.java b/native/android/app/src/main/java/app/comm/android/CommNotificationsHandler.java
--- a/native/android/app/src/main/java/app/comm/android/CommNotificationsHandler.java
+++ b/native/android/app/src/main/java/app/comm/android/CommNotificationsHandler.java
@@ -5,6 +5,7 @@
import android.service.notification.StatusBarNotification;
import android.util.Log;
import app.comm.android.fbjni.CommSecureStore;
+import app.comm.android.fbjni.MessageOperationsUtilities;
import app.comm.android.fbjni.NetworkModule;
import app.comm.android.fbjni.ThreadOperations;
import com.google.firebase.messaging.RemoteMessage;
@@ -12,6 +13,8 @@
import io.invertase.firebase.messaging.RNFirebaseMessagingService;
import java.io.File;
import me.leolin.shortcutbadger.ShortcutBadger;
+import org.json.JSONException;
+import org.json.JSONObject;
/**
* We're extending RNFirebaseMessagingService here instead of
@@ -46,6 +49,7 @@
private static final String BACKGROUND_NOTIF_TYPE_KEY = "backgroundNotifType";
private static final String THREAD_ID_KEY = "threadID";
private static final String SET_UNREAD_STATUS_KEY = "setUnreadStatus";
+ private static final String MESSAGE_INFOS_KEY = "messageInfos";
private NotificationManager notificationManager;
@Override
@@ -91,6 +95,16 @@
return;
}
+ String rawMessageInfosString = message.getData().get(MESSAGE_INFOS_KEY);
+ File sqliteFile =
+ this.getApplicationContext().getDatabasePath("comm.sqlite");
+ if (rawMessageInfosString != null && sqliteFile.exists()) {
+ MessageOperationsUtilities.storeMessageInfos(
+ sqliteFile.getPath(), rawMessageInfosString);
+ } else if (rawMessageInfosString != null) {
+ Log.w("COMM", "Database not existing yet. Skipping notification");
+ }
+
super.onMessageReceived(message);
}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 8:06 AM (20 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2519558
Default Alt Text
D4070.diff (1 KB)

Event Timeline