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