removing unused base property from the sealed classes and switching to interfaces

This commit is contained in:
Adam Brown 2021-11-23 18:21:42 +00:00
parent d1102f7be4
commit 70d25653c8
2 changed files with 11 additions and 11 deletions

View File

@ -23,11 +23,11 @@ package org.matrix.android.sdk.api.session.room.send
* EDIT: draft of an edition of a message * EDIT: draft of an edition of a message
* REPLY: draft of a reply of another message * REPLY: draft of a reply of another message
*/ */
sealed class UserDraft(open val text: String) { sealed interface UserDraft {
data class Regular(override val text: String) : UserDraft(text) data class Regular(val text: String) : UserDraft
data class Quote(val linkedEventId: String, override val text: String) : UserDraft(text) data class Quote(val linkedEventId: String, val text: String) : UserDraft
data class Edit(val linkedEventId: String, override val text: String) : UserDraft(text) data class Edit(val linkedEventId: String, val text: String) : UserDraft
data class Reply(val linkedEventId: String, override val text: String) : UserDraft(text) data class Reply(val linkedEventId: String, val text: String) : UserDraft
fun isValid(): Boolean { fun isValid(): Boolean {
return when (this) { return when (this) {

View File

@ -29,17 +29,17 @@ import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
* *
* Depending on the state the bottom toolbar will change (icons/preview/actions...) * Depending on the state the bottom toolbar will change (icons/preview/actions...)
*/ */
sealed class SendMode(open val text: String) { sealed interface SendMode {
data class Regular( data class Regular(
override val text: String, val text: String,
val fromSharing: Boolean, val fromSharing: Boolean,
// This is necessary for forcing refresh on selectSubscribe // This is necessary for forcing refresh on selectSubscribe
private val ts: Long = System.currentTimeMillis() private val ts: Long = System.currentTimeMillis()
) : SendMode(text) ) : SendMode
data class Quote(val timelineEvent: TimelineEvent, override val text: String) : SendMode(text) data class Quote(val timelineEvent: TimelineEvent, val text: String) : SendMode
data class Edit(val timelineEvent: TimelineEvent, override val text: String) : SendMode(text) data class Edit(val timelineEvent: TimelineEvent, val text: String) : SendMode
data class Reply(val timelineEvent: TimelineEvent, override val text: String) : SendMode(text) data class Reply(val timelineEvent: TimelineEvent, val text: String) : SendMode
} }
data class MessageComposerViewState( data class MessageComposerViewState(