diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/Message.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/Message.kt index 30ce3a1ba5..d290e9e09b 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/Message.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/Message.kt @@ -39,7 +39,7 @@ abstract class Message { dataMessage.group = groupProto.build() } - fun setExpirationSettingsConfigIfNeeded(builder: SignalServiceProtos.Content.Builder) { + fun setExpirationConfigurationIfNeeded(builder: SignalServiceProtos.Content.Builder) { val threadId = threadID ?: return val config = MessagingModuleConfiguration.shared.storage.getExpirationConfiguration(threadId) ?: return builder.expirationTimer = config.durationSeconds diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/CallMessage.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/CallMessage.kt index d7bc29e6ae..37b9bb6a3e 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/CallMessage.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/CallMessage.kt @@ -82,7 +82,7 @@ class CallMessage(): ControlMessage() { .setUuid(callId!!.toString()) val content = SignalServiceProtos.Content.newBuilder() - setExpirationSettingsConfigIfNeeded(content) + setExpirationConfigurationIfNeeded(content) return content .setCallMessage(callMessage) diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/ClosedGroupControlMessage.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/ClosedGroupControlMessage.kt index 433d192dbf..510514c827 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/ClosedGroupControlMessage.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/ClosedGroupControlMessage.kt @@ -168,7 +168,7 @@ class ClosedGroupControlMessage() : ControlMessage() { val dataMessageProto = DataMessage.newBuilder() dataMessageProto.closedGroupControlMessage = closedGroupControlMessage.build() // Expiration timer - setExpirationSettingsConfigIfNeeded(contentProto) + setExpirationConfigurationIfNeeded(contentProto) // Group context setGroupContext(dataMessageProto) contentProto.dataMessage = dataMessageProto.build() diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/DataExtractionNotification.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/DataExtractionNotification.kt index b1f6cb6bad..a8730f0a50 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/DataExtractionNotification.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/DataExtractionNotification.kt @@ -64,7 +64,7 @@ class DataExtractionNotification() : ControlMessage() { } val contentProto = SignalServiceProtos.Content.newBuilder() contentProto.dataExtractionNotification = dataExtractionNotification.build() - setExpirationSettingsConfigIfNeeded(contentProto) + setExpirationConfigurationIfNeeded(contentProto) return contentProto.build() } catch (e: Exception) { Log.w(TAG, "Couldn't construct data extraction notification proto from: $this") diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/ExpirationTimerUpdate.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/ExpirationTimerUpdate.kt index e03a92e134..ea2da00e60 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/ExpirationTimerUpdate.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/ExpirationTimerUpdate.kt @@ -66,12 +66,13 @@ class ExpirationTimerUpdate() : ControlMessage() { } } val contentProto = SignalServiceProtos.Content.newBuilder() - try { + return try { contentProto.dataMessage = dataMessageProto.build() - return contentProto.build() + setExpirationConfigurationIfNeeded(contentProto) + contentProto.build() } catch (e: Exception) { Log.w(TAG, "Couldn't construct expiration timer update proto from: $this") - return null + null } } } \ No newline at end of file diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/MessageRequestResponse.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/MessageRequestResponse.kt index d5b8ebd279..d9b1de78f8 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/MessageRequestResponse.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/MessageRequestResponse.kt @@ -13,7 +13,7 @@ class MessageRequestResponse(val isApproved: Boolean) : ControlMessage() { val contentProto = SignalServiceProtos.Content.newBuilder() return try { contentProto.messageRequestResponse = messageRequestResponseProto.build() - setExpirationSettingsConfigIfNeeded(contentProto) + setExpirationConfigurationIfNeeded(contentProto) contentProto.build() } catch (e: Exception) { Log.w(TAG, "Couldn't construct message request response proto from: $this") diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/ReadReceipt.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/ReadReceipt.kt index 7159306c68..f27e6cf4cb 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/ReadReceipt.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/ReadReceipt.kt @@ -41,7 +41,7 @@ class ReadReceipt() : ControlMessage() { val contentProto = SignalServiceProtos.Content.newBuilder() return try { contentProto.receiptMessage = receiptProto.build() - setExpirationSettingsConfigIfNeeded(contentProto) + setExpirationConfigurationIfNeeded(contentProto) contentProto.build() } catch (e: Exception) { Log.w(TAG, "Couldn't construct read receipt proto from: $this") diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/SyncedExpiriesMessage.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/SyncedExpiriesMessage.kt index b1b1befc0a..ad59e150c4 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/SyncedExpiriesMessage.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/SyncedExpiriesMessage.kt @@ -50,7 +50,7 @@ class SyncedExpiriesMessage(): ControlMessage() { val contentProto = SignalServiceProtos.Content.newBuilder() return try { contentProto.syncedExpiries = syncedExpiriesProto.build() - setExpirationSettingsConfigIfNeeded(contentProto) + setExpirationConfigurationIfNeeded(contentProto) contentProto.build() } catch (e: Exception) { Log.w(TAG, "Couldn't construct synced expiries proto from: $this") diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/TypingIndicator.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/TypingIndicator.kt index 083405af9b..f51298336d 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/TypingIndicator.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/TypingIndicator.kt @@ -60,7 +60,7 @@ class TypingIndicator() : ControlMessage() { val contentProto = SignalServiceProtos.Content.newBuilder() return try { contentProto.typingMessage = typingIndicatorProto.build() - setExpirationSettingsConfigIfNeeded(contentProto) + setExpirationConfigurationIfNeeded(contentProto) contentProto.build() } catch (e: Exception) { Log.w(TAG, "Couldn't construct typing indicator proto from: $this") diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/control/UnsendRequest.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/control/UnsendRequest.kt index 04952f0524..c9391c2072 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/control/UnsendRequest.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/control/UnsendRequest.kt @@ -45,7 +45,7 @@ class UnsendRequest(): ControlMessage() { val contentProto = SignalServiceProtos.Content.newBuilder() return try { contentProto.unsendRequest = unsendRequestProto.build() - setExpirationSettingsConfigIfNeeded(contentProto) + setExpirationConfigurationIfNeeded(contentProto) contentProto.build() } catch (e: Exception) { Log.w(TAG, "Couldn't construct unsend request proto from: $this") diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/visible/VisibleMessage.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/visible/VisibleMessage.kt index bc7683299a..6bc8d9b460 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/visible/VisibleMessage.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/visible/VisibleMessage.kt @@ -116,7 +116,7 @@ class VisibleMessage : Message() { dataMessage.addAllAttachments(pointers) // TODO: Contact // Expiration timer - setExpirationSettingsConfigIfNeeded(proto) + setExpirationConfigurationIfNeeded(proto) // Group context val storage = MessagingModuleConfiguration.shared.storage if (storage.isClosedGroup(recipient!!)) {