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