feat: Bump version to 1.0.7, enhance message delivery handling, and add connection logs screen

This commit is contained in:
2026-02-25 11:16:31 +05:00
parent 75810a0696
commit aed685ee73
11 changed files with 618 additions and 59 deletions

View File

@@ -414,6 +414,50 @@ interface MessageDao {
"""
)
suspend fun getLastMessageAttachments(account: String, opponent: String): String?
/**
* Get all outgoing messages stuck in WAITING status (delivered = 0).
* Used to retry sending on reconnect (desktop parity: _packetQueue flush).
* Only returns messages younger than minTimestamp to avoid retrying stale messages.
*/
@Query(
"""
SELECT * FROM messages
WHERE account = :account
AND from_me = 1
AND delivered = 0
AND timestamp >= :minTimestamp
ORDER BY timestamp ASC
"""
)
suspend fun getWaitingMessages(account: String, minTimestamp: Long): List<MessageEntity>
/**
* Mark old WAITING messages as ERROR (delivery timeout expired).
* Desktop parity: MESSAGE_MAX_TIME_TO_DELEVERED_S = 80s.
*/
@Query(
"""
UPDATE messages SET delivered = 2
WHERE account = :account
AND from_me = 1
AND delivered = 0
AND timestamp < :maxTimestamp
"""
)
suspend fun markExpiredWaitingAsError(account: String, maxTimestamp: Long): Int
/**
* Update delivery status AND timestamp on delivery confirmation.
* Desktop parity: useDialogFiber.ts sets timestamp = Date.now() on PacketDelivery.
*/
@Query(
"""
UPDATE messages SET delivered = :status, timestamp = :timestamp
WHERE account = :account AND message_id = :messageId
"""
)
suspend fun updateDeliveryStatusAndTimestamp(account: String, messageId: String, status: Int, timestamp: Long)
}
/** DAO для работы с диалогами */
@@ -480,6 +524,23 @@ interface DialogDao {
)
fun getRequestsCountFlow(account: String): Flow<Int>
/**
* Desktop parity: get all dialogs where opponent_title is empty or equals the raw
* public key (or its prefix). Used by requestMissingUserInfo() to batch-resolve names
* after sync, like Desktop's useUserInformation per-component hook.
*/
@Query("""
SELECT * FROM dialogs
WHERE account = :account
AND last_message_timestamp > 0
AND (
opponent_title = ''
OR opponent_title = opponent_key
OR LENGTH(opponent_title) <= 8
)
""")
suspend fun getDialogsWithEmptyTitle(account: String): List<DialogEntity>
/** Получить диалог */
@Query("SELECT * FROM dialogs WHERE account = :account AND opponent_key = :opponentKey LIMIT 1")
suspend fun getDialog(account: String, opponentKey: String): DialogEntity?