Page MenuHomePhabricator

D4236.id13426.diff
No OneTemporary

D4236.id13426.diff

diff --git a/native/android/app/src/cpp/ThreadOperationsJNIHelper.cpp b/native/android/app/src/cpp/ThreadOperationsJNIHelper.cpp
new file mode 100644
--- /dev/null
+++ b/native/android/app/src/cpp/ThreadOperationsJNIHelper.cpp
@@ -0,0 +1,24 @@
+#include "ThreadOperationsJNIHelper.h"
+#include "SQLiteQueryExecutor.h"
+#include "ThreadOperations.h"
+
+namespace comm {
+void ThreadOperationsJNIHelper::updateSQLiteUnreadStatus(
+ facebook::jni::alias_ref<ThreadOperationsJNIHelper> jThis,
+ facebook::jni::JString sqliteFilePath,
+ facebook::jni::JString threadID,
+ bool unread) {
+ std::string sqliteFilePathCpp = sqliteFilePath.toStdString();
+ std::string threadIDCpp = threadID.toStdString();
+ SQLiteQueryExecutor::initialize(sqliteFilePathCpp);
+ ThreadOperations::updateSQLiteUnreadStatus(threadIDCpp, unread);
+}
+
+void ThreadOperationsJNIHelper::registerNatives() {
+ javaClassStatic()->registerNatives({
+ makeNativeMethod(
+ "updateSQLiteUnreadStatus",
+ ThreadOperationsJNIHelper::updateSQLiteUnreadStatus),
+ });
+}
+} // namespace comm
diff --git a/native/android/app/src/cpp/jsiInstaller.cpp b/native/android/app/src/cpp/jsiInstaller.cpp
--- a/native/android/app/src/cpp/jsiInstaller.cpp
+++ b/native/android/app/src/cpp/jsiInstaller.cpp
@@ -1,6 +1,7 @@
#include "CommCoreModule.h"
#include "GlobalNetworkSingletonJNIHelper.h"
#include "SQLiteQueryExecutor.h"
+#include "ThreadOperationsJNIHelper.h"
#include "jniHelpers.h"
#include <CallInvokerHolder.h>
#include <fbjni/fbjni.h>
@@ -52,5 +53,6 @@
return jni::initialize(vm, [] {
CommHybrid::registerNatives();
comm::GlobalNetworkSingletonJNIHelper::registerNatives();
+ comm::ThreadOperationsJNIHelper::registerNatives();
});
}
diff --git a/native/android/app/src/main/java/app/comm/android/fbjni/ThreadOperations.java b/native/android/app/src/main/java/app/comm/android/fbjni/ThreadOperations.java
new file mode 100644
--- /dev/null
+++ b/native/android/app/src/main/java/app/comm/android/fbjni/ThreadOperations.java
@@ -0,0 +1,8 @@
+package app.comm.android.fbjni;
+
+public class ThreadOperations {
+ public static native void updateSQLiteUnreadStatus(
+ String sqliteFilePath,
+ String threadID,
+ boolean unread);
+}
diff --git a/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperationsJNIHelper.h b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperationsJNIHelper.h
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/NativeModules/PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperationsJNIHelper.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include <fbjni/fbjni.h>
+
+namespace comm {
+class ThreadOperationsJNIHelper
+ : public facebook::jni::JavaClass<ThreadOperationsJNIHelper> {
+public:
+ static auto constexpr kJavaDescriptor =
+ "Lapp/comm/android/fbjni/ThreadOperations;";
+ static void updateSQLiteUnreadStatus(
+ facebook::jni::alias_ref<ThreadOperationsJNIHelper> jThis,
+ facebook::jni::JString sqliteFilePath,
+ facebook::jni::JString threadID,
+ bool unread);
+ static void registerNatives();
+};
+} // namespace comm

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 3:10 AM (20 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2578132
Default Alt Text
D4236.id13426.diff (3 KB)

Event Timeline