From f5121770ec68bc44b282d6846b1eaa34a094df9b Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 20 Feb 2024 16:45:23 +1030 Subject: [PATCH] Remove erroneous expiration on SharedConfigurationMessage --- .../messages/control/SharedConfigurationMessage.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/SharedConfigurationMessage.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/SharedConfigurationMessage.kt index f904c7f07c..7ec4eaa6f0 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/SharedConfigurationMessage.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/SharedConfigurationMessage.kt @@ -1,7 +1,6 @@ package org.session.libsession.messaging.messages.control import com.google.protobuf.ByteString -import org.session.libsession.messaging.messages.copyExpiration import org.session.libsignal.protos.SignalServiceProtos import org.session.libsignal.protos.SignalServiceProtos.SharedConfigMessage @@ -11,13 +10,10 @@ class SharedConfigurationMessage(val kind: SharedConfigMessage.Kind, val data: B override val isSelfSendValid: Boolean = true companion object { - fun fromProto(proto: SignalServiceProtos.Content): SharedConfigurationMessage? { - if (!proto.hasSharedConfigMessage()) return null - val sharedConfig = proto.sharedConfigMessage - if (!sharedConfig.hasKind() || !sharedConfig.hasData()) return null - return SharedConfigurationMessage(sharedConfig.kind, sharedConfig.data.toByteArray(), sharedConfig.seqno) - .copyExpiration(proto) - } + fun fromProto(proto: SignalServiceProtos.Content): SharedConfigurationMessage? = + proto.takeIf { it.hasSharedConfigMessage() }?.sharedConfigMessage + ?.takeIf { it.hasKind() && it.hasData() } + ?.run { SharedConfigurationMessage(kind, data.toByteArray(), seqno) } } override fun isValid(): Boolean {