diff --git a/library/src/main/cpp/contacts.cpp b/library/src/main/cpp/contacts.cpp index b596fc8..23c119a 100644 --- a/library/src/main/cpp/contacts.cpp +++ b/library/src/main/cpp/contacts.cpp @@ -30,7 +30,7 @@ static JavaLocalRef serialize_contact(JNIEnv *env, const session::confi (jlong) (info.profile_updated.time_since_epoch().count()), (jlong) info.priority, util::serialize_expiry(env, info.exp_mode, info.exp_timer).get(), - (jlong) info.pro_features); + (jlong) info.profile_bitset.data); return {env, returnObj}; } @@ -92,7 +92,9 @@ session::config::contact_info deserialize_contact(JNIEnv *env, jobject info, ses contact_info.priority = env->CallLongMethod(info, class_info.get_priority); contact_info.exp_mode = expiry_pair.first; contact_info.exp_timer = std::chrono::seconds(expiry_pair.second); - contact_info.pro_features = env->CallLongMethod(info, class_info.get_pro_features); + contact_info.profile_bitset = { + .data = static_cast(env->CallLongMethod(info, class_info.get_pro_features)) + }; return contact_info; } @@ -172,7 +174,7 @@ JavaLocalRef serialize_blinded_contact(JNIEnv *env, const session::conf (jlong) (info.profile_updated.time_since_epoch().count()), util::serialize_user_pic(env, info.profile_picture).get(), (jlong) info.priority, - (jlong) info.pro_features + (jlong) info.profile_bitset.data )}; } @@ -196,7 +198,7 @@ session::config::blinded_contact_info deserialize_blinded_contact(JNIEnv *env, j , name_getter(env->GetMethodID(java_class, "getName", "()Ljava/lang/String;")) , created_epoch_seconds_getter(env->GetMethodID(java_class, "getCreatedEpochSeconds", "()J")) , profile_updated_epoch_seconds_getter(env->GetMethodID(java_class, "getProfileUpdatedEpochSeconds", "()J")) - , profile_pic_getter(env->GetMethodID(java_class, "getProfilePicture", "()Lnetwork/loki/messenger/libsession_util/util/UserPic;")) + , profile_pic_getter(env->GetMethodID(java_class, "getProfilePic", "()Lnetwork/loki/messenger/libsession_util/util/UserPic;")) , priority_getter(env->GetMethodID(java_class, "getPriority", "()J")) , pro_features_getter(env->GetMethodID(java_class, "getProFeaturesRaw", "()J")) {} }; @@ -219,7 +221,9 @@ session::config::blinded_contact_info deserialize_blinded_contact(JNIEnv *env, j info.name = JavaStringRef(env, JavaLocalRef(env, (jstring) env->CallObjectMethod(jInfo, class_info.name_getter)).get()).view(); info.profile_updated = std::chrono::sys_seconds{std::chrono::seconds{env->CallLongMethod(jInfo, class_info.profile_updated_epoch_seconds_getter)}}; info.priority = env->CallLongMethod(jInfo, class_info.priority_getter); - info.pro_features = env->CallLongMethod(jInfo, class_info.pro_features_getter); + info.profile_bitset = { + .data = static_cast(env->CallLongMethod(jInfo, class_info.pro_features_getter)) + }; return info; } diff --git a/library/src/main/cpp/protocol.cpp b/library/src/main/cpp/protocol.cpp index dae45d4..0472b22 100644 --- a/library/src/main/cpp/protocol.cpp +++ b/library/src/main/cpp/protocol.cpp @@ -8,7 +8,20 @@ using namespace jni_utils; +static JavaLocalRef serializeDecodedPro(JNIEnv *env, const session::DecodedPro &pro) { + static BasicJavaClassInfo class_info( + env, + "network/loki/messenger/libsession_util/protocol/DecodedPro", + "(ILnetwork/loki/messenger/libsession_util/pro/ProProof;JJ)V" + ); + return {env, env->NewObject(class_info.java_class, class_info.constructor, + static_cast(pro.status), + cpp_to_java_proof(env, pro.proof).get(), + static_cast(pro.msg_bitset.data), + static_cast(pro.profile_bitset.data)) + }; +} static JavaLocalRef serializeEnvelop(JNIEnv *env, const session::Envelope &envelope) { static BasicJavaClassInfo class_info( @@ -32,7 +45,7 @@ static JavaLocalRef serializeDecodedEnvelope(JNIEnv *env, const session static BasicJavaClassInfo class_info( env, "network/loki/messenger/libsession_util/protocol/DecodedEnvelope", - "(Lnetwork/loki/messenger/libsession_util/protocol/Envelope;ILnetwork/loki/messenger/libsession_util/pro/ProProof;J[B[B[BJ)V" + "(Lnetwork/loki/messenger/libsession_util/protocol/Envelope;Lnetwork/loki/messenger/libsession_util/protocol/DecodedPro;[B[B[BJ)V" ); JavaLocalRef sender_ed25519 = util::bytes_from_span(env, envelop.sender_ed25519_pubkey); @@ -41,10 +54,7 @@ static JavaLocalRef serializeDecodedEnvelope(JNIEnv *env, const session return {env, env->NewObject(class_info.java_class, class_info.constructor, serializeEnvelop(env, envelop.envelope).get(), - envelop.pro ? static_cast(envelop.pro->status) - : static_cast(-1), - envelop.pro ? cpp_to_java_proof(env, envelop.pro->proof).get() : nullptr, - static_cast(envelop.pro ? envelop.pro->features : 0), + envelop.pro ? nullptr : serializeDecodedPro(env, *envelop.pro).get(), content.get(), sender_ed25519.get(), sender_x25519.get(), @@ -144,21 +154,16 @@ Java_network_loki_messenger_libsession_1util_protocol_SessionProtocol_decodeForC *java_to_cpp_array<32>(env, pro_backend_pub_key) ); - JavaLocalRef envelopClass(env, env->FindClass( - "network/loki/messenger/libsession_util/protocol/DecodedCommunityMessage")); - jmethodID init = env->GetMethodID( - envelopClass.get(), - "", - "(ILnetwork/loki/messenger/libsession_util/pro/ProProof;J[B)V" + static BasicJavaClassInfo class_info( + env, + "network/loki/messenger/libsession_util/protocol/DecodedCommunityMessage", + "(Lnetwork/loki/messenger/libsession_util/protocol/DecodedPro;[B)V" ); return env->NewObject( - envelopClass.get(), - init, - decoded.pro ? static_cast(decoded.pro->status) - : static_cast(-1), - decoded.pro ? cpp_to_java_proof(env, decoded.pro->proof).get() : nullptr, - static_cast(decoded.pro ? decoded.pro->features : 0), + class_info.java_class, + class_info.constructor, + decoded.pro ? serializeDecodedPro(env, *decoded.pro).get() : nullptr, util::bytes_from_vector(env, decoded.content_plaintext).get() ); }); @@ -250,14 +255,13 @@ Java_network_loki_messenger_libsession_1util_protocol_SessionProtocol_decodeForG extern "C" JNIEXPORT jobject JNICALL Java_network_loki_messenger_libsession_1util_protocol_SessionProtocol_proFeaturesForMessage( - JNIEnv *env, jobject thiz, jstring message_body, jlong proposed_features) { + JNIEnv *env, jobject thiz, jstring message_body) { return run_catching_cxx_exception_or_throws(env, [=] { JavaCharsRef message_ref(env, message_body); auto features = session::pro_features_for_utf16( reinterpret_cast(message_ref.chars()), - message_ref.size(), - static_cast(proposed_features) + message_ref.size() ); static BasicJavaClassInfo class_info( @@ -271,7 +275,7 @@ Java_network_loki_messenger_libsession_1util_protocol_SessionProtocol_proFeature class_info.constructor, static_cast(features.status), features.error.empty() ? nullptr : env->NewStringUTF(std::string(features.error).c_str()), - static_cast(features.features), + static_cast(features.bitset.data), static_cast(features.codepoint_count) ); }); diff --git a/library/src/main/cpp/user_profile.cpp b/library/src/main/cpp/user_profile.cpp index 2e3a5db..ceeaba4 100644 --- a/library/src/main/cpp/user_profile.cpp +++ b/library/src/main/cpp/user_profile.cpp @@ -184,7 +184,7 @@ extern "C" JNIEXPORT jlong JNICALL Java_network_loki_messenger_libsession_1util_UserProfile_getProFeaturesRaw(JNIEnv *env, jobject thiz) { - return static_cast(ptrToProfile(env, thiz)->get_pro_features()); + return static_cast(ptrToProfile(env, thiz)->get_profile_bitset().data); } extern "C" diff --git a/library/src/main/java/network/loki/messenger/libsession_util/Config.kt b/library/src/main/java/network/loki/messenger/libsession_util/Config.kt index 7bcedd2..8f8eef5 100644 --- a/library/src/main/java/network/loki/messenger/libsession_util/Config.kt +++ b/library/src/main/java/network/loki/messenger/libsession_util/Config.kt @@ -1,8 +1,7 @@ package network.loki.messenger.libsession_util import network.loki.messenger.libsession_util.pro.ProConfig -import network.loki.messenger.libsession_util.pro.ProProof -import network.loki.messenger.libsession_util.protocol.ProFeatures +import network.loki.messenger.libsession_util.protocol.ProProfileFeatures import network.loki.messenger.libsession_util.util.BaseCommunityInfo import network.loki.messenger.libsession_util.util.BlindedContact import network.loki.messenger.libsession_util.util.ConfigPush @@ -12,7 +11,6 @@ import network.loki.messenger.libsession_util.util.ExpiryMode import network.loki.messenger.libsession_util.util.GroupInfo import network.loki.messenger.libsession_util.util.GroupMember import network.loki.messenger.libsession_util.util.UserPic -import java.time.Instant typealias ConversationPriority = Long @@ -85,7 +83,7 @@ interface ReadableUserProfile: ReadableConfig { fun getCommunityMessageRequests(): Boolean fun isBlockCommunityMessageRequestsSet(): Boolean - fun getProFeatures(): ProFeatures + fun getProFeatures(): ProProfileFeatures fun getProConfig(): ProConfig? fun getProAccessExpiryMs(): Long? } diff --git a/library/src/main/java/network/loki/messenger/libsession_util/UserProfile.kt b/library/src/main/java/network/loki/messenger/libsession_util/UserProfile.kt index 4c313c6..7762f60 100644 --- a/library/src/main/java/network/loki/messenger/libsession_util/UserProfile.kt +++ b/library/src/main/java/network/loki/messenger/libsession_util/UserProfile.kt @@ -2,7 +2,7 @@ package network.loki.messenger.libsession_util import network.loki.messenger.libsession_util.pro.ProConfig import network.loki.messenger.libsession_util.pro.ProProof -import network.loki.messenger.libsession_util.protocol.ProFeatures +import network.loki.messenger.libsession_util.protocol.ProProfileFeatures import network.loki.messenger.libsession_util.util.ExpiryMode import network.loki.messenger.libsession_util.util.UserPic @@ -48,7 +48,7 @@ class UserProfile private constructor(pointer: Long) : ConfigBase(pointer), Muta external override fun setProAccessExpiryMs(epochMills: Long) external override fun removeProAccessExpiry() private external fun getProFeaturesRaw(): Long - override fun getProFeatures(): ProFeatures = ProFeatures(getProFeaturesRaw()) + override fun getProFeatures(): ProProfileFeatures = ProProfileFeatures(getProFeaturesRaw()) external override fun getProConfig(): ProConfig? private external fun getProAccessExpiryMsOrZero(): Long diff --git a/library/src/main/java/network/loki/messenger/libsession_util/pro/ProProof.kt b/library/src/main/java/network/loki/messenger/libsession_util/pro/ProProof.kt index e4da110..996bee0 100644 --- a/library/src/main/java/network/loki/messenger/libsession_util/pro/ProProof.kt +++ b/library/src/main/java/network/loki/messenger/libsession_util/pro/ProProof.kt @@ -5,6 +5,8 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import java.time.Instant +typealias ProProofStatus = Int + /** * Represents a proof of Pro. This class is marked as @Serializable to represent the JSON structure * received from the Pro Backend. @@ -51,24 +53,6 @@ data class ProProof( } } - enum class Status(internal val nativeValue: Int) { - InvalidProBackendSignature(1), - InvalidUserSignature(2), - Valid(3), - Expired(4), - - ; - companion object { - internal fun fromNativeValue(value: Int): Status { - return entries.first { it.nativeValue == value } - } - - internal fun fromNativeValueOrNull(value: Int): Status? { - return entries.firstOrNull { it.nativeValue == value } - } - } - } - class ProSignedMessage( val data: ByteArray, val signature: ByteArray, @@ -85,17 +69,15 @@ data class ProProof( senderED25519PubKey: ByteArray, now: Instant, signedMessage: ProSignedMessage? = null, - ): Status { + ): ProProofStatus { val signedMessageData = signedMessage?.data val signedMessageSignature = signedMessage?.signature - val statusValue = nativeStatus( + return nativeStatus( nowUnixTs = now.toEpochMilli(), verifyPubKey = senderED25519PubKey, signedMessageData = signedMessageData, signedMessageSignature = signedMessageSignature ) - - return Status.fromNativeValue(statusValue) } private external fun nativeStatus( @@ -104,4 +86,11 @@ data class ProProof( signedMessageData: ByteArray?, signedMessageSignature: ByteArray? ): Int + + companion object { + const val STATUS_INVALID_PRO_BACKEND_SIGNATURE: ProProofStatus = 1 + const val STATUS_INVALID_USER_SIGNATURE: ProProofStatus = 2 + const val STATUS_VALID: ProProofStatus = 3 + const val STATUS_EXPIRED: ProProofStatus = 4 + } } \ No newline at end of file diff --git a/library/src/main/java/network/loki/messenger/libsession_util/protocol/DecodedCommunityMessage.kt b/library/src/main/java/network/loki/messenger/libsession_util/protocol/DecodedCommunityMessage.kt index 1779c48..8fd929b 100644 --- a/library/src/main/java/network/loki/messenger/libsession_util/protocol/DecodedCommunityMessage.kt +++ b/library/src/main/java/network/loki/messenger/libsession_util/protocol/DecodedCommunityMessage.kt @@ -1,32 +1,18 @@ package network.loki.messenger.libsession_util.protocol import androidx.annotation.Keep -import network.loki.messenger.libsession_util.pro.ProProof import network.loki.messenger.libsession_util.util.Bytes -import java.util.EnumSet data class DecodedCommunityMessage( - val proStatus: ProProof.Status?, - val proProof: ProProof?, - val proFeatures: ProFeatures, + val decodedPro: DecodedPro?, val contentPlainText: Bytes, ) { @Keep constructor( - status: Int, - proProof: ProProof?, - proFeatures: Long, + decodedPro: DecodedPro?, contentPlainText: ByteArray, ): this( - proStatus = ProProof.Status.fromNativeValueOrNull(status), - proProof = proProof, - proFeatures = ProFeatures(proFeatures), + decodedPro = decodedPro, contentPlainText = Bytes(contentPlainText), ) - - init { - check(proProof == null || proStatus in EnumSet.of(ProProof.Status.Expired, ProProof.Status.Valid)) { - "proProof must be null unless proStatus is Expired or Valid" - } - } -} +} \ No newline at end of file diff --git a/library/src/main/java/network/loki/messenger/libsession_util/protocol/DecodedEnvelope.kt b/library/src/main/java/network/loki/messenger/libsession_util/protocol/DecodedEnvelope.kt index 5cce811..1a94b58 100644 --- a/library/src/main/java/network/loki/messenger/libsession_util/protocol/DecodedEnvelope.kt +++ b/library/src/main/java/network/loki/messenger/libsession_util/protocol/DecodedEnvelope.kt @@ -1,16 +1,12 @@ package network.loki.messenger.libsession_util.protocol import androidx.annotation.Keep -import network.loki.messenger.libsession_util.pro.ProProof import network.loki.messenger.libsession_util.util.Bytes import java.time.Instant -import java.util.EnumSet data class DecodedEnvelope( val envelope: Envelope, - val proStatus: ProProof.Status?, - val proProof: ProProof?, - val proFeatures: ProFeatures, + val decodedPro: DecodedPro?, val contentPlainText: Bytes, val senderEd25519PubKey: Bytes, val senderX25519PubKey: Bytes, @@ -19,27 +15,17 @@ data class DecodedEnvelope( @Keep constructor( envelope: Envelope, - proStatus: Int, - proProof: ProProof?, - proFeatures: Long, + decodedPro: DecodedPro?, contentPlainText: ByteArray, senderEd25519PubKey: ByteArray, senderX25519PubKey: ByteArray, timestampEpochMills: Long ): this( envelope = envelope, - proStatus = ProProof.Status.fromNativeValueOrNull(proStatus), - proProof = proProof, - proFeatures = ProFeatures(proFeatures), contentPlainText = Bytes(contentPlainText), senderEd25519PubKey = Bytes(senderEd25519PubKey), senderX25519PubKey = Bytes(senderX25519PubKey), - timestamp = Instant.ofEpochMilli(timestampEpochMills) + timestamp = Instant.ofEpochMilli(timestampEpochMills), + decodedPro = decodedPro ) - - init { - check(proProof == null || proStatus in EnumSet.of(ProProof.Status.Expired, ProProof.Status.Valid)) { - "proProof must be null unless proStatus is Expired or Valid" - } - } } diff --git a/library/src/main/java/network/loki/messenger/libsession_util/protocol/DecodedPro.kt b/library/src/main/java/network/loki/messenger/libsession_util/protocol/DecodedPro.kt new file mode 100644 index 0000000..bcef3e0 --- /dev/null +++ b/library/src/main/java/network/loki/messenger/libsession_util/protocol/DecodedPro.kt @@ -0,0 +1,11 @@ +package network.loki.messenger.libsession_util.protocol + +import network.loki.messenger.libsession_util.pro.ProProof +import network.loki.messenger.libsession_util.pro.ProProofStatus + +data class DecodedPro( + val status: ProProofStatus, + val proof: ProProof?, + val proMessageFeatures: ProMessageFeatures, + val proProfileFeatures: ProProfileFeatures, +) diff --git a/library/src/main/java/network/loki/messenger/libsession_util/protocol/ProFeatures.kt b/library/src/main/java/network/loki/messenger/libsession_util/protocol/ProFeatures.kt index 32ab7dc..bd96da4 100644 --- a/library/src/main/java/network/loki/messenger/libsession_util/protocol/ProFeatures.kt +++ b/library/src/main/java/network/loki/messenger/libsession_util/protocol/ProFeatures.kt @@ -1,46 +1,19 @@ package network.loki.messenger.libsession_util.protocol -import kotlinx.serialization.Serializable +import network.loki.messenger.libsession_util.util.BitSet +import network.loki.messenger.libsession_util.util.BitSetEntry +sealed interface ProFeature : BitSetEntry -enum class ProFeature(internal val bitIndex: Int) { - HIGHER_CHARACTER_LIMIT(0), - PRO_BADGE(1), - ANIMATED_AVATAR(2), +enum class ProMessageFeature(override val bitIndex: Int): ProFeature { + HIGHER_CHARACTER_LIMIT(0) } -@Serializable -@JvmInline -value class ProFeatures(val rawValue: Long) { - companion object { - val NONE = ProFeatures(0L) - - fun from(features: Collection): ProFeatures { - return ProFeatures(features.toLong()) - } - } - - fun contains(feature: ProFeature): Boolean { - return (rawValue and (1L shl feature.bitIndex)) != 0L - } - - fun toSet(): Set { - return rawValue.toFeatures() - } +enum class ProProfileFeature(override val bitIndex: Int): ProFeature { + PRO_BADGE(0), + ANIMATED_AVATAR(1), } -internal fun Long.toFeatures(): Set { - return buildSet(ProFeature.entries.size) { - for (entry in ProFeature.entries) { - if (this@toFeatures and (1L shl entry.bitIndex) != 0L) { - add(entry) - } - } - } -} +typealias ProMessageFeatures = BitSet +typealias ProProfileFeatures = BitSet -internal fun Collection.toLong(): Long { - return fold(0L) { acc, entry -> - acc or (1L shl entry.bitIndex) - } -} \ No newline at end of file diff --git a/library/src/main/java/network/loki/messenger/libsession_util/protocol/ProFeaturesForMsg.kt b/library/src/main/java/network/loki/messenger/libsession_util/protocol/ProFeaturesForMsg.kt index 8a6dfce..f73488e 100644 --- a/library/src/main/java/network/loki/messenger/libsession_util/protocol/ProFeaturesForMsg.kt +++ b/library/src/main/java/network/loki/messenger/libsession_util/protocol/ProFeaturesForMsg.kt @@ -1,6 +1,6 @@ package network.loki.messenger.libsession_util.protocol -import androidx.annotation.Keep +typealias ProFeaturesForMsgStatus = Int /** * Represents the result of trying to augment a message with Pro features. @@ -11,27 +11,14 @@ import androidx.annotation.Keep * @param codepointCount The number of codepoints in the message */ data class ProFeaturesForMsg( - val status: Status, + val status: ProFeaturesForMsgStatus, val error: String?, - val features: ProFeatures, + val features: ProMessageFeatures, val codepointCount: Int, ) { - @Keep - constructor( - statusNativeValue: Int, - error: String?, - featuresNativeValue: Long, - codepointCount: Int, - ) : this( - status = Status.entries.first { it.nativeValue == statusNativeValue }, - error = error, - features = ProFeatures(featuresNativeValue), - codepointCount = codepointCount, - ) - - enum class Status(internal val nativeValue: Int) { - Success(0), - UTFDecodingError(1), - ExceedsCharacterLimit(2), + companion object { + const val SUCCESS: ProFeaturesForMsgStatus = 0 + const val UTF_DECODING_ERROR: ProFeaturesForMsgStatus = 1 + const val EXCEEDS_CHARACTER_LIMIT: ProFeaturesForMsgStatus = 2 } } diff --git a/library/src/main/java/network/loki/messenger/libsession_util/protocol/SessionProtocol.kt b/library/src/main/java/network/loki/messenger/libsession_util/protocol/SessionProtocol.kt index 5566420..667b459 100644 --- a/library/src/main/java/network/loki/messenger/libsession_util/protocol/SessionProtocol.kt +++ b/library/src/main/java/network/loki/messenger/libsession_util/protocol/SessionProtocol.kt @@ -1,7 +1,6 @@ package network.loki.messenger.libsession_util.protocol import network.loki.messenger.libsession_util.LibSessionUtilCApi -import network.loki.messenger.libsession_util.pro.PaymentProvider object SessionProtocol : LibSessionUtilCApi() { external fun encodeFor1o1( @@ -67,6 +66,5 @@ object SessionProtocol : LibSessionUtilCApi() { */ fun proFeaturesForMessage( messageBody: String, - proposedFeatures: ProFeatures - ): ProFeaturesForMsg = proFeaturesForMessage(messageBody, proposedFeatures.rawValue) + ): ProFeaturesForMsg = proFeaturesForMessage(messageBody) } \ No newline at end of file diff --git a/library/src/main/java/network/loki/messenger/libsession_util/util/BitSet.kt b/library/src/main/java/network/loki/messenger/libsession_util/util/BitSet.kt new file mode 100644 index 0000000..79d1626 --- /dev/null +++ b/library/src/main/java/network/loki/messenger/libsession_util/util/BitSet.kt @@ -0,0 +1,32 @@ +package network.loki.messenger.libsession_util.util + +import kotlinx.serialization.Serializable + +interface BitSetEntry { + val bitIndex: Int +} + + +@Serializable +@JvmInline +value class BitSet(val rawValue: Long = 0L) where T: BitSetEntry { + val isEmpty: Boolean + get() = rawValue == 0L + + fun contains(feature: T): Boolean { + return (rawValue and (1L shl feature.bitIndex)) != 0L + } +} + +fun Iterable.toBitSet(): BitSet where T: BitSetEntry { + return BitSet(this.fold(0L) { acc, entry -> + acc or (1L shl entry.bitIndex) + }) +} + +inline fun BitSet.asSequence(): Sequence where T: BitSetEntry, T: Enum { + return enumValues() + .asSequence() + .filter { contains(it) } +} + diff --git a/library/src/main/java/network/loki/messenger/libsession_util/util/BlindedContact.kt b/library/src/main/java/network/loki/messenger/libsession_util/util/BlindedContact.kt index ff9463c..3231c08 100644 --- a/library/src/main/java/network/loki/messenger/libsession_util/util/BlindedContact.kt +++ b/library/src/main/java/network/loki/messenger/libsession_util/util/BlindedContact.kt @@ -2,7 +2,7 @@ package network.loki.messenger.libsession_util.util import androidx.annotation.Keep import network.loki.messenger.libsession_util.ConversationPriority -import network.loki.messenger.libsession_util.protocol.ProFeatures +import network.loki.messenger.libsession_util.protocol.ProProfileFeatures data class BlindedContact( val id: String, @@ -13,7 +13,7 @@ data class BlindedContact( var profileUpdatedEpochSeconds: Long, var profilePic: UserPic, var priority: ConversationPriority, - val proFeatures: ProFeatures, + var proFeatures: ProProfileFeatures, ) { @OptIn(ExperimentalStdlibApi::class) val communityServerPubKey: ByteArray diff --git a/library/src/main/java/network/loki/messenger/libsession_util/util/Contact.kt b/library/src/main/java/network/loki/messenger/libsession_util/util/Contact.kt index 79c5602..7a90567 100644 --- a/library/src/main/java/network/loki/messenger/libsession_util/util/Contact.kt +++ b/library/src/main/java/network/loki/messenger/libsession_util/util/Contact.kt @@ -3,7 +3,7 @@ package network.loki.messenger.libsession_util.util import androidx.annotation.Keep import network.loki.messenger.libsession_util.ConversationPriority import network.loki.messenger.libsession_util.PRIORITY_VISIBLE -import network.loki.messenger.libsession_util.protocol.ProFeatures +import network.loki.messenger.libsession_util.protocol.ProProfileFeatures data class Contact( val id: String, @@ -17,7 +17,7 @@ data class Contact( var profileUpdatedEpochSeconds: Long = 0, var priority: ConversationPriority = PRIORITY_VISIBLE, var expiryMode: ExpiryMode = ExpiryMode.NONE, - var proFeatures: ProFeatures = ProFeatures.NONE, + var proFeatures: ProProfileFeatures = ProProfileFeatures(), ) { val displayName: String diff --git a/libsession-util b/libsession-util index 41cfac4..3d79bb2 160000 --- a/libsession-util +++ b/libsession-util @@ -1 +1 @@ -Subproject commit 41cfac4aabb77fc2165016cb06eb514e9fafe158 +Subproject commit 3d79bb2d2b5b62d5240fa3307e0901a2e217192a