Skip to content

Commit cae23a2

Browse files
authored
fix: make SelfDeletionTimer serializable [WPB-18248] (#3522)
* fix: make SelfDeletionTimer serializable [WPB-18248] * detekt
1 parent ee97622 commit cae23a2

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

data/src/commonMain/kotlin/com/wire/kalium/logic/data/message/SelfDeletionTimer.kt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,38 @@ package com.wire.kalium.logic.data.message
1919

2020
import com.wire.kalium.logic.data.id.ConversationId
2121
import com.wire.kalium.util.serialization.toJsonElement
22+
import kotlinx.serialization.Serializable
2223
import kotlin.time.Duration
2324
import kotlin.time.Duration.Companion.ZERO
2425

26+
@Serializable
2527
sealed interface SelfDeletionTimer {
2628
val duration: Duration?
2729

2830
/**
2931
* Represents a self deletion timer that is currently disabled
3032
*/
33+
@Serializable
3134
data object Disabled : SelfDeletionTimer {
3235
override val duration: Duration? = null
3336
}
3437

3538
/**
3639
* Represents a self deletion timer that is enabled and can be changed/updated by the user
3740
*/
41+
@Serializable
3842
data class Enabled(override val duration: Duration?) : SelfDeletionTimer
3943

4044
/**
4145
* Represents a self deletion timer that is imposed by the team or conversation settings that can't be changed by the user
42-
* @param enforcedDuration the team or conversation imposed timer
4346
*/
47+
@Serializable
4448
sealed interface Enforced : SelfDeletionTimer {
49+
50+
@Serializable
4551
data class ByTeam(override val duration: Duration) : Enforced
52+
53+
@Serializable
4654
data class ByGroup(override val duration: Duration) : Enforced
4755
}
4856

@@ -78,11 +86,15 @@ sealed interface SelfDeletionTimer {
7886
}
7987
}
8088

89+
@Suppress("EnforceSerializableFields")
90+
@Serializable
8191
data class ConversationSelfDeletionStatus(
8292
val conversationId: ConversationId,
8393
val selfDeletionTimer: SelfDeletionTimer
8494
)
8595

96+
@Suppress("EnforceSerializableFields")
97+
@Serializable
8698
data class TeamSettingsSelfDeletionStatus(
8799
/**
88100
* This value is used to inform the user that the team settings were changed. When true, an informative dialog will be shown. Once the
@@ -98,9 +110,16 @@ data class TeamSettingsSelfDeletionStatus(
98110
val enforcedSelfDeletionTimer: TeamSelfDeleteTimer
99111
)
100112

113+
@Serializable
101114
sealed interface TeamSelfDeleteTimer {
115+
116+
@Serializable
102117
data object Disabled : TeamSelfDeleteTimer
118+
119+
@Serializable
103120
data object Enabled : TeamSelfDeleteTimer
121+
122+
@Serializable
104123
data class Enforced(val enforcedDuration: Duration) : TeamSelfDeleteTimer
105124

106125
fun toLogMap(eventDescription: String): Map<String, Any?> = mapOf(

0 commit comments

Comments
 (0)