fix: database update not deleting in certain circumstances, storage persisting and removing the volatile convo info for thread deletion / creation, NTS hidden getter values in shared library

This commit is contained in:
0x330a
2023-03-31 09:01:52 +11:00
parent f111513211
commit 38454bedfc
11 changed files with 207 additions and 66 deletions

View File

@@ -89,4 +89,16 @@ Java_network_loki_messenger_libsession_1util_UserProfile_setNtsHidden(JNIEnv *en
jboolean is_hidden) {
auto profile = ptrToProfile(env, thiz);
profile->set_nts_hidden(is_hidden);
}
extern "C"
JNIEXPORT jint JNICALL
Java_network_loki_messenger_libsession_1util_UserProfile_getNtsPriority(JNIEnv *env, jobject thiz) {
auto profile = ptrToProfile(env, thiz);
return profile->get_nts_priority();
}
extern "C"
JNIEXPORT jboolean JNICALL
Java_network_loki_messenger_libsession_1util_UserProfile_getNtsHidden(JNIEnv *env, jobject thiz) {
auto profile = ptrToProfile(env, thiz);
return profile->get_nts_hidden();
}

View File

@@ -64,7 +64,7 @@ class Contacts(pointer: Long) : ConfigBase(pointer) {
/**
* Similar to [updateIfExists], but will create the underlying contact if it doesn't exist before passing to [updateFunction]
*/
fun upsertContact(sessionId: String, updateFunction: Contact.()->Unit) {
fun upsertContact(sessionId: String, updateFunction: Contact.()->Unit = {}) {
val contact = getOrConstruct(sessionId)
updateFunction(contact)
set(contact)
@@ -95,7 +95,9 @@ class UserProfile(pointer: Long) : ConfigBase(pointer) {
external fun getPic(): UserPic
external fun setPic(userPic: UserPic)
external fun setNtsPriority(priority: Int)
external fun getNtsPriority(): Int
external fun setNtsHidden(isHidden: Boolean)
external fun getNtsHidden(): Boolean
}
class ConversationVolatileConfig(pointer: Long): ConfigBase(pointer) {