mobile: allow ending live message with an empty string (#1603)

This commit is contained in:
Evgeny Poberezkin
2022-12-18 19:21:13 +00:00
committed by GitHub
parent c0fb29d5f7
commit b159496257
2 changed files with 3 additions and 12 deletions

View File

@@ -1450,14 +1450,8 @@ sealed class MsgContent {
@Serializable(with = MsgContentSerializer::class) class MCFile(override val text: String): MsgContent()
@Serializable(with = MsgContentSerializer::class) class MCUnknown(val type: String? = null, override val text: String, val json: JsonElement): MsgContent()
val cmdString: String get() = when (this) {
is MCText -> "text $text"
is MCLink -> "json ${json.encodeToString(this)}"
is MCImage -> "json ${json.encodeToString(this)}"
is MCVoice-> "json ${json.encodeToString(this)}"
is MCFile -> "json ${json.encodeToString(this)}"
is MCUnknown -> "json $json"
}
val cmdString: String get() =
if (this is MCUnknown) "json $json" else "json ${json.encodeToString(this)}"
}
@Serializable

View File

@@ -1915,10 +1915,7 @@ public enum MsgContent {
}
var cmdString: String {
switch self {
case let .text(text): return "text \(text)"
default: return "json \(encodeJSON(self))"
}
"json \(encodeJSON(self))"
}
enum CodingKeys: String, CodingKey {