feat: Add delivery confirmation for incoming messages in ProtocolManager

This commit is contained in:
k1ngsterr1
2026-01-12 14:47:36 +05:00
parent a7976c7cf3
commit 99121ce996
11 changed files with 413 additions and 153 deletions

View File

@@ -5,6 +5,7 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.animation.*
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
@@ -220,29 +221,38 @@ fun MainScreen(
// Навигация между экранами
var selectedUser by remember { mutableStateOf<SearchUser?>(null) }
// Анимированный переход между чатами
// Анимированный переход между чатами - плавный crossfade без прыжков
AnimatedContent(
targetState = selectedUser,
transitionSpec = {
if (targetState != null) {
// Открытие чата - слайд слева
slideInHorizontally(
initialOffsetX = { it },
animationSpec = tween(300)
) togetherWith slideOutHorizontally(
targetOffsetX = { -it / 3 },
animationSpec = tween(300)
// Плавный crossfade для избежания "прыжков" header'а
val enterAnim = fadeIn(
animationSpec = tween(
durationMillis = 250,
easing = FastOutSlowInEasing
)
} else {
// Закрытие чата - слайд справа
slideInHorizontally(
initialOffsetX = { -it / 3 },
animationSpec = tween(300)
) togetherWith slideOutHorizontally(
targetOffsetX = { it },
animationSpec = tween(300)
) + slideInHorizontally(
initialOffsetX = { if (targetState != null) it / 4 else -it / 4 },
animationSpec = tween(
durationMillis = 300,
easing = FastOutSlowInEasing
)
}
)
val exitAnim = fadeOut(
animationSpec = tween(
durationMillis = 200,
easing = FastOutSlowInEasing
)
) + slideOutHorizontally(
targetOffsetX = { if (targetState != null) -it / 6 else it / 6 },
animationSpec = tween(
durationMillis = 300,
easing = FastOutSlowInEasing
)
)
enterAnim togetherWith exitAnim using SizeTransform(clip = false)
},
label = "chatNavigation"
) { user ->