Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
agp = "8.12.0"
kotlin = "2.2.0"
agp = "8.13.0"
kotlin = "2.2.20"

[libraries]
junit = { module = "junit:junit", version = "4.13.2" }
Expand Down
12 changes: 8 additions & 4 deletions library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
Expand Down Expand Up @@ -45,17 +47,19 @@ android {
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = "11"
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}
}

kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_11
}
}

publishing {
publications {
create<MavenPublication>("release") {
Expand Down
15 changes: 15 additions & 0 deletions library/src/main/cpp/user_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,25 @@ Java_network_loki_messenger_libsession_1util_UserProfile_setCommunityMessageRequ
auto profile = ptrToProfile(env, thiz);
profile->set_blinded_msgreqs(std::optional{(bool)blocks});
}

extern "C"
JNIEXPORT jboolean JNICALL
Java_network_loki_messenger_libsession_1util_UserProfile_isBlockCommunityMessageRequestsSet(
JNIEnv *env, jobject thiz) {
auto profile = ptrToProfile(env, thiz);
return profile->get_blinded_msgreqs().has_value();
}

extern "C"
JNIEXPORT jlong JNICALL
Java_network_loki_messenger_libsession_1util_UserProfile_getProfileUpdatedSeconds(JNIEnv *env,
jobject thiz) {
return ptrToProfile(env, thiz)->get_profile_updated().time_since_epoch().count();
}

extern "C"
JNIEXPORT void JNICALL
Java_network_loki_messenger_libsession_1util_UserProfile_setReuploadedPic(JNIEnv *env, jobject thiz,
jobject user_pic) {
ptrToProfile(env, thiz)->set_reupload_profile_pic(util::deserialize_user_pic(env, user_pic));
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ interface MutableContacts : ReadableContacts, MutableConfig {
interface ReadableUserProfile: ReadableConfig {
fun getName(): String?
fun getPic(): UserPic
fun getProfileUpdatedSeconds(): Long
fun getNtsPriority(): Long
fun getNtsExpiry(): ExpiryMode
fun getCommunityMessageRequests(): Boolean
Expand All @@ -81,7 +82,16 @@ interface ReadableUserProfile: ReadableConfig {

interface MutableUserProfile : ReadableUserProfile, MutableConfig {
fun setName(newName: String)

/**
* Called when setting a new user pic
*/
fun setPic(userPic: UserPic)

/**
* Called when setting a re-uploaded pic
*/
fun setReuploadedPic(userPic: UserPic)
fun setNtsPriority(priority: Long)
fun setNtsExpiry(expiryMode: ExpiryMode)
fun setCommunityMessageRequests(blocks: Boolean)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class UserProfile private constructor(pointer: Long) : ConfigBase(pointer), Muta
external override fun getName(): String?
external override fun getPic(): UserPic
external override fun setPic(userPic: UserPic)
external override fun getProfileUpdatedSeconds(): Long
external override fun setReuploadedPic(userPic: UserPic)
external override fun setNtsPriority(priority: Long)
external override fun getNtsPriority(): Long
external override fun setNtsExpiry(expiryMode: ExpiryMode)
Expand Down