Добавлено сохранение аватаров для групповых сообщений, улучшена логика обработки ключей диалога в компонентах сообщений.
This commit is contained in:
@@ -2170,6 +2170,8 @@ fun ChatDetailScreen(
|
||||
message.senderName,
|
||||
isGroupChat =
|
||||
isGroupChat,
|
||||
dialogPublicKey =
|
||||
user.publicKey,
|
||||
showGroupSenderLabel =
|
||||
isGroupChat &&
|
||||
!message.isOutgoing,
|
||||
|
||||
@@ -332,6 +332,8 @@ fun MessageAttachments(
|
||||
isOutgoing: Boolean,
|
||||
isDarkTheme: Boolean,
|
||||
senderPublicKey: String,
|
||||
dialogPublicKey: String = "",
|
||||
isGroupChat: Boolean = false,
|
||||
timestamp: java.util.Date,
|
||||
messageStatus: MessageStatus = MessageStatus.READ,
|
||||
avatarRepository: AvatarRepository? = null,
|
||||
@@ -392,6 +394,8 @@ fun MessageAttachments(
|
||||
chachaKey = chachaKey,
|
||||
privateKey = privateKey,
|
||||
senderPublicKey = senderPublicKey,
|
||||
dialogPublicKey = dialogPublicKey,
|
||||
isGroupChat = isGroupChat,
|
||||
avatarRepository = avatarRepository,
|
||||
currentUserPublicKey = currentUserPublicKey,
|
||||
isOutgoing = isOutgoing,
|
||||
@@ -1775,6 +1779,8 @@ fun AvatarAttachment(
|
||||
chachaKey: String,
|
||||
privateKey: String,
|
||||
senderPublicKey: String,
|
||||
dialogPublicKey: String = "",
|
||||
isGroupChat: Boolean = false,
|
||||
avatarRepository: AvatarRepository?,
|
||||
currentUserPublicKey: String = "",
|
||||
isOutgoing: Boolean,
|
||||
@@ -1924,11 +1930,15 @@ fun AvatarAttachment(
|
||||
// Сохраняем аватар в репозиторий (для UI обновления)
|
||||
// Если это исходящее сообщение с аватаром, сохраняем для текущего
|
||||
// пользователя
|
||||
val normalizedDialogKey = dialogPublicKey.trim()
|
||||
val isGroupAvatarAttachment = isGroupChat || isGroupStoredKey(chachaKey)
|
||||
val targetPublicKey =
|
||||
if (isOutgoing && currentUserPublicKey.isNotEmpty()) {
|
||||
currentUserPublicKey
|
||||
} else {
|
||||
senderPublicKey
|
||||
when {
|
||||
isGroupAvatarAttachment && normalizedDialogKey.isNotEmpty() ->
|
||||
normalizedDialogKey
|
||||
isOutgoing && currentUserPublicKey.isNotEmpty() ->
|
||||
currentUserPublicKey
|
||||
else -> senderPublicKey
|
||||
}
|
||||
|
||||
// ВАЖНО: ждем завершения сохранения в репозиторий
|
||||
|
||||
@@ -297,6 +297,7 @@ fun MessageBubble(
|
||||
senderPublicKey: String = "",
|
||||
senderName: String = "",
|
||||
isGroupChat: Boolean = false,
|
||||
dialogPublicKey: String = "",
|
||||
showGroupSenderLabel: Boolean = false,
|
||||
isGroupSenderAdmin: Boolean = false,
|
||||
currentUserPublicKey: String = "",
|
||||
@@ -846,6 +847,8 @@ fun MessageBubble(
|
||||
isOutgoing = message.isOutgoing,
|
||||
isDarkTheme = isDarkTheme,
|
||||
senderPublicKey = senderPublicKey,
|
||||
dialogPublicKey = dialogPublicKey,
|
||||
isGroupChat = isGroupChat,
|
||||
timestamp = message.timestamp,
|
||||
messageStatus = attachmentDisplayStatus,
|
||||
avatarRepository = avatarRepository,
|
||||
|
||||
Reference in New Issue
Block a user