mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-19 21:58:25 +00:00
Fix control message text
This commit is contained in:
parent
a9467c7b96
commit
2228a05b2e
@ -116,7 +116,7 @@ public abstract class MessageRecord extends DisplayRecord {
|
||||
return new SpannableString(UpdateMessageBuilder.INSTANCE.buildGroupUpdateMessage(context, updateMessageData, getIndividualRecipient().getAddress().serialize(), isOutgoing()));
|
||||
} else if (isExpirationTimerUpdate()) {
|
||||
int seconds = (int) (getExpiresIn() / 1000);
|
||||
return new SpannableString(UpdateMessageBuilder.INSTANCE.buildExpirationTimerMessage(context, seconds, getIndividualRecipient().getAddress().serialize(), isOutgoing()));
|
||||
return new SpannableString(UpdateMessageBuilder.INSTANCE.buildExpirationTimerMessage(context, seconds, getIndividualRecipient().getAddress().serialize(), getThreadId(), isOutgoing()));
|
||||
} else if (isDataExtractionNotification()) {
|
||||
if (isScreenshotNotification()) return new SpannableString((UpdateMessageBuilder.INSTANCE.buildDataExtractionMessage(context, DataExtractionNotificationInfoMessage.Kind.SCREENSHOT, getIndividualRecipient().getAddress().serialize())));
|
||||
else if (isMediaSavedNotification()) return new SpannableString((UpdateMessageBuilder.INSTANCE.buildDataExtractionMessage(context, DataExtractionNotificationInfoMessage.Kind.MEDIA_SAVED, getIndividualRecipient().getAddress().serialize())));
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user