feat: add avatar presence handling in OtherProfileScreen for improved scroll behavior

This commit is contained in:
2026-02-14 03:13:19 +05:00
parent 2df37611e2
commit 9b0bde95d2
7 changed files with 70 additions and 12 deletions

View File

@@ -579,8 +579,11 @@ interface DialogDao {
*/
@Transaction
suspend fun updateDialogFromMessages(account: String, opponentKey: String) {
// 📁 Для saved messages dialogKey = account (не "$account:$account")
val dialogKey =
if (account < opponentKey) "$account:$opponentKey" else "$opponentKey:$account"
if (account == opponentKey) account
else if (account < opponentKey) "$account:$opponentKey"
else "$opponentKey:$account"
// 1. Получаем последнее сообщение — O(1) по индексу (account, dialog_key, timestamp)
val lastMsg = getLastMessageByDialogKey(account, dialogKey) ?: return
@@ -624,7 +627,8 @@ interface DialogDao {
*/
@Transaction
suspend fun updateSavedMessagesDialogFromMessages(account: String) {
val dialogKey = "$account:$account"
// 📁 dialogKey для saved messages = account (не "$account:$account")
val dialogKey = account
val lastMsg = getLastMessageByDialogKey(account, dialogKey) ?: return
val existing = getDialog(account, account)