Normalize PM voice and video into the Android message model
This commit is contained in:
1 parent
6185869c6d
commit
80b4e6f3e9
2 files changed
+10
-4
No files matched your search
@@ -582,9 +582,14 @@ class ChatRepository {
|
||||
text = obj.optString("data", ""),
|
||||
ts = obj.optLong("ts", 0),
|
||||
isOutgoing = outgoing,
|
||||
contentType = if (file) "file" else "text/plain",
|
||||
contentType = obj.optString("content_type", "text/plain"),
|
||||
filePath = path,
|
||||
fileSize = obj.optLong("media_size"),
|
||||
waveform = obj.optString("waveform").map { "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(it).coerceAtLeast(0) / 63f },
|
||||
voiceDurationMs = obj.optInt("duration_ms"),
|
||||
videoDurationMs = obj.optInt("duration_ms"),
|
||||
videoWidth = obj.optInt("width"),
|
||||
videoHeight = obj.optInt("height"),
|
||||
downloadState = if (!file) "" else if (path.isNotEmpty()) "downloaded" else if (status == "expired") "error" else "downloading",
|
||||
deliveryStatus = delivery
|
||||
))
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.utun.chat.data
|
||||
|
||||
/** Адресат фиксируется до записи, выбора файла или фоновой подготовки. */
|
||||
sealed class ConversationTarget(val id: String) {
|
||||
class Channel(id: String) : ConversationTarget(id)
|
||||
class Pm(id: String) : ConversationTarget(id)
|
||||
sealed class ConversationTarget {
|
||||
abstract val id: String
|
||||
data class Channel(override val id: String) : ConversationTarget()
|
||||
data class Pm(override val id: String) : ConversationTarget()
|
||||
val nativeId: String get() = if (this is Pm) "dm:$id" else id
|
||||
}
|
||||
Reference in new issue
Block a user