mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
feat: add some basic stuff to test jni interactions
This commit is contained in:
parent
4045333dbc
commit
5bb2bfa779
@ -2,6 +2,13 @@
|
||||
#include <string>
|
||||
#include "session/config/user_profile.hpp"
|
||||
|
||||
|
||||
session::config::UserProfile* ptrToProfile(JNIEnv* env, jobject obj) {
|
||||
jclass configClass = env->FindClass("network/loki/messenger/libsession_util/Config");
|
||||
jfieldID pointerField = env->GetFieldID(configClass, "pointer", "J");
|
||||
return (session::config::UserProfile*) reinterpret_cast<long>(env->GetLongField(obj, pointerField));
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT jobject JNICALL
|
||||
Java_network_loki_messenger_libsession_1util_Config_00024Companion_newInstance(
|
||||
JNIEnv* env,
|
||||
@ -17,3 +24,12 @@ Java_network_loki_messenger_libsession_1util_Config_00024Companion_newInstance(
|
||||
|
||||
return newConfig;
|
||||
}
|
||||
|
||||
extern "C" JNIEXPORT void JNICALL
|
||||
Java_network_loki_messenger_libsession_1util_Config_setName(
|
||||
JNIEnv* env,
|
||||
jobject obj,
|
||||
jstring newName) {
|
||||
auto profile = ptrToProfile(env, obj);
|
||||
profile->set_name(env->GetStringUTFChars(newName, nullptr));
|
||||
}
|
@ -8,6 +8,7 @@ data class Config(private val /* yucky */ pointer: Long) {
|
||||
|
||||
var lastError: String? = null
|
||||
|
||||
external fun setName(newName: String)
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user