refactor: Simplify message loading logic and remove workaround for large messages in ChatViewModel

This commit is contained in:
k1ngsterr1
2026-01-26 14:32:54 +05:00
parent 3c08adb516
commit 25814f7de7
2 changed files with 9 additions and 48 deletions

View File

@@ -732,6 +732,9 @@ class MessageRepository private constructor(private val context: Context) {
/**
* Сериализация attachments в JSON
* 🔥 ВАЖНО: blob НЕ сохраняется в БД (как в desktop)
* Только метаданные: id, type, preview, width, height
* blob скачивается с CDN по id при показе
*/
private fun serializeAttachments(attachments: List<MessageAttachment>): String {
if (attachments.isEmpty()) return "[]"
@@ -740,7 +743,8 @@ class MessageRepository private constructor(private val context: Context) {
for (attachment in attachments) {
val jsonObj = JSONObject().apply {
put("id", attachment.id)
put("blob", attachment.blob)
// 🔥 blob НЕ сохраняем в БД - скачивается с CDN по id
put("blob", "")
put("type", attachment.type.value)
put("preview", attachment.preview)
put("width", attachment.width)