feat: add basic group info wrapper to libsession util
This commit is contained in:
parent
284ed16dc0
commit
eb30d17a3d
|
@ -30,7 +30,8 @@ set(SOURCES
|
|||
config_base.cpp
|
||||
contacts.cpp
|
||||
conversation.cpp
|
||||
util.cpp)
|
||||
util.cpp
|
||||
group_info.cpp)
|
||||
|
||||
add_library( # Sets the name of the library.
|
||||
session_util
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#include <jni.h>
|
||||
#include "group_info.h"
|
||||
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_network_loki_messenger_libsession_1util_GroupInfoConfig_newInstance__Ljava_lang_String_2(
|
||||
JNIEnv *env, jobject thiz, jstring pub_key_hex) {
|
||||
auto pub_key = env->GetStringUTFChars(pub_key_hex, nullptr);
|
||||
|
||||
env->ReleaseStringUTFChars(pub_key_hex, pub_key);
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_network_loki_messenger_libsession_1util_GroupInfoConfig_newInstance__Ljava_lang_String_2_3B(
|
||||
JNIEnv *env, jobject thiz, jstring pub_key_hex, jbyteArray secret_key) {
|
||||
// TODO: implement newInstance()
|
||||
}
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_network_loki_messenger_libsession_1util_GroupInfoConfig_newInstance__Ljava_lang_String_2_3B_3B(
|
||||
JNIEnv *env, jobject thiz, jstring pub_key_hex, jbyteArray secret_key,
|
||||
jbyteArray initial_dump) {
|
||||
// TODO: implement newInstance()
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef SESSION_ANDROID_GROUP_INFO_H
|
||||
#define SESSION_ANDROID_GROUP_INFO_H
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#endif //SESSION_ANDROID_GROUP_INFO_H
|
|
@ -23,6 +23,7 @@ sealed class ConfigBase(protected val /* yucky */ pointer: Long) {
|
|||
is Contacts -> Kind.CONTACTS
|
||||
is ConversationVolatileConfig -> Kind.CONVO_INFO_VOLATILE
|
||||
is UserGroupsConfig -> Kind.GROUPS
|
||||
is GroupInfoConfig -> Kind.CLOSED_GROUP_INFO
|
||||
}
|
||||
|
||||
// TODO: time in future to activate (hardcoded to 1st jan 2024 for testing, change before release)
|
||||
|
@ -197,4 +198,14 @@ class UserGroupsConfig(pointer: Long): ConfigBase(pointer) {
|
|||
external fun all(): List<GroupInfo>
|
||||
external fun allCommunityInfo(): List<GroupInfo.CommunityGroupInfo>
|
||||
external fun allLegacyGroupInfo(): List<GroupInfo.LegacyGroupInfo>
|
||||
}
|
||||
}
|
||||
|
||||
class GroupInfoConfig(pointer: Long): ConfigBase(pointer) {
|
||||
companion object {}
|
||||
init {
|
||||
System.loadLibrary("session_util")
|
||||
}
|
||||
external fun newInstance(pubKeyHex: String): GroupInfoConfig
|
||||
external fun newInstance(pubKeyHex: String, secretKey: ByteArray?): GroupInfoConfig
|
||||
external fun newInstance(pubKeyHex: String, secretKey: ByteArray?, initialDump: ByteArray): GroupInfoConfig
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue