diff --git a/tools/chatgui-android/app/src/main/java/com/utun/chat/data/ChatRepository.kt b/tools/chatgui-android/app/src/main/java/com/utun/chat/data/ChatRepository.kt
index 9f8dde676..da4579ff8 100644
--- a/tools/chatgui-android/app/src/main/java/com/utun/chat/data/ChatRepository.kt
+++ b/tools/chatgui-android/app/src/main/java/com/utun/chat/data/ChatRepository.kt
@@ -16,7 +16,8 @@ data class Channel(val id: String, val name: String, val lastMsgAt: Long = 0, va
val peersOnline: Int = 0, val lastMsgEncrypted: Boolean = false)
data class DmConversation(val convId: String, val peerNodeId: Long = 0, val peerName: String = "",
- val lastTs: Long = 0, val online: Boolean = false, val generation: Long = 1) {
+ val lastTs: Long = 0, val online: Boolean = false, val generation: Long = 1,
+ val mode: Int = 0, val closed: Boolean = false) {
val displayName: String get() = peerName.ifBlank { "0x%016x".format(peerNodeId) }
}
data class Message(val id: Long, val author: String, val text: String, val ts: Long,
@@ -562,9 +563,9 @@ class ChatRepository(private val reportFailure: (String) -> Unit = { LogManager.
/* ── DM (личные сообщения) ── */
- /** ID принятого запроса, привязанный к instance; null — отказ. Возврат ещё не подтверждает commit: нужен DM_CONV_UPDATED. */
- fun dmStart(nodeId: Long, sourceChId: String, peerName: String): String? =
- NativeLib.dmStart(nodeId, sourceChId, peerName)
+ /** ID зафиксированной ядром беседы, null — отказ. Режим не выводится из node ID. */
+ fun dmStart(nodeId: Long, sourceChId: String, peerName: String, groups: Boolean = false): String? =
+ NativeLib.dmStart(nodeId, sourceChId, peerName, groups)
fun dmSend(convId: String, text: String, generation: Long, requestId: Long): Boolean =
NativeLib.dmSend(convId, text, generation, requestId)
@@ -579,7 +580,8 @@ class ChatRepository(private val reportFailure: (String) -> Unit = { LogManager.
convId = obj.getString("conv_id"),
peerNodeId = obj.optLong("peer_node_id", 0),
peerName = obj.optString("peer_name", ""),
- lastTs = obj.optLong("last_ts", 0), generation = obj.getLong("generation")
+ lastTs = obj.optLong("last_ts", 0), generation = obj.getLong("generation"),
+ mode = obj.optInt("mode"), closed = obj.optBoolean("closed")
))
}
} catch (e: Exception) {
@@ -602,15 +604,17 @@ class ChatRepository(private val reportFailure: (String) -> Unit = { LogManager.
val delivery = if (file) when {
status == "delivered" -> R.string.delivery_delivered
status == "expired" -> R.string.delivery_expired
- outgoing -> R.string.delivery_pending
path.isNotEmpty() -> R.string.delivery_received
- else -> R.string.delivery_loading
- } else if (outgoing) {
+ status == "downloading" -> R.string.delivery_loading
+ status == "unavailable" -> R.string.dm_file_unavailable
+ else -> R.string.dm_download
+ } else if (obj.optBoolean("source")) {
if (obj.optBoolean("pending")) R.string.delivery_pending else R.string.delivery_delivered
} else 0
val author = peerName.ifBlank { "0x%016x".format(obj.optLong("author", 0)) }
list.add(Message(
id = obj.optLong("seq", 0),
+ messageId = "${obj.optString("author")}:${obj.optLong("seq")}",
author = author,
authorNodeId = obj.optLong("author", 0),
text = obj.optString("data", ""),
@@ -627,7 +631,11 @@ class ChatRepository(private val reportFailure: (String) -> Unit = { LogManager.
videoHeight = obj.optInt("height"),
imageWidth = obj.optInt("width"),
imageHeight = obj.optInt("height"),
- downloadState = if (!file) "" else if (path.isNotEmpty()) "downloaded" else if (status == "expired") "error" else "downloading",
+ downloadState = if (!file) "" else if (path.isNotEmpty()) "downloaded" else when (status) {
+ "downloading" -> "downloading"
+ "expired", "unavailable" -> "error"
+ else -> ""
+ },
deliveryStatusRes = delivery
))
}
diff --git a/tools/chatgui-android/app/src/main/res/values-ru/dm_groups.xml b/tools/chatgui-android/app/src/main/res/values-ru/dm_groups.xml
new file mode 100644
index 000000000..17e2c26d1
--- /dev/null
+++ b/tools/chatgui-android/app/src/main/res/values-ru/dm_groups.xml
@@ -0,0 +1,9 @@
+
+
+ Устройства для этой беседы
+ С подгруппами устройств
+ Только эти устройства
+ Скачать
+ Файл недоступен
+ Вы вышли из подгруппы. Сохранённая история остаётся доступной.
+
diff --git a/tools/chatgui-android/app/src/main/res/values/dm_groups.xml b/tools/chatgui-android/app/src/main/res/values/dm_groups.xml
new file mode 100644
index 000000000..940ae4616
--- /dev/null
+++ b/tools/chatgui-android/app/src/main/res/values/dm_groups.xml
@@ -0,0 +1,9 @@
+
+
+ Devices for this conversation
+ With device groups
+ Only these devices
+ Download
+ File unavailable
+ You left the device group. Saved history is still available.
+