From 0729bdab204eef64cc6497171dd78d6048307e75 Mon Sep 17 00:00:00 2001 From: 0x330a <92654767+0x330a@users.noreply.github.com> Date: Mon, 16 Jan 2023 15:47:06 +1100 Subject: [PATCH] refactor: naming consistent with library --- libsession-util/libsession-util | 2 +- .../loki/messenger/libsession_util/InstrumentedTests.kt | 4 ++-- libsession-util/src/main/cpp/contacts.cpp | 4 ++-- .../java/network/loki/messenger/libsession_util/Config.kt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libsession-util/libsession-util b/libsession-util/libsession-util index 3060122d0f..65cc4d6b0a 160000 --- a/libsession-util/libsession-util +++ b/libsession-util/libsession-util @@ -1 +1 @@ -Subproject commit 3060122d0f1d1a6bc7bd22f7799280ce298568e2 +Subproject commit 65cc4d6b0afaa6d12a9887c8814b16da5dc45863 diff --git a/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/InstrumentedTests.kt b/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/InstrumentedTests.kt index 7b6f4d5c15..94b5d10fe0 100644 --- a/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/InstrumentedTests.kt +++ b/libsession-util/src/androidTest/java/network/loki/messenger/libsession_util/InstrumentedTests.kt @@ -56,7 +56,7 @@ class InstrumentedTests { assertNull(contacts.get(definitelyRealId)) // Should be an uninitialized contact apart from ID - val c = contacts.getOrCreate(definitelyRealId) + val c = contacts.getOrConstruct(definitelyRealId) assertEquals(definitelyRealId, c.id) assertNull(c.name) assertNull(c.nickname) @@ -97,7 +97,7 @@ class InstrumentedTests { assertFalse(contacts2.needsDump()) val anotherId = "051111111111111111111111111111111111111111111111111111111111111111" - val c2 = contacts2.getOrCreate(anotherId) + val c2 = contacts2.getOrConstruct(anotherId) contacts2.set(c2) val push2 = contacts2.push() assertEquals(2, push2.seqNo) diff --git a/libsession-util/src/main/cpp/contacts.cpp b/libsession-util/src/main/cpp/contacts.cpp index 6c8146928a..156812b8e1 100644 --- a/libsession-util/src/main/cpp/contacts.cpp +++ b/libsession-util/src/main/cpp/contacts.cpp @@ -16,8 +16,8 @@ Java_network_loki_messenger_libsession_1util_Contacts_get(JNIEnv *env, jobject t extern "C" JNIEXPORT jobject JNICALL -Java_network_loki_messenger_libsession_1util_Contacts_getOrCreate(JNIEnv *env, jobject thiz, - jstring session_id) { +Java_network_loki_messenger_libsession_1util_Contacts_getOrConstruct(JNIEnv *env, jobject thiz, + jstring session_id) { auto contacts = ptrToContacts(env, thiz); auto session_id_chars = env->GetStringUTFChars(session_id, nullptr); auto contact = contacts->get_or_construct(session_id_chars); 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 267da4b73c..1be5cbfe63 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 @@ -43,7 +43,7 @@ class Contacts(pointer: Long) : ConfigBase(pointer) { } external fun get(sessionId: String): Contact? - external fun getOrCreate(sessionId: String): Contact + external fun getOrConstruct(sessionId: String): Contact external fun all(): List external fun set(contact: Contact) external fun erase(sessionId: String): Boolean