feat: Enhance logging in CryptoManager for decryption errors; update button heights in ChatDetailScreen for consistent UI; improve reply clearing logic in ChatViewModel; add animated dismiss function in ForwardChatPickerBottomSheet

This commit is contained in:
k1ngsterr1
2026-01-16 04:03:19 +05:00
parent fbab2d0f80
commit a3951146a6
4 changed files with 55 additions and 18 deletions

View File

@@ -309,6 +309,11 @@ object CryptoManager {
// Decompress (zlib inflate - совместимо с pako.inflate в JS)
String(decompress(decrypted), Charsets.UTF_8)
} catch (e: Exception) {
android.util.Log.e("ReplyDebug", "❌ [DECRYPT] decryptWithPassword failed:", e)
android.util.Log.e("ReplyDebug", " - Input length: ${encryptedData.length}")
android.util.Log.e("ReplyDebug", " - Input preview: ${encryptedData.take(100)}")
android.util.Log.e("ReplyDebug", " - Password length: ${password.length}")
android.util.Log.e("ReplyDebug", " - Exception: ${e.message}")
null
}
}

View File

@@ -1079,11 +1079,11 @@ fun ChatDetailScreen(
horizontalArrangement = Arrangement.spacedBy(12.dp),
verticalAlignment = Alignment.CenterVertically
) {
// Reply button
// Reply button - идентичной высоты с инпутом
Box(
modifier = Modifier
.weight(1f)
.height(40.dp)
.height(48.dp)
.clip(RoundedCornerShape(12.dp))
.background(PrimaryBlue.copy(alpha = 0.1f))
.clickable {
@@ -1115,11 +1115,11 @@ fun ChatDetailScreen(
}
}
// Forward button - открывает выбор чата (как в десктопе)
// Forward button - идентичной высоты с инпутом
Box(
modifier = Modifier
.weight(1f)
.height(40.dp)
.height(48.dp)
.clip(RoundedCornerShape(12.dp))
.background(PrimaryBlue.copy(alpha = 0.1f))
.clickable {
@@ -2481,11 +2481,33 @@ private fun MessageInputBar(
.padding(bottom = if (isKeyboardVisible || coordinator.isEmojiBoxVisible) 0.dp else 16.dp)
.then(if (shouldAddNavBarPadding) Modifier.navigationBarsPadding() else Modifier)
) {
// REPLY PANEL
// REPLY PANEL - плавная анимация появления/исчезновения
AnimatedVisibility(
visible = hasReply,
enter = fadeIn(tween(100)) + expandVertically(animationSpec = tween(100)),
exit = fadeOut(tween(0)) + shrinkVertically(animationSpec = tween(0))
enter = fadeIn(
animationSpec = tween(
durationMillis = 200,
easing = FastOutSlowInEasing
)
) + expandVertically(
animationSpec = spring(
dampingRatio = Spring.DampingRatioMediumBouncy,
stiffness = Spring.StiffnessMedium
),
expandFrom = Alignment.Bottom
),
exit = fadeOut(
animationSpec = tween(
durationMillis = 150,
easing = FastOutLinearInEasing
)
) + shrinkVertically(
animationSpec = tween(
durationMillis = 150,
easing = FastOutLinearInEasing
),
shrinkTowards = Alignment.Bottom
)
) {
Row(
modifier = Modifier

View File

@@ -1032,11 +1032,8 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) {
_messages.value = _messages.value + optimisticMessage
_inputText.value = ""
// Очищаем reply ПОСЛЕ добавления сообщения в список с небольшой задержкой
viewModelScope.launch {
kotlinx.coroutines.delay(300)
// Очищаем reply сразу после добавления сообщения в список
clearReplyMessages()
}
// Кэшируем текст
decryptionCache[messageId] = text

View File

@@ -10,12 +10,13 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Forward
import androidx.compose.material.icons.filled.ArrowForward
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
@@ -23,6 +24,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.rosetta.messenger.data.ForwardManager
import com.rosetta.messenger.ui.onboarding.PrimaryBlue
import kotlinx.coroutines.launch
import java.text.SimpleDateFormat
import java.util.*
@@ -45,6 +47,7 @@ fun ForwardChatPickerBottomSheet(
val sheetState = rememberModalBottomSheetState(
skipPartiallyExpanded = false
)
val scope = rememberCoroutineScope()
val backgroundColor = if (isDarkTheme) Color(0xFF1C1C1E) else Color.White
val textColor = if (isDarkTheme) Color.White else Color.Black
@@ -54,8 +57,16 @@ fun ForwardChatPickerBottomSheet(
val forwardMessages by ForwardManager.forwardMessages.collectAsState()
val messagesCount = forwardMessages.size
// 🔥 Функция для красивого закрытия с анимацией
fun dismissWithAnimation() {
scope.launch {
sheetState.hide()
onDismiss()
}
}
ModalBottomSheet(
onDismissRequest = onDismiss,
onDismissRequest = { dismissWithAnimation() },
sheetState = sheetState,
containerColor = backgroundColor,
dragHandle = {
@@ -96,11 +107,13 @@ fun ForwardChatPickerBottomSheet(
Row(
verticalAlignment = Alignment.CenterVertically
) {
// 🔥 Красивая иконка Forward
Icon(
Icons.Default.Forward,
Icons.Filled.ArrowForward,
contentDescription = null,
tint = PrimaryBlue,
modifier = Modifier.size(24.dp)
modifier = Modifier
.size(24.dp)
)
Spacer(modifier = Modifier.width(12.dp))
Column {
@@ -118,8 +131,8 @@ fun ForwardChatPickerBottomSheet(
}
}
// Кнопка закрытия
IconButton(onClick = onDismiss) {
// Кнопка закрытия с анимацией
IconButton(onClick = { dismissWithAnimation() }) {
Icon(
Icons.Default.Close,
contentDescription = "Close",