mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-12 10:37:44 +00:00
Fix expiry mode application to Message
This commit is contained in:
@@ -94,12 +94,6 @@ fun SignalServiceProtos.Content.expiryMode(): ExpiryMode =
|
||||
/**
|
||||
* Apply ExpiryMode from the current setting.
|
||||
*/
|
||||
inline fun <reified M: Message> M.applyExpiryMode(): M {
|
||||
val address = Address.fromSerialized(sender ?: return this)
|
||||
MessagingModuleConfiguration.shared.storage.getThreadId(address)?.let(::applyExpiryMode)
|
||||
return this
|
||||
}
|
||||
|
||||
inline fun <reified M: Message> M.applyExpiryMode(thread: Long): M {
|
||||
val storage = MessagingModuleConfiguration.shared.storage
|
||||
expiryMode = storage.getExpirationConfiguration(thread)?.expiryMode?.coerceSendToRead(coerceDisappearAfterSendToRead) ?: ExpiryMode.NONE
|
||||
|
@@ -42,21 +42,21 @@ class CallMessage(): ControlMessage() {
|
||||
listOf(),
|
||||
listOf(),
|
||||
callId
|
||||
).applyExpiryMode()
|
||||
)
|
||||
|
||||
fun preOffer(callId: UUID) = CallMessage(PRE_OFFER,
|
||||
listOf(),
|
||||
listOf(),
|
||||
listOf(),
|
||||
callId
|
||||
).applyExpiryMode()
|
||||
)
|
||||
|
||||
fun offer(sdp: String, callId: UUID) = CallMessage(OFFER,
|
||||
listOf(sdp),
|
||||
listOf(),
|
||||
listOf(),
|
||||
callId
|
||||
).applyExpiryMode()
|
||||
)
|
||||
|
||||
fun endCall(callId: UUID) = CallMessage(END_CALL, emptyList(), emptyList(), emptyList(), callId)
|
||||
|
||||
|
@@ -471,8 +471,8 @@ object MessageSender {
|
||||
|
||||
@JvmStatic
|
||||
fun send(message: Message, address: Address) {
|
||||
message.applyExpiryMode()
|
||||
val threadID = MessagingModuleConfiguration.shared.storage.getThreadId(address)
|
||||
threadID?.let(message::applyExpiryMode)
|
||||
message.threadID = threadID
|
||||
val destination = Destination.from(address)
|
||||
val job = MessageSendJob(message, destination)
|
||||
|
Reference in New Issue
Block a user