mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 17:48:23 +00:00
Fix control message text
This commit is contained in:
@@ -47,7 +47,6 @@ import org.session.libsignal.crypto.ecc.DjbECPublicKey
|
||||
import org.session.libsignal.crypto.ecc.ECKeyPair
|
||||
import org.session.libsignal.messages.SignalServiceGroup
|
||||
import org.session.libsignal.protos.SignalServiceProtos
|
||||
import org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType
|
||||
import org.session.libsignal.protos.SignalServiceProtos.SharedConfigMessage
|
||||
import org.session.libsignal.utilities.Base64
|
||||
import org.session.libsignal.utilities.IdPrefix
|
||||
@@ -303,9 +302,6 @@ fun MessageReceiver.updateExpiryIfNeeded(
|
||||
proto.lastDisappearingMessageChangeTimestamp
|
||||
)
|
||||
|
||||
val configToUse = localConfig?.takeIf { it.updatedTimestampMs > proto.lastDisappearingMessageChangeTimestamp } ?: remoteConfig
|
||||
val shouldUpdateConfig = configToUse == remoteConfig
|
||||
|
||||
// don't update any values for open groups
|
||||
if (recipient.isOpenGroupRecipient && type != null) throw MessageReceiver.Error.InvalidMessage
|
||||
|
||||
@@ -314,8 +310,8 @@ fun MessageReceiver.updateExpiryIfNeeded(
|
||||
storage.updateDisappearingState(threadID, disappearingState)
|
||||
}
|
||||
|
||||
if (shouldUpdateConfig) {
|
||||
storage.setExpirationConfiguration(configToUse)
|
||||
if (localConfig != null || localConfig!!) {
|
||||
storage.setExpirationConfiguration(remoteConfig)
|
||||
}
|
||||
|
||||
if (message is ExpirationTimerUpdate) {
|
||||
|
@@ -76,7 +76,7 @@ object UpdateMessageBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
fun buildExpirationTimerMessage(context: Context, duration: Long, senderId: String? = null, isOutgoing: Boolean = false): String {
|
||||
fun buildExpirationTimerMessage(context: Context, duration: Long, senderId: String? = null, threadId: Long, isOutgoing: Boolean = false): String {
|
||||
if (!isOutgoing && senderId == null) return ""
|
||||
val senderName: String = if (!isOutgoing) {
|
||||
getSenderName(senderId!!)
|
||||
@@ -97,8 +97,7 @@ object UpdateMessageBuilder {
|
||||
}
|
||||
} else {
|
||||
val time = ExpirationUtil.getExpirationDisplayValue(context, duration.toInt())
|
||||
val threadId = storage.getThreadId(Address.fromSerialized(senderId!!))
|
||||
val config = threadId?.let { storage.getExpirationConfiguration(it) }
|
||||
val config = threadId.let { storage.getExpirationConfiguration(it) }
|
||||
val state = when (config?.expiryMode) {
|
||||
is ExpiryMode.AfterSend -> context.getString(R.string.MessageRecord_state_sent)
|
||||
is ExpiryMode.AfterRead -> context.getString(R.string.MessageRecord_state_read)
|
||||
|
Reference in New Issue
Block a user