feat: add avatar presence handling in OtherProfileScreen for improved scroll behavior
This commit is contained in:
@@ -536,9 +536,11 @@ class ChatsListViewModel(application: Application) : AndroidViewModel(applicatio
|
||||
// 🔥 Обновляем счетчик requests
|
||||
_requestsCount.value = _requests.value.size
|
||||
|
||||
// Вычисляем правильный dialog_key (отсортированная комбинация ключей)
|
||||
// Вычисляем правильный dialog_key
|
||||
val dialogKey =
|
||||
if (currentAccount < opponentKey) {
|
||||
if (currentAccount == opponentKey) {
|
||||
currentAccount // 📁 Saved Messages
|
||||
} else if (currentAccount < opponentKey) {
|
||||
"$currentAccount:$opponentKey"
|
||||
} else {
|
||||
"$opponentKey:$currentAccount"
|
||||
|
||||
@@ -62,11 +62,15 @@ fun SearchScreen(
|
||||
val view = LocalView.current
|
||||
val focusManager = LocalFocusManager.current
|
||||
if (!view.isInEditMode) {
|
||||
SideEffect {
|
||||
DisposableEffect(isDarkTheme) {
|
||||
val window = (view.context as android.app.Activity).window
|
||||
val insetsController = androidx.core.view.WindowCompat.getInsetsController(window, view)
|
||||
insetsController.isAppearanceLightStatusBars = !isDarkTheme
|
||||
window.statusBarColor = android.graphics.Color.TRANSPARENT
|
||||
onDispose {
|
||||
// Restore white status bar icons for chat list header
|
||||
insetsController.isAppearanceLightStatusBars = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -227,12 +227,28 @@ fun MessageInputBar(
|
||||
},
|
||||
hideEmoji = { onToggleEmojiPicker(false) }
|
||||
)
|
||||
} else {
|
||||
// KEYBOARD → EMOJI
|
||||
} else if (coordinator.isKeyboardVisible || coordinator.keyboardHeight > 0.dp) {
|
||||
// KEYBOARD → EMOJI (клавиатура открыта)
|
||||
coordinator.requestShowEmoji(
|
||||
hideKeyboard = { imm.hideSoftInputFromWindow(view.windowToken, 0) },
|
||||
showEmoji = { onToggleEmojiPicker(true) }
|
||||
)
|
||||
} else {
|
||||
// Клавиатура НЕ открыта → открываем emoji напрямую
|
||||
// Устанавливаем высоту из сохранённой или дефолт
|
||||
if (coordinator.emojiHeight == 0.dp) {
|
||||
val savedPx = com.rosetta.messenger.ui.components.KeyboardHeightProvider
|
||||
.getSavedKeyboardHeight(context)
|
||||
if (savedPx > 0) {
|
||||
coordinator.emojiHeight = with(density) { savedPx.toDp() }
|
||||
} else {
|
||||
coordinator.emojiHeight = 300.dp // разумный дефолт
|
||||
}
|
||||
}
|
||||
coordinator.isEmojiBoxVisible = true
|
||||
coordinator.openEmojiOnly(
|
||||
showEmoji = { onToggleEmojiPicker(true) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -420,11 +420,18 @@ fun OtherProfileScreen(
|
||||
}
|
||||
}
|
||||
|
||||
// DEBUG LOGS
|
||||
// Коллапс при отсутствии аватара
|
||||
LaunchedEffect(hasAvatar) {
|
||||
if (!hasAvatar) {
|
||||
isPulledDown = false
|
||||
overscrollOffset = 0f
|
||||
}
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
// NESTED SCROLL - Telegram style with overscroll support
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
val nestedScrollConnection = remember {
|
||||
val nestedScrollConnection = remember(hasAvatar) {
|
||||
object : NestedScrollConnection {
|
||||
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
|
||||
val delta = available.y
|
||||
@@ -474,8 +481,8 @@ fun OtherProfileScreen(
|
||||
available: Offset,
|
||||
source: NestedScrollSource
|
||||
): Offset {
|
||||
// Overscroll при свайпе вниз от верха
|
||||
if (available.y > 0 && scrollOffset == 0f) {
|
||||
// Overscroll при свайпе вниз от верха (только если есть аватар)
|
||||
if (available.y > 0 && scrollOffset == 0f && hasAvatar) {
|
||||
// Telegram: сопротивление если ещё не isPulledDown
|
||||
val resistance = if (isPulledDown) 1f else 0.5f
|
||||
val delta = available.y * resistance
|
||||
|
||||
@@ -71,7 +71,7 @@ fun RosettaAndroidTheme(
|
||||
val insetsController = WindowCompat.getInsetsController(window, view)
|
||||
// Make status bar transparent for wave animation overlay
|
||||
window.statusBarColor = AndroidColor.TRANSPARENT
|
||||
insetsController.isAppearanceLightStatusBars = !darkTheme
|
||||
// Note: isAppearanceLightStatusBars is managed per-screen, not globally
|
||||
|
||||
// Navigation bar: показываем только если есть нативные кнопки
|
||||
NavigationModeUtils.applyNavigationBarVisibility(insetsController, context, darkTheme)
|
||||
|
||||
Reference in New Issue
Block a user