Skip to content

Commit c9fece4

Browse files
SessionHero01SessionHero01
authored andcommitted
Tidy up
1 parent 611a7d1 commit c9fece4

File tree

5 files changed

+15
-44
lines changed

5 files changed

+15
-44
lines changed

library/src/main/cpp/config_base.cpp

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -96,34 +96,6 @@ Java_network_loki_messenger_libsession_1util_ConfigBase_merge___3Lkotlin_Pair_2(
9696

9797
#pragma clang diagnostic pop
9898
}
99-
extern "C"
100-
JNIEXPORT jint JNICALL
101-
Java_network_loki_messenger_libsession_1util_ConfigBase_configNamespace(JNIEnv *env, jobject thiz) {
102-
auto conf = ptrToConfigBase(env, thiz);
103-
return (std::int16_t) conf->storage_namespace();
104-
}
105-
extern "C"
106-
JNIEXPORT jclass JNICALL
107-
Java_network_loki_messenger_libsession_1util_ConfigBase_00024Companion_kindFor(JNIEnv *env,
108-
jobject thiz,
109-
jint config_namespace) {
110-
auto user_class = env->FindClass("network/loki/messenger/libsession_util/UserProfile");
111-
auto contact_class = env->FindClass("network/loki/messenger/libsession_util/Contacts");
112-
auto convo_volatile_class = env->FindClass("network/loki/messenger/libsession_util/ConversationVolatileConfig");
113-
auto group_list_class = env->FindClass("network/loki/messenger/libsession_util/UserGroupsConfig");
114-
switch (config_namespace) {
115-
case (int)session::config::Namespace::UserProfile:
116-
return user_class;
117-
case (int)session::config::Namespace::Contacts:
118-
return contact_class;
119-
case (int)session::config::Namespace::ConvoInfoVolatile:
120-
return convo_volatile_class;
121-
case (int)session::config::Namespace::UserGroups:
122-
return group_list_class;
123-
default:
124-
return nullptr;
125-
}
126-
}
12799

128100
extern "C"
129101
JNIEXPORT jobject JNICALL

library/src/main/java/network/loki/messenger/libsession_util/Config.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ import network.loki.messenger.libsession_util.util.GroupInfo
1212
import network.loki.messenger.libsession_util.util.GroupMember
1313
import network.loki.messenger.libsession_util.util.UserPic
1414

15+
typealias ConversationPriority = Long
16+
17+
const val PRIORITY_HIDDEN: ConversationPriority = -1L
18+
const val PRIORITY_VISIBLE: ConversationPriority = 0L
19+
const val PRIORITY_PINNED: ConversationPriority = 1L
20+
1521
sealed class Config(initialPointer: Long): LibSessionUtilCApi() {
1622
var pointer = initialPointer
1723
private set
@@ -72,7 +78,7 @@ interface ReadableUserProfile: ReadableConfig {
7278
fun getName(): String?
7379
fun getPic(): UserPic
7480
fun getProfileUpdatedSeconds(): Long
75-
fun getNtsPriority(): Long
81+
fun getNtsPriority(): ConversationPriority
7682
fun getNtsExpiry(): ExpiryMode
7783
fun getCommunityMessageRequests(): Boolean
7884
fun isBlockCommunityMessageRequestsSet(): Boolean
@@ -94,7 +100,7 @@ interface MutableUserProfile : ReadableUserProfile, MutableConfig {
94100
* Called when setting a re-uploaded pic
95101
*/
96102
fun setReuploadedPic(userPic: UserPic)
97-
fun setNtsPriority(priority: Long)
103+
fun setNtsPriority(priority: ConversationPriority)
98104
fun setNtsExpiry(expiryMode: ExpiryMode)
99105
fun setCommunityMessageRequests(blocks: Boolean)
100106

library/src/main/java/network/loki/messenger/libsession_util/ConfigBase.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@ package network.loki.messenger.libsession_util
33
import network.loki.messenger.libsession_util.util.ConfigPush
44

55
sealed class ConfigBase(pointer: Long): Config(pointer), MutableConfig {
6-
companion object {
7-
init {
8-
System.loadLibrary("session_util")
9-
}
10-
external fun kindFor(configNamespace: Int): Class<ConfigBase>
11-
12-
const val PRIORITY_HIDDEN = -1L
13-
const val PRIORITY_VISIBLE = 0L
14-
const val PRIORITY_PINNED = 1L
15-
16-
}
17-
186
external override fun dirty(): Boolean
197
external override fun needsPush(): Boolean
208
external override fun needsDump(): Boolean

library/src/main/java/network/loki/messenger/libsession_util/util/BlindedContact.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package network.loki.messenger.libsession_util.util
22

3+
import network.loki.messenger.libsession_util.ConversationPriority
4+
35
data class BlindedContact(
46
val id: String,
57
val communityServer: String,
@@ -8,7 +10,7 @@ data class BlindedContact(
810
var createdEpochSeconds: Long,
911
var profileUpdatedEpochSeconds: Long,
1012
var profilePic: UserPic,
11-
var priority: Long,
13+
var priority: ConversationPriority,
1214
) {
1315
@OptIn(ExperimentalStdlibApi::class)
1416
val communityServerPubKey: ByteArray

library/src/main/java/network/loki/messenger/libsession_util/util/Contact.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package network.loki.messenger.libsession_util.util
22

3+
import network.loki.messenger.libsession_util.ConversationPriority
4+
import network.loki.messenger.libsession_util.PRIORITY_VISIBLE
5+
36
data class Contact(
47
val id: String,
58
var name: String = "",
@@ -10,7 +13,7 @@ data class Contact(
1013
var profilePicture: UserPic = UserPic.DEFAULT,
1114
var createdEpochSeconds: Long = 0,
1215
var profileUpdatedEpochSeconds: Long = 0,
13-
var priority: Long = 0,
16+
var priority: ConversationPriority = PRIORITY_VISIBLE,
1417
var expiryMode: ExpiryMode = ExpiryMode.NONE,
1518
) {
1619
val displayName: String

0 commit comments

Comments
 (0)