fix: fix names in chat list screen

This commit is contained in:
k1ngsterr1
2026-02-08 22:46:35 +05:00
parent aa47a46334
commit fa785ddb29
2 changed files with 27 additions and 0 deletions

View File

@@ -2737,6 +2737,14 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) {
} else { } else {
dialogDao.updateDialogFromMessages(account, opponent) dialogDao.updateDialogFromMessages(account, opponent)
} }
// 🔥 FIX: updateDialogFromMessages создаёт новый диалог с пустым title/username
// когда диалога ещё не было. Обновляем метаданные из уже известных данных.
if (opponent != account && opponentTitle.isNotEmpty()) {
dialogDao.updateOpponentInfo(
account, opponent, opponentTitle, opponentUsername, 0
)
}
} catch (e: Exception) {} } catch (e: Exception) {}
} }
@@ -2763,6 +2771,13 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) {
} else { } else {
dialogDao.updateDialogFromMessages(account, opponentKey) dialogDao.updateDialogFromMessages(account, opponentKey)
} }
// 🔥 FIX: Сохраняем title/username после пересчёта счётчиков
if (opponentKey != account && opponentTitle.isNotEmpty()) {
dialogDao.updateOpponentInfo(
account, opponentKey, opponentTitle, opponentUsername, 0
)
}
} catch (e: Exception) {} } catch (e: Exception) {}
} }

View File

@@ -2042,6 +2042,7 @@ fun SwipeableDialogItem(
isDarkTheme = isDarkTheme, isDarkTheme = isDarkTheme,
isTyping = isTyping, isTyping = isTyping,
isPinned = isPinned, isPinned = isPinned,
isBlocked = isBlocked,
avatarRepository = avatarRepository, avatarRepository = avatarRepository,
onClick = onClick onClick = onClick
) )
@@ -2064,6 +2065,7 @@ fun DialogItemContent(
isDarkTheme: Boolean, isDarkTheme: Boolean,
isTyping: Boolean = false, isTyping: Boolean = false,
isPinned: Boolean = false, isPinned: Boolean = false,
isBlocked: Boolean = false,
avatarRepository: com.rosetta.messenger.repository.AvatarRepository? = null, avatarRepository: com.rosetta.messenger.repository.AvatarRepository? = null,
onClick: () -> Unit onClick: () -> Unit
) { ) {
@@ -2241,6 +2243,16 @@ fun DialogItemContent(
Spacer(modifier = Modifier.width(4.dp)) Spacer(modifier = Modifier.width(4.dp))
VerifiedBadge(verified = dialog.verified, size = 16) VerifiedBadge(verified = dialog.verified, size = 16)
} }
// 🔒 Красная иконка замочка для заблокированных пользователей
if (isBlocked) {
Spacer(modifier = Modifier.width(4.dp))
Icon(
imageVector = TablerIcons.Lock,
contentDescription = "Blocked",
tint = Color(0xFFFF3B30),
modifier = Modifier.size(14.dp)
)
}
} }
Row( Row(