Page MenuHomePhabricator

D5237.id17106.diff
No OneTemporary

D5237.id17106.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.GlobalDBSingleton;
import app.comm.android.fbjni.MessageOperationsUtilities;
import app.comm.android.fbjni.NetworkModule;
import app.comm.android.fbjni.ThreadOperations;
@@ -99,8 +100,10 @@
File sqliteFile =
this.getApplicationContext().getDatabasePath("comm.sqlite");
if (rawMessageInfosString != null && sqliteFile.exists()) {
- MessageOperationsUtilities.storeMessageInfos(
- sqliteFile.getPath(), rawMessageInfosString);
+ GlobalDBSingleton.scheduleOrRun(() -> {
+ MessageOperationsUtilities.storeMessageInfos(
+ sqliteFile.getPath(), rawMessageInfosString);
+ });
} else if (rawMessageInfosString != null) {
Log.w("COMM", "Database not existing yet. Skipping notification");
}
@@ -115,8 +118,10 @@
this.getApplicationContext().getDatabasePath("comm.sqlite");
if (sqliteFile.exists()) {
String threadID = message.getData().get(THREAD_ID_KEY);
- ThreadOperations.updateSQLiteUnreadStatus(
- sqliteFile.getPath(), threadID, false);
+ GlobalDBSingleton.scheduleOrRun(() -> {
+ ThreadOperations.updateSQLiteUnreadStatus(
+ sqliteFile.getPath(), threadID, false);
+ });
} else {
Log.w(
"COMM",
diff --git a/native/android/app/src/main/java/app/comm/android/MainApplication.java b/native/android/app/src/main/java/app/comm/android/MainApplication.java
--- a/native/android/app/src/main/java/app/comm/android/MainApplication.java
+++ b/native/android/app/src/main/java/app/comm/android/MainApplication.java
@@ -5,6 +5,7 @@
import android.database.CursorWindow;
import androidx.annotation.NonNull;
import androidx.multidex.MultiDexApplication;
+import app.comm.android.fbjni.GlobalDBSingleton;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
@@ -65,6 +66,7 @@
@Override
public void onCreate() {
super.onCreate();
+ GlobalDBSingleton.enableMultithreading();
Security.insertProviderAt(new org.conscrypt.OpenSSLProvider(), 1);
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 7:49 PM (19 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585958
Default Alt Text
D5237.id17106.diff (2 KB)

Event Timeline