mirror of
https://github.com/oxen-io/session-android.git
synced 2025-03-13 21:30:56 +00:00
Expiration timer update ui message tweaks
This commit is contained in:
parent
a4e64187f1
commit
1ad10a4ac7
@ -5,8 +5,11 @@ import org.session.libsession.R
|
||||
import org.session.libsession.messaging.MessagingModuleConfiguration
|
||||
import org.session.libsession.messaging.calls.CallMessageType
|
||||
import org.session.libsession.messaging.contacts.Contact
|
||||
import org.session.libsession.messaging.messages.ExpirationConfiguration
|
||||
import org.session.libsession.messaging.sending_receiving.data_extraction.DataExtractionNotificationInfoMessage
|
||||
import org.session.libsession.utilities.Address
|
||||
import org.session.libsession.utilities.ExpirationUtil
|
||||
import org.session.libsignal.protos.SignalServiceProtos.Content.ExpirationType
|
||||
|
||||
object UpdateMessageBuilder {
|
||||
|
||||
@ -84,12 +87,40 @@ object UpdateMessageBuilder {
|
||||
storage.getContactWithSessionID(sender!!)?.displayName(Contact.ContactContext.REGULAR) ?: sender
|
||||
} else { context.getString(R.string.MessageRecord_you) }
|
||||
return if (duration <= 0) {
|
||||
if (isOutgoing) context.getString(R.string.MessageRecord_you_disabled_disappearing_messages)
|
||||
else context.getString(R.string.MessageRecord_s_disabled_disappearing_messages, senderName)
|
||||
if (isOutgoing) {
|
||||
if (ExpirationConfiguration.isNewConfigEnabled) {
|
||||
context.getString(R.string.MessageRecord_you_turned_off_disappearing_messages)
|
||||
} else {
|
||||
context.getString(R.string.MessageRecord_you_disabled_disappearing_messages)
|
||||
}
|
||||
} else {
|
||||
if (ExpirationConfiguration.isNewConfigEnabled) {
|
||||
context.getString(R.string.MessageRecord_s_turned_off_disappearing_messages)
|
||||
} else {
|
||||
context.getString(R.string.MessageRecord_s_disabled_disappearing_messages, senderName)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val time = ExpirationUtil.getExpirationDisplayValue(context, duration.toInt())
|
||||
if (isOutgoing)context.getString(R.string.MessageRecord_you_set_disappearing_message_time_to_s, time)
|
||||
else context.getString(R.string.MessageRecord_s_set_disappearing_message_time_to_s, senderName, time)
|
||||
val config = storage.getExpirationConfiguration(storage.getOrCreateThreadIdFor(Address.fromSerialized(sender!!)))
|
||||
val state = when (config?.expirationType) {
|
||||
ExpirationType.DELETE_AFTER_SEND -> context.getString(R.string.MessageRecord_state_sent)
|
||||
ExpirationType.DELETE_AFTER_READ -> context.getString(R.string.MessageRecord_state_read)
|
||||
else -> ""
|
||||
}
|
||||
if (isOutgoing) {
|
||||
if (ExpirationConfiguration.isNewConfigEnabled) {
|
||||
context.getString(R.string.MessageRecord_you_set_messages_to_disappear_s_after_s, time, state)
|
||||
} else {
|
||||
context.getString(R.string.MessageRecord_you_set_disappearing_message_time_to_s, time)
|
||||
}
|
||||
} else {
|
||||
if (ExpirationConfiguration.isNewConfigEnabled) {
|
||||
context.getString(R.string.MessageRecord_s_set_messages_to_disappear_s_after_s, senderName, time, state)
|
||||
} else {
|
||||
context.getString(R.string.MessageRecord_s_set_disappearing_message_time_to_s, senderName, time)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,11 +16,19 @@
|
||||
<string name="MessageRecord_called_s">Called %s</string>
|
||||
<string name="MessageRecord_missed_call_from">Missed call from %s</string>
|
||||
<string name="MessageRecord_you_disabled_disappearing_messages">You disabled disappearing messages.</string>
|
||||
<string name="MessageRecord_you_turned_off_disappearing_messages">You have turned off disappearing messages</string>
|
||||
<string name="MessageRecord_s_disabled_disappearing_messages">%1$s disabled disappearing messages.</string>
|
||||
<string name="MessageRecord_s_turned_off_disappearing_messages">%1$s turned off disappearing messages</string>
|
||||
<string name="MessageRecord_you_set_disappearing_message_time_to_s">You set the disappearing message timer to %1$s</string>
|
||||
<string name="MessageRecord_you_set_messages_to_disappear_s_after_s">You have set messages to disappear %1$s after they have been %2$s</string>
|
||||
<string name="MessageRecord_you_changed_messages_to_disappear_s_after_s">You have changed messages to disappear %1$s after they have been %2$s</string>
|
||||
<string name="MessageRecord_s_set_disappearing_message_time_to_s">%1$s set the disappearing message timer to %2$s</string>
|
||||
<string name="MessageRecord_s_set_messages_to_disappear_s_after_s">%1$s has set messages to disappear %2$s after they have been %3$s</string>
|
||||
<string name="MessageRecord_s_changed_messages_to_disappear_s_after_s">%1$s has changed messages to disappear %2$s after they have been %3$s</string>
|
||||
<string name="MessageRecord_s_took_a_screenshot">%1$s took a screenshot.</string>
|
||||
<string name="MessageRecord_media_saved_by_s">Media saved by %1$s.</string>
|
||||
<string name="MessageRecord_state_read">read</string>
|
||||
<string name="MessageRecord_state_sent">sent</string>
|
||||
|
||||
<!-- expiration -->
|
||||
<string name="expiration_off">Off</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user