mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05:19 +00:00
Reverted changes on DMs
This commit is contained in:
parent
3db8b46be1
commit
7f8e9fd582
@ -18,7 +18,7 @@ data class State(
|
||||
val isSelfAdmin: Boolean = true,
|
||||
val address: Address? = null,
|
||||
val isNoteToSelf: Boolean = false,
|
||||
val expiryMode: ExpiryMode = ExpiryMode.NONE,
|
||||
val expiryMode: ExpiryMode? = null,
|
||||
val isNewConfigEnabled: Boolean = true,
|
||||
val persistedMode: ExpiryMode? = null,
|
||||
val showDebugOptions: Boolean = false
|
||||
@ -30,8 +30,13 @@ data class State(
|
||||
|
||||
val typeOptionsHidden get() = isNoteToSelf || (isGroup && isNewConfigEnabled)
|
||||
|
||||
val duration get() = expiryMode.duration
|
||||
val expiryType get() = expiryMode.type
|
||||
val nextType get() = when {
|
||||
expiryType == ExpiryType.AFTER_READ -> ExpiryType.AFTER_READ
|
||||
else -> ExpiryType.AFTER_SEND
|
||||
}
|
||||
|
||||
val duration get() = expiryMode?.duration
|
||||
val expiryType get() = expiryMode?.type
|
||||
|
||||
val isTimeOptionsEnabled = isNoteToSelf || isSelfAdmin && isNewConfigEnabled
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ private fun State.timeOptions(): List<ExpiryRadioOption>? {
|
||||
// Don't show times card if we have a types card, and type is off.
|
||||
if (!typeOptionsHidden && expiryType == ExpiryType.NONE) return null
|
||||
|
||||
return expiryType.let { type ->
|
||||
return nextType.let { type ->
|
||||
when (type) {
|
||||
ExpiryType.AFTER_READ -> afterReadTimes
|
||||
else -> afterSendTimes
|
||||
@ -69,7 +69,7 @@ private fun debugModes(isDebug: Boolean, type: ExpiryType) =
|
||||
debugTimes(isDebug).map { type.mode(it.inWholeSeconds) }
|
||||
|
||||
private fun State.debugOptions(): List<ExpiryRadioOption> =
|
||||
debugModes(showDebugOptions, expiryType).map { timeOption(it, subtitle = GetString("for testing purposes")) }
|
||||
debugModes(showDebugOptions, nextType).map { timeOption(it, subtitle = GetString("for testing purposes")) }
|
||||
|
||||
// Standard list of available disappearing message times
|
||||
private val afterSendTimes = listOf(12.hours, 1.days, 7.days, 14.days)
|
||||
@ -94,6 +94,6 @@ private fun State.timeOption(
|
||||
title = title,
|
||||
subtitle = subtitle,
|
||||
contentDescription = title,
|
||||
selected = mode.duration == expiryMode.duration,
|
||||
selected = mode.duration == expiryMode?.duration,
|
||||
enabled = isTimeOptionsEnabled
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user