Page MenuHomePhabricator

D7861.id27198.diff
No OneTemporary

D7861.id27198.diff

diff --git a/native/android/app/CMakeLists.txt b/native/android/app/CMakeLists.txt
--- a/native/android/app/CMakeLists.txt
+++ b/native/android/app/CMakeLists.txt
@@ -116,6 +116,7 @@
"./src/cpp/TerminateApp.cpp"
"./src/cpp/ThreadOperationsJNIHelper.cpp"
"./src/cpp/jsiInstaller.cpp"
+ "./src/cpp/NotificationsCryptoModuleJNIHelper.cpp"
)
list(APPEND GENERATED_NATIVE_CODE
diff --git a/native/android/app/src/cpp/NotificationsCryptoModuleJNIHelper.cpp b/native/android/app/src/cpp/NotificationsCryptoModuleJNIHelper.cpp
new file mode 100644
--- /dev/null
+++ b/native/android/app/src/cpp/NotificationsCryptoModuleJNIHelper.cpp
@@ -0,0 +1,28 @@
+#include <Notifications/BackgroundDataStorage/NotificationsCryptoModule.h>
+#include <Notifications/BackgroundDataStorage/NotificationsCryptoModuleJNIHelper.h>
+
+namespace comm {
+int NotificationsCryptoModuleJNIHelper::olmEncryptedTypeMessage(
+ facebook::jni::alias_ref<NotificationsCryptoModuleJNIHelper> jThis) {
+ return NotificationsCryptoModule::olmEncryptedTypeMessage;
+}
+
+std::string NotificationsCryptoModuleJNIHelper::decrypt(
+ facebook::jni::alias_ref<NotificationsCryptoModuleJNIHelper> jThis,
+ std::string data,
+ int messageType,
+ std::string callingProcessName) {
+ std::string decryptedData =
+ NotificationsCryptoModule::decrypt(data, messageType, callingProcessName);
+ return decryptedData;
+}
+
+void NotificationsCryptoModuleJNIHelper::registerNatives() {
+ javaClassStatic()->registerNatives({
+ makeNativeMethod(
+ "olmEncryptedTypeMessage",
+ NotificationsCryptoModuleJNIHelper::olmEncryptedTypeMessage),
+ makeNativeMethod("decrypt", NotificationsCryptoModuleJNIHelper::decrypt),
+ });
+}
+} // namespace comm
\ No newline at end of file
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
@@ -8,6 +8,7 @@
#include <InternalModules/GlobalDBSingletonJNIHelper.h>
#include <NativeModules/CommCoreModule.h>
#include <NativeModules/CommUtilsModule.h>
+#include <Notifications/BackgroundDataStorage/NotificationsCryptoModuleJNIHelper.h>
#include <PersistentStorageUtilities/MessageOperationsUtilities/MessageOperationsUtilitiesJNIHelper.h>
#include <PersistentStorageUtilities/ThreadOperationsUtilities/ThreadOperationsJNIHelper.h>
@@ -66,5 +67,6 @@
comm::MessageOperationsUtilitiesJNIHelper::registerNatives();
comm::GlobalDBSingletonJNIHelper::registerNatives();
comm::DatabaseInitializerJNIHelper::registerNatives();
+ comm::NotificationsCryptoModuleJNIHelper::registerNatives();
});
}
diff --git a/native/android/app/src/main/java/app/comm/android/fbjni/NotificationsCryptoModule.java b/native/android/app/src/main/java/app/comm/android/fbjni/NotificationsCryptoModule.java
new file mode 100644
--- /dev/null
+++ b/native/android/app/src/main/java/app/comm/android/fbjni/NotificationsCryptoModule.java
@@ -0,0 +1,7 @@
+package app.comm.android.fbjni;
+
+public class NotificationsCryptoModule {
+ public static native int olmEncryptedTypeMessage();
+ public static native String
+ decrypt(String data, int messageType, String callingProcessName);
+}
diff --git a/native/cpp/CommonCpp/Notifications/BackgroundDataStorage/NotificationsCryptoModuleJNIHelper.h b/native/cpp/CommonCpp/Notifications/BackgroundDataStorage/NotificationsCryptoModuleJNIHelper.h
new file mode 100644
--- /dev/null
+++ b/native/cpp/CommonCpp/Notifications/BackgroundDataStorage/NotificationsCryptoModuleJNIHelper.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <fbjni/fbjni.h>
+
+namespace comm {
+class NotificationsCryptoModuleJNIHelper
+ : public facebook::jni::JavaClass<NotificationsCryptoModuleJNIHelper> {
+public:
+ static auto constexpr kJavaDescriptor =
+ "Lapp/comm/android/fbjni/NotificationsCryptoModule;";
+
+ static int olmEncryptedTypeMessage(
+ facebook::jni::alias_ref<NotificationsCryptoModuleJNIHelper> jThis);
+
+ static std::string decrypt(
+ facebook::jni::alias_ref<NotificationsCryptoModuleJNIHelper> jThis,
+ std::string data,
+ int messageType,
+ std::string callingProcessName);
+
+ static void registerNatives();
+};
+} // namespace comm
\ No newline at end of file

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 10:33 AM (22 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2589938
Default Alt Text
D7861.id27198.diff (4 KB)

Event Timeline