mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-16 10:31:28 +00:00
Coerce disappear type to DaR for Calls and DataExtraction
This commit is contained in:
parent
7b26de5bd6
commit
12edb9dff9
@ -56,7 +56,10 @@ abstract class Message {
|
|||||||
dataMessage.group = groupProto.build()
|
dataMessage.group = groupProto.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun SignalServiceProtos.Content.Builder.setExpirationConfigurationIfNeeded(threadId: Long?): SignalServiceProtos.Content.Builder {
|
fun SignalServiceProtos.Content.Builder.setExpirationConfigurationIfNeeded(
|
||||||
|
threadId: Long?,
|
||||||
|
coerceDisappearAfterSendToRead: Boolean = false
|
||||||
|
): SignalServiceProtos.Content.Builder {
|
||||||
val config = threadId?.let(MessagingModuleConfiguration.shared.storage::getExpirationConfiguration)
|
val config = threadId?.let(MessagingModuleConfiguration.shared.storage::getExpirationConfiguration)
|
||||||
?: run {
|
?: run {
|
||||||
expirationTimer = 0
|
expirationTimer = 0
|
||||||
@ -64,12 +67,10 @@ abstract class Message {
|
|||||||
}
|
}
|
||||||
expirationTimer = config.expiryMode.expirySeconds.toInt()
|
expirationTimer = config.expiryMode.expirySeconds.toInt()
|
||||||
lastDisappearingMessageChangeTimestamp = config.updatedTimestampMs
|
lastDisappearingMessageChangeTimestamp = config.updatedTimestampMs
|
||||||
config.expiryMode.let { expiryMode ->
|
expirationType = when (config.expiryMode) {
|
||||||
expirationType = when (expiryMode) {
|
is ExpiryMode.AfterSend -> if (coerceDisappearAfterSendToRead) ExpirationType.DELETE_AFTER_READ else ExpirationType.DELETE_AFTER_SEND
|
||||||
is ExpiryMode.AfterSend -> ExpirationType.DELETE_AFTER_SEND
|
is ExpiryMode.AfterRead -> ExpirationType.DELETE_AFTER_READ
|
||||||
is ExpiryMode.AfterRead -> ExpirationType.DELETE_AFTER_READ
|
else -> ExpirationType.UNKNOWN
|
||||||
else -> ExpirationType.UNKNOWN
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,7 @@ class CallMessage(): ControlMessage() {
|
|||||||
.setUuid(callId!!.toString())
|
.setUuid(callId!!.toString())
|
||||||
|
|
||||||
val content = SignalServiceProtos.Content.newBuilder()
|
val content = SignalServiceProtos.Content.newBuilder()
|
||||||
content.setExpirationConfigurationIfNeeded(threadID)
|
content.setExpirationConfigurationIfNeeded(threadID, true)
|
||||||
|
|
||||||
return content
|
return content
|
||||||
.setCallMessage(callMessage)
|
.setCallMessage(callMessage)
|
||||||
.build()
|
.build()
|
||||||
|
@ -64,7 +64,7 @@ class DataExtractionNotification() : ControlMessage() {
|
|||||||
}
|
}
|
||||||
val contentProto = SignalServiceProtos.Content.newBuilder()
|
val contentProto = SignalServiceProtos.Content.newBuilder()
|
||||||
contentProto.dataExtractionNotification = dataExtractionNotification.build()
|
contentProto.dataExtractionNotification = dataExtractionNotification.build()
|
||||||
contentProto.setExpirationConfigurationIfNeeded(threadID)
|
contentProto.setExpirationConfigurationIfNeeded(threadID, true)
|
||||||
return contentProto.build()
|
return contentProto.build()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.w(TAG, "Couldn't construct data extraction notification proto from: $this")
|
Log.w(TAG, "Couldn't construct data extraction notification proto from: $this")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user