Skip to content

Commit d49511b

Browse files
Use data object for non-expiry mode (#12)
1 parent a909332 commit d49511b

File tree

1 file changed

+2
-2
lines changed
  • library/src/main/java/network/loki/messenger/libsession_util/util

1 file changed

+2
-2
lines changed

library/src/main/java/network/loki/messenger/libsession_util/util/ExpiryMode.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package network.loki.messenger.libsession_util.util
33
import kotlin.time.Duration.Companion.seconds
44

55
sealed class ExpiryMode(val expirySeconds: Long) {
6-
object NONE: ExpiryMode(0)
6+
data object NONE: ExpiryMode(0)
77
data class AfterSend(private val seconds: Long = 0L): ExpiryMode(seconds)
88
data class AfterRead(private val seconds: Long = 0L): ExpiryMode(seconds)
99

@@ -14,4 +14,4 @@ sealed class ExpiryMode(val expirySeconds: Long) {
1414
fun coerceSendToRead(coerce: Boolean = true) = if (coerce && this is AfterSend) AfterRead(expirySeconds) else this
1515
}
1616

17-
fun afterSend(seconds: Long) = seconds.takeIf { it > 0 }?.let(ExpiryMode::AfterSend) ?: ExpiryMode.NONE
17+
fun afterSend(seconds: Long) = seconds.takeIf { it > 0 }?.let(ExpiryMode::AfterSend) ?: ExpiryMode.NONE

0 commit comments

Comments
 (0)