diff --git a/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/ExampleInstrumentedTest.kt b/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/ExampleInstrumentedTest.kt index b76380f616..eee938ea1d 100644 --- a/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/ExampleInstrumentedTest.kt +++ b/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/ExampleInstrumentedTest.kt @@ -36,6 +36,7 @@ class ExampleInstrumentedTest { val nameFromNative = userProfile.getName() assertEquals(newName, nameFromNative) println("Name received by JNI call: $nameFromNative") + assertTrue(userProfile.dirty()) userProfile.free() } diff --git a/libsession-util/src/main/cpp/session_util.cpp b/libsession-util/src/main/cpp/session_util.cpp index 5b8d6fb251..b5432e4835 100644 --- a/libsession-util/src/main/cpp/session_util.cpp +++ b/libsession-util/src/main/cpp/session_util.cpp @@ -51,4 +51,11 @@ JNIEXPORT void JNICALL Java_network_loki_messenger_libsession_1util_UserProfile_free(JNIEnv *env, jobject obj) { auto profile = ptrToProfile(env, obj); delete profile; +} + +extern "C" +JNIEXPORT jboolean JNICALL +Java_network_loki_messenger_libsession_1util_ConfigBase_dirty(JNIEnv *env, jobject thiz) { + auto* configBase = ptrToConfigBase(env, thiz); + return configBase->is_dirty(); } \ 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 a101549e2b..e765668d2f 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 @@ -7,9 +7,9 @@ sealed class ConfigBase(protected val /* yucky */ pointer: Long) { System.loadLibrary("session_util") } } + external fun dirty(): Boolean } - class UserProfile(pointer: Long): ConfigBase(pointer) { companion object { init {