feat: Implement avatar handling and display across chat and account screens
This commit is contained in:
@@ -37,6 +37,7 @@ import com.rosetta.messenger.data.RecentSearchesManager
|
||||
import com.rosetta.messenger.network.ProtocolManager
|
||||
import com.rosetta.messenger.network.ProtocolState
|
||||
import com.rosetta.messenger.ui.components.AppleEmojiText
|
||||
import com.rosetta.messenger.ui.components.AvatarImage
|
||||
import com.rosetta.messenger.ui.onboarding.PrimaryBlue
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
@@ -147,6 +148,7 @@ fun ChatsListScreen(
|
||||
onNewChat: () -> Unit,
|
||||
onUserSelect: (com.rosetta.messenger.network.SearchUser) -> Unit = {},
|
||||
chatsViewModel: ChatsListViewModel = androidx.lifecycle.viewmodel.compose.viewModel(),
|
||||
avatarRepository: com.rosetta.messenger.repository.AvatarRepository? = null,
|
||||
onLogout: () -> Unit
|
||||
) {
|
||||
// Theme transition state
|
||||
@@ -398,7 +400,7 @@ fun ChatsListScreen(
|
||||
)
|
||||
) {
|
||||
Column {
|
||||
// Avatar with border
|
||||
// Avatar - используем AvatarImage
|
||||
Box(
|
||||
modifier =
|
||||
Modifier.size(72.dp)
|
||||
@@ -414,29 +416,15 @@ fun ChatsListScreen(
|
||||
)
|
||||
.padding(
|
||||
3.dp
|
||||
)
|
||||
.clip(
|
||||
CircleShape
|
||||
)
|
||||
.background(
|
||||
avatarColors
|
||||
.backgroundColor
|
||||
),
|
||||
contentAlignment =
|
||||
Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text =
|
||||
getAvatarText(
|
||||
accountPublicKey
|
||||
),
|
||||
fontSize = 26.sp,
|
||||
fontWeight =
|
||||
FontWeight
|
||||
.Bold,
|
||||
color =
|
||||
avatarColors
|
||||
.textColor
|
||||
AvatarImage(
|
||||
publicKey = accountPublicKey,
|
||||
avatarRepository = avatarRepository,
|
||||
size = 66.dp,
|
||||
isDarkTheme = isDarkTheme
|
||||
)
|
||||
}
|
||||
|
||||
@@ -996,6 +984,8 @@ fun ChatsListScreen(
|
||||
isBlocked,
|
||||
isSavedMessages =
|
||||
isSavedMessages,
|
||||
avatarRepository =
|
||||
avatarRepository,
|
||||
onClick = {
|
||||
val user =
|
||||
chatsViewModel
|
||||
@@ -1469,6 +1459,7 @@ fun SwipeableDialogItem(
|
||||
isTyping: Boolean = false,
|
||||
isBlocked: Boolean = false,
|
||||
isSavedMessages: Boolean = false,
|
||||
avatarRepository: com.rosetta.messenger.repository.AvatarRepository? = null,
|
||||
onClick: () -> Unit,
|
||||
onDelete: () -> Unit = {},
|
||||
onBlock: () -> Unit = {},
|
||||
@@ -1615,6 +1606,7 @@ fun SwipeableDialogItem(
|
||||
dialog = dialog,
|
||||
isDarkTheme = isDarkTheme,
|
||||
isTyping = isTyping,
|
||||
avatarRepository = avatarRepository,
|
||||
onClick = onClick
|
||||
)
|
||||
|
||||
@@ -1635,6 +1627,7 @@ fun DialogItemContent(
|
||||
dialog: DialogUiModel,
|
||||
isDarkTheme: Boolean,
|
||||
isTyping: Boolean = false,
|
||||
avatarRepository: com.rosetta.messenger.repository.AvatarRepository? = null,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
// 🔥 ОПТИМИЗАЦИЯ: Кешируем цвета и строки
|
||||
@@ -1721,31 +1714,28 @@ fun DialogItemContent(
|
||||
// Avatar container with online indicator
|
||||
Box(modifier = Modifier.size(56.dp)) {
|
||||
// Avatar
|
||||
Box(
|
||||
modifier =
|
||||
Modifier.fillMaxSize()
|
||||
.clip(CircleShape)
|
||||
.background(
|
||||
if (dialog.isSavedMessages) PrimaryBlue
|
||||
else avatarColors.backgroundColor
|
||||
),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
if (dialog.isSavedMessages) {
|
||||
if (dialog.isSavedMessages) {
|
||||
Box(
|
||||
modifier =
|
||||
Modifier.fillMaxSize()
|
||||
.clip(CircleShape)
|
||||
.background(PrimaryBlue),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Icon(
|
||||
Icons.Default.Bookmark,
|
||||
contentDescription = null,
|
||||
tint = Color.White,
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
} else {
|
||||
Text(
|
||||
text = initials,
|
||||
color = avatarColors.textColor,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
fontSize = 18.sp
|
||||
)
|
||||
}
|
||||
} else {
|
||||
com.rosetta.messenger.ui.components.AvatarImage(
|
||||
publicKey = dialog.opponentKey,
|
||||
avatarRepository = avatarRepository,
|
||||
size = 56.dp,
|
||||
isDarkTheme = isDarkTheme
|
||||
)
|
||||
}
|
||||
|
||||
// Online indicator - зелёный кружок с белой обводкой
|
||||
|
||||
Reference in New Issue
Block a user