diff --git a/libsession-util/src/main/cpp/CMakeLists.txt b/libsession-util/src/main/cpp/CMakeLists.txt index 7836bb7adf..5ce7b41669 100644 --- a/libsession-util/src/main/cpp/CMakeLists.txt +++ b/libsession-util/src/main/cpp/CMakeLists.txt @@ -26,6 +26,7 @@ set(SOURCES user_profile.cpp config_base.cpp contacts.cpp + conversation.cpp util.cpp) add_library( # Sets the name of the library. diff --git a/libsession-util/src/main/cpp/conversation.cpp b/libsession-util/src/main/cpp/conversation.cpp new file mode 100644 index 0000000000..3bee143b92 --- /dev/null +++ b/libsession-util/src/main/cpp/conversation.cpp @@ -0,0 +1,19 @@ +#include +#include "conversation.h" + +#pragma clang diagnostic push +extern "C" +#pragma ide diagnostic ignored "bugprone-reserved-identifier" +JNIEXPORT jobject JNICALL +Java_network_loki_messenger_libsession_1util_ConversationVolatileConfig_00024Companion_newInstance___3B( + JNIEnv *env, jobject thiz, jbyteArray ed25519_secret_key) { + +} +extern "C" +#pragma ide diagnostic ignored "bugprone-reserved-identifier" +JNIEXPORT jobject JNICALL +Java_network_loki_messenger_libsession_1util_ConversationVolatileConfig_00024Companion_newInstance___3B_3B( + JNIEnv *env, jobject thiz, jbyteArray ed25519_secret_key, jbyteArray initial_dump) { + +} +#pragma clang diagnostic pop \ No newline at end of file diff --git a/libsession-util/src/main/cpp/conversation.h b/libsession-util/src/main/cpp/conversation.h new file mode 100644 index 0000000000..a202094d2f --- /dev/null +++ b/libsession-util/src/main/cpp/conversation.h @@ -0,0 +1,32 @@ +#ifndef SESSION_ANDROID_CONVERSATION_H +#define SESSION_ANDROID_CONVERSATION_H + +#include +#include "util.h" +#include "session/config/convo_info_volatile.hpp" + +inline session::config::ConvoInfoVolatile *ptrToContacts(JNIEnv *env, jobject obj) { + jclass contactsClass = env->FindClass("network/loki/messenger/libsession_util/ConversationVolatileConfig"); + jfieldID pointerField = env->GetFieldID(contactsClass, "pointer", "J"); + return (session::config::ConvoInfoVolatile *) env->GetLongField(obj, pointerField); +} + +inline jobject serialize_one_on_one(JNIEnv *env, session::config::convo::one_to_one one_to_one) { + // TODO serialize function +} + +inline jobject serialize_open_group(JNIEnv *env, session::config::convo::open_group open_group) { + // TODO +} + +inline jobject serialize_legacy_group(JNIEnv *env, session::config::convo::legacy_closed_group legacy_group) { + +} + +inline jobject serialize_any(JNIEnv *env, session::config::convo::any) + +inline session::config::ConvoInfoVolatile* deserialize_convo_info(JNIEnv *env, jobject info) { + // TODO deserialize function +} + +#endif //SESSION_ANDROID_CONVERSATION_H \ No newline at end of file diff --git a/libsession-util/src/main/java/network/loki/messenger/libsession_util/Config.kt b/libsession-util/src/main/java/network/loki/messenger/libsession_util/Config.kt index cfd4afe612..742145026e 100644 --- a/libsession-util/src/main/java/network/loki/messenger/libsession_util/Config.kt +++ b/libsession-util/src/main/java/network/loki/messenger/libsession_util/Config.kt @@ -67,18 +67,16 @@ class UserProfile(pointer: Long) : ConfigBase(pointer) { external fun setPic(userPic: UserPic) } -class ConversationConfig(pointer: Long): ConfigBase(pointer) { +class ConversationVolatileConfig(pointer: Long): ConfigBase(pointer) { companion object { init { System.loadLibrary("session_util") } - external fun newInstance(ed25519SecretKey: ByteArray): ConversationConfig + external fun newInstance(ed25519SecretKey: ByteArray): ConversationVolatileConfig - external fun newInstance(ed25519SecretKey: ByteArray, initialDump: ByteArray): ConversationConfig + external fun newInstance(ed25519SecretKey: ByteArray, initialDump: ByteArray): ConversationVolatileConfig } - external fun todo() - } \ No newline at end of file