Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3358050
D4236.id13426.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D4236.id13426.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D4236: Implement JNI interface to use C++ code to update thread unread status on Android
Attached
Detach File
Event Timeline
Log In to Comment