diff --git a/app/src/main/java/com/rosetta/messenger/ui/chats/ChatDetailScreen.kt b/app/src/main/java/com/rosetta/messenger/ui/chats/ChatDetailScreen.kt index ce34e49..cb6a8c3 100644 --- a/app/src/main/java/com/rosetta/messenger/ui/chats/ChatDetailScreen.kt +++ b/app/src/main/java/com/rosetta/messenger/ui/chats/ChatDetailScreen.kt @@ -936,9 +936,13 @@ fun ChatDetailScreen( } }, onSend = { + android.util.Log.d("ChatDetailScreen", "🔥🔥🔥 onSend callback CALLED 🔥🔥🔥") + android.util.Log.d("ChatDetailScreen", "📝 inputText: '$inputText'") // Скрываем кнопку scroll на время отправки isSendingMessage = true + android.util.Log.d("ChatDetailScreen", "➡️ Calling viewModel.sendMessage()") viewModel.sendMessage() + android.util.Log.d("ChatDetailScreen", "✅ viewModel.sendMessage() called") // Скроллим к новому сообщению scope.launch { delay(100) @@ -1625,7 +1629,9 @@ private fun MessageInputBar( // Функция отправки - НЕ закрывает клавиатуру (UX правило #6) fun handleSend() { + android.util.Log.d("MessageInputBar", "🚀 handleSend() called, value='$value', isNotBlank=${value.isNotBlank()}") if (value.isNotBlank()) { + android.util.Log.d("MessageInputBar", "✅ Calling onSend()") onSend() // Очищаем инпут, но клавиатура остаётся открытой } diff --git a/app/src/main/java/com/rosetta/messenger/ui/chats/ChatViewModel.kt b/app/src/main/java/com/rosetta/messenger/ui/chats/ChatViewModel.kt index 8c74fdb..71b57e1 100644 --- a/app/src/main/java/com/rosetta/messenger/ui/chats/ChatViewModel.kt +++ b/app/src/main/java/com/rosetta/messenger/ui/chats/ChatViewModel.kt @@ -489,6 +489,9 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) { * - Поддержка Reply/Forward */ fun sendMessage() { + Log.d(TAG, "🚀🚀🚀 sendMessage() CALLED 🚀🚀🚀") + ProtocolManager.addLog("🚀🚀🚀 sendMessage() CALLED") + val text = _inputText.value.trim() val recipient = opponentKey val sender = myPublicKey @@ -496,24 +499,42 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) { val replyMsgs = _replyMessages.value val isForward = _isForwardMode.value + Log.d(TAG, "📝 Text: '$text'") + Log.d(TAG, "📧 Recipient: ${recipient?.take(16)}") + Log.d(TAG, "👤 Sender: ${sender?.take(16)}") + Log.d(TAG, "🔑 PrivateKey exists: ${privateKey != null}") + Log.d(TAG, "💬 ReplyMsgs: ${replyMsgs.size}") + + ProtocolManager.addLog("📝 Text: '$text'") + ProtocolManager.addLog("📧 Recipient: ${recipient?.take(16)}") + ProtocolManager.addLog("👤 Sender: ${sender?.take(16)}") + ProtocolManager.addLog("🔑 PrivateKey exists: ${privateKey != null}") + // Разрешаем отправку пустого текста если есть reply/forward if (text.isEmpty() && replyMsgs.isEmpty()) { - ProtocolManager.addLog("❌ Empty text") + Log.e(TAG, "❌ Empty text and no reply") + ProtocolManager.addLog("❌ Empty text and no reply") return } if (recipient == null) { + Log.e(TAG, "❌ No recipient") ProtocolManager.addLog("❌ No recipient") return } if (sender == null || privateKey == null) { + Log.e(TAG, "❌ No keys - sender: $sender, privateKey: $privateKey") ProtocolManager.addLog("❌ No keys - set via setUserKeys()") return } if (isSending) { + Log.w(TAG, "⏳ Already sending...") ProtocolManager.addLog("⏳ Already sending...") return } + Log.d(TAG, "✅ All checks passed, starting send...") + ProtocolManager.addLog("✅ All checks passed, starting send...") + isSending = true val messageId = UUID.randomUUID().toString().replace("-", "").take(32)