fix: update status bar color management for improved visibility in ChatDetailScreen and OtherProfileScreen

This commit is contained in:
2026-02-03 02:39:13 +05:00
parent 7d90a9d744
commit da76243e3a
8 changed files with 197 additions and 50 deletions

View File

@@ -197,8 +197,19 @@ class AppleEmojiEditTextView @JvmOverloads constructor(
}
// Восстанавливаем курсор, убедившись что он в допустимых пределах
if (cursorPosition >= 0 && cursorPosition <= editable.length) {
post { setSelection(cursorPosition.coerceIn(0, editable.length)) }
// 🔥 Захватываем длину ДО post, т.к. text может измениться
val safePosition = cursorPosition.coerceIn(0, editable.length)
if (safePosition >= 0) {
post {
try {
val currentLength = text?.length ?: 0
if (safePosition <= currentLength) {
setSelection(safePosition.coerceIn(0, currentLength))
}
} catch (e: Exception) {
// Игнорируем - текст мог измениться
}
}
}
} finally {
isUpdating = false

View File

@@ -27,6 +27,7 @@ import com.rosetta.messenger.repository.AvatarRepository
import com.rosetta.messenger.ui.chats.AvatarColors
import com.rosetta.messenger.ui.chats.getAvatarColor
import com.rosetta.messenger.ui.chats.getAvatarText
import com.rosetta.messenger.ui.chats.getInitials
import com.rosetta.messenger.utils.AvatarFileManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
@@ -57,7 +58,8 @@ fun AvatarImage(
onClick: (() -> Unit)? = null,
showOnlineIndicator: Boolean = false,
isOnline: Boolean = false,
shape: Shape = CircleShape
shape: Shape = CircleShape,
displayName: String? = null // 🔥 Имя для инициалов (title/username)
) {
// Получаем аватары из репозитория
val avatars by avatarRepository?.getAvatars(publicKey, allDecode = false)?.collectAsState()
@@ -113,7 +115,8 @@ fun AvatarImage(
publicKey = publicKey,
size = size,
isDarkTheme = isDarkTheme,
shape = shape
shape = shape,
displayName = displayName
)
}
@@ -138,10 +141,16 @@ fun AvatarPlaceholder(
size: Dp = 40.dp,
isDarkTheme: Boolean,
fontSize: TextUnit? = null,
shape: Shape = CircleShape
shape: Shape = CircleShape,
displayName: String? = null // 🔥 Имя для инициалов
) {
val avatarColors = getAvatarColor(publicKey, isDarkTheme)
val avatarText = getAvatarText(publicKey)
// 🔥 Используем displayName для инициалов, если оно есть
val avatarText = if (!displayName.isNullOrEmpty() && displayName != publicKey && !displayName.startsWith(publicKey.take(7))) {
getInitials(displayName)
} else {
getAvatarText(publicKey)
}
Box(
modifier = Modifier