feat: Enhance logging in ChatViewModel and improve emoji handling in MessageInputBar
This commit is contained in:
@@ -1982,8 +1982,9 @@ private fun MessageInputBar(
|
||||
// Закрываем клавиатуру через IMM
|
||||
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.hideSoftInputFromWindow(view.windowToken, 0)
|
||||
// Показываем эмодзи сразу без задержки (эмодзи уже предзагружены)
|
||||
// 🔥 Показываем эмодзи сразу - без задержки!
|
||||
onToggleEmojiPicker(true)
|
||||
android.util.Log.d("MessageInputBar", "🎯 toggleEmojiPicker: showEmojiPicker=true, emojiPanelHeight=$emojiPanelHeight")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2091,7 +2092,7 @@ private fun MessageInputBar(
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Text(
|
||||
text = if (isForwardMode) "Forward message${if (replyMessages.size > 1) "s" else ""}"
|
||||
else "Reply to ${if (replyMessages.size == 1 && !replyMessages.first().isOutgoing) chatTitle else "yourself"}",
|
||||
else "Reply to ${if (replyMessages.size == 1 && !replyMessages.first().isOutgoing) chatTitle else "You"}",
|
||||
fontSize = 13.sp,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
color = PrimaryBlue,
|
||||
@@ -2246,9 +2247,11 @@ private fun MessageInputBar(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(animatedHeight)
|
||||
.padding(bottom = 16.dp) // 🔥 Отступ снизу для безопасной зоны
|
||||
) {
|
||||
// 🚀 Рендерим панель только когда нужно
|
||||
if (showEmojiPicker && !isKeyboardVisible) {
|
||||
// 🚀 Рендерим панель когда showEmojiPicker = true
|
||||
// Высота контролируется через animatedHeight
|
||||
if (showEmojiPicker) {
|
||||
AppleEmojiPickerPanel(
|
||||
isDarkTheme = isDarkTheme,
|
||||
onEmojiSelected = { emoji ->
|
||||
@@ -2259,7 +2262,7 @@ private fun MessageInputBar(
|
||||
},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(emojiPanelHeight)
|
||||
.height(emojiPanelHeight - 16.dp) // 🔥 Учитываем отступ
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -2320,9 +2323,8 @@ fun MessageSkeletonList(
|
||||
isDarkTheme: Boolean,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
// Цвета пузырьков как у настоящих сообщений
|
||||
val outgoingBubbleColor = if (isDarkTheme) Color(0xFF3B82F6).copy(alpha = 0.3f) else Color(0xFF3B82F6).copy(alpha = 0.2f)
|
||||
val incomingBubbleColor = if (isDarkTheme) Color(0xFF3A3A3C) else Color(0xFFE5E5EA)
|
||||
// 🔥 Серый цвет для всех пузырьков (нейтральный скелетон)
|
||||
val skeletonColor = if (isDarkTheme) Color(0xFF3A3A3C) else Color(0xFFE0E0E0)
|
||||
|
||||
// Shimmer анимация
|
||||
val infiniteTransition = rememberInfiniteTransition(label = "shimmer")
|
||||
@@ -2342,16 +2344,17 @@ fun MessageSkeletonList(
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomCenter)
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 8.dp, vertical = 8.dp),
|
||||
.padding(horizontal = 8.dp)
|
||||
.padding(bottom = 80.dp), // 🔥 Отступ от инпута
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp)
|
||||
) {
|
||||
// Паттерн сообщений снизу вверх (как в реальном чате)
|
||||
SkeletonBubble(isOutgoing = true, widthFraction = 0.45f, bubbleColor = outgoingBubbleColor, alpha = shimmerAlpha)
|
||||
SkeletonBubble(isOutgoing = false, widthFraction = 0.55f, bubbleColor = incomingBubbleColor, alpha = shimmerAlpha)
|
||||
SkeletonBubble(isOutgoing = true, widthFraction = 0.35f, bubbleColor = outgoingBubbleColor, alpha = shimmerAlpha)
|
||||
SkeletonBubble(isOutgoing = false, widthFraction = 0.50f, bubbleColor = incomingBubbleColor, alpha = shimmerAlpha)
|
||||
SkeletonBubble(isOutgoing = true, widthFraction = 0.60f, bubbleColor = outgoingBubbleColor, alpha = shimmerAlpha)
|
||||
SkeletonBubble(isOutgoing = false, widthFraction = 0.40f, bubbleColor = incomingBubbleColor, alpha = shimmerAlpha)
|
||||
// Паттерн сообщений снизу вверх (как в реальном чате) - серые пузырьки
|
||||
SkeletonBubble(isOutgoing = true, widthFraction = 0.45f, bubbleColor = skeletonColor, alpha = shimmerAlpha)
|
||||
SkeletonBubble(isOutgoing = false, widthFraction = 0.55f, bubbleColor = skeletonColor, alpha = shimmerAlpha)
|
||||
SkeletonBubble(isOutgoing = true, widthFraction = 0.35f, bubbleColor = skeletonColor, alpha = shimmerAlpha)
|
||||
SkeletonBubble(isOutgoing = false, widthFraction = 0.50f, bubbleColor = skeletonColor, alpha = shimmerAlpha)
|
||||
SkeletonBubble(isOutgoing = true, widthFraction = 0.60f, bubbleColor = skeletonColor, alpha = shimmerAlpha)
|
||||
SkeletonBubble(isOutgoing = false, widthFraction = 0.40f, bubbleColor = skeletonColor, alpha = shimmerAlpha)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -969,11 +969,16 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) {
|
||||
}
|
||||
|
||||
// 🔥 Log packet details before sending
|
||||
Log.d(TAG, "📦 PACKET READY TO SEND:")
|
||||
Log.d(TAG, " - messageId: $messageId")
|
||||
Log.d(TAG, " - attachments count: ${packet.attachments.size}")
|
||||
packet.attachments.forEach { att ->
|
||||
Log.d(TAG, " - attachment: type=${att.type}, id=${att.id}, blob.length=${att.blob.length}")
|
||||
}
|
||||
|
||||
// Отправляем пакет
|
||||
ProtocolManager.send(packet)
|
||||
Log.d(TAG, "✅ PACKET SENT via ProtocolManager.send()")
|
||||
|
||||
// 3. 🎯 UI обновление в Main потоке
|
||||
withContext(Dispatchers.Main) {
|
||||
|
||||
Reference in New Issue
Block a user