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:
@@ -309,6 +309,11 @@ object CryptoManager {
|
|||||||
// Decompress (zlib inflate - совместимо с pako.inflate в JS)
|
// Decompress (zlib inflate - совместимо с pako.inflate в JS)
|
||||||
String(decompress(decrypted), Charsets.UTF_8)
|
String(decompress(decrypted), Charsets.UTF_8)
|
||||||
} catch (e: Exception) {
|
} 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
|
null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1079,11 +1079,11 @@ fun ChatDetailScreen(
|
|||||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
// Reply button
|
// Reply button - идентичной высоты с инпутом
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.height(40.dp)
|
.height(48.dp)
|
||||||
.clip(RoundedCornerShape(12.dp))
|
.clip(RoundedCornerShape(12.dp))
|
||||||
.background(PrimaryBlue.copy(alpha = 0.1f))
|
.background(PrimaryBlue.copy(alpha = 0.1f))
|
||||||
.clickable {
|
.clickable {
|
||||||
@@ -1115,11 +1115,11 @@ fun ChatDetailScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forward button - открывает выбор чата (как в десктопе)
|
// Forward button - идентичной высоты с инпутом
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.height(40.dp)
|
.height(48.dp)
|
||||||
.clip(RoundedCornerShape(12.dp))
|
.clip(RoundedCornerShape(12.dp))
|
||||||
.background(PrimaryBlue.copy(alpha = 0.1f))
|
.background(PrimaryBlue.copy(alpha = 0.1f))
|
||||||
.clickable {
|
.clickable {
|
||||||
@@ -2481,11 +2481,33 @@ private fun MessageInputBar(
|
|||||||
.padding(bottom = if (isKeyboardVisible || coordinator.isEmojiBoxVisible) 0.dp else 16.dp)
|
.padding(bottom = if (isKeyboardVisible || coordinator.isEmojiBoxVisible) 0.dp else 16.dp)
|
||||||
.then(if (shouldAddNavBarPadding) Modifier.navigationBarsPadding() else Modifier)
|
.then(if (shouldAddNavBarPadding) Modifier.navigationBarsPadding() else Modifier)
|
||||||
) {
|
) {
|
||||||
// REPLY PANEL
|
// REPLY PANEL - плавная анимация появления/исчезновения
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = hasReply,
|
visible = hasReply,
|
||||||
enter = fadeIn(tween(100)) + expandVertically(animationSpec = tween(100)),
|
enter = fadeIn(
|
||||||
exit = fadeOut(tween(0)) + shrinkVertically(animationSpec = tween(0))
|
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(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
@@ -1032,11 +1032,8 @@ class ChatViewModel(application: Application) : AndroidViewModel(application) {
|
|||||||
_messages.value = _messages.value + optimisticMessage
|
_messages.value = _messages.value + optimisticMessage
|
||||||
_inputText.value = ""
|
_inputText.value = ""
|
||||||
|
|
||||||
// Очищаем reply ПОСЛЕ добавления сообщения в список с небольшой задержкой
|
// Очищаем reply сразу после добавления сообщения в список
|
||||||
viewModelScope.launch {
|
|
||||||
kotlinx.coroutines.delay(300)
|
|
||||||
clearReplyMessages()
|
clearReplyMessages()
|
||||||
}
|
|
||||||
|
|
||||||
// Кэшируем текст
|
// Кэшируем текст
|
||||||
decryptionCache[messageId] = text
|
decryptionCache[messageId] = text
|
||||||
|
|||||||
@@ -10,12 +10,13 @@ import androidx.compose.foundation.shape.CircleShape
|
|||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Close
|
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.material3.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
|
import androidx.compose.ui.draw.rotate
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
@@ -23,6 +24,7 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.rosetta.messenger.data.ForwardManager
|
import com.rosetta.messenger.data.ForwardManager
|
||||||
import com.rosetta.messenger.ui.onboarding.PrimaryBlue
|
import com.rosetta.messenger.ui.onboarding.PrimaryBlue
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
@@ -45,6 +47,7 @@ fun ForwardChatPickerBottomSheet(
|
|||||||
val sheetState = rememberModalBottomSheetState(
|
val sheetState = rememberModalBottomSheetState(
|
||||||
skipPartiallyExpanded = false
|
skipPartiallyExpanded = false
|
||||||
)
|
)
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
|
||||||
val backgroundColor = if (isDarkTheme) Color(0xFF1C1C1E) else Color.White
|
val backgroundColor = if (isDarkTheme) Color(0xFF1C1C1E) else Color.White
|
||||||
val textColor = if (isDarkTheme) Color.White else Color.Black
|
val textColor = if (isDarkTheme) Color.White else Color.Black
|
||||||
@@ -54,8 +57,16 @@ fun ForwardChatPickerBottomSheet(
|
|||||||
val forwardMessages by ForwardManager.forwardMessages.collectAsState()
|
val forwardMessages by ForwardManager.forwardMessages.collectAsState()
|
||||||
val messagesCount = forwardMessages.size
|
val messagesCount = forwardMessages.size
|
||||||
|
|
||||||
|
// 🔥 Функция для красивого закрытия с анимацией
|
||||||
|
fun dismissWithAnimation() {
|
||||||
|
scope.launch {
|
||||||
|
sheetState.hide()
|
||||||
|
onDismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ModalBottomSheet(
|
ModalBottomSheet(
|
||||||
onDismissRequest = onDismiss,
|
onDismissRequest = { dismissWithAnimation() },
|
||||||
sheetState = sheetState,
|
sheetState = sheetState,
|
||||||
containerColor = backgroundColor,
|
containerColor = backgroundColor,
|
||||||
dragHandle = {
|
dragHandle = {
|
||||||
@@ -96,11 +107,13 @@ fun ForwardChatPickerBottomSheet(
|
|||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
|
// 🔥 Красивая иконка Forward
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Default.Forward,
|
Icons.Filled.ArrowForward,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = PrimaryBlue,
|
tint = PrimaryBlue,
|
||||||
modifier = Modifier.size(24.dp)
|
modifier = Modifier
|
||||||
|
.size(24.dp)
|
||||||
)
|
)
|
||||||
Spacer(modifier = Modifier.width(12.dp))
|
Spacer(modifier = Modifier.width(12.dp))
|
||||||
Column {
|
Column {
|
||||||
@@ -118,8 +131,8 @@ fun ForwardChatPickerBottomSheet(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Кнопка закрытия
|
// Кнопка закрытия с анимацией
|
||||||
IconButton(onClick = onDismiss) {
|
IconButton(onClick = { dismissWithAnimation() }) {
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Default.Close,
|
Icons.Default.Close,
|
||||||
contentDescription = "Close",
|
contentDescription = "Close",
|
||||||
|
|||||||
Reference in New Issue
Block a user