feat: Enhance ProtocolManager logging and error handling; optimize emoji picker performance
This commit is contained in:
@@ -36,6 +36,7 @@ import coil.request.ImageRequest
|
||||
import com.rosetta.messenger.ui.onboarding.PrimaryBlue
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
/**
|
||||
@@ -505,14 +506,8 @@ fun EmojiButton(
|
||||
val interactionSource = remember { MutableInteractionSource() }
|
||||
val isPressed by interactionSource.collectIsPressedAsState()
|
||||
|
||||
val scale by animateFloatAsState(
|
||||
targetValue = if (isPressed) 0.85f else 1f,
|
||||
animationSpec = spring(
|
||||
dampingRatio = Spring.DampingRatioMediumBouncy,
|
||||
stiffness = Spring.StiffnessHigh
|
||||
),
|
||||
label = "emojiScale"
|
||||
)
|
||||
// 🚀 Убираем анимацию scale для производительности
|
||||
val scale = if (isPressed) 0.85f else 1f
|
||||
|
||||
val imageRequest = remember(unified) {
|
||||
ImageRequest.Builder(context)
|
||||
@@ -613,11 +608,15 @@ fun AppleEmojiPickerPanel(
|
||||
var selectedCategory by remember { mutableStateOf(EMOJI_CATEGORIES[0]) }
|
||||
val gridState = rememberLazyGridState()
|
||||
|
||||
// Загружаем эмодзи если еще не загружены (синхронно из кеша если уже загружено)
|
||||
LaunchedEffect(Unit) {
|
||||
// 🚀 Предзагружаем эмодзи СИНХРОННО при создании компонента
|
||||
val emojisReady = remember {
|
||||
if (!EmojiCache.isLoaded) {
|
||||
EmojiCache.loadEmojis(context)
|
||||
// Загружаем синхронно для мгновенного отображения
|
||||
runBlocking {
|
||||
EmojiCache.loadEmojis(context)
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
// Текущие эмодзи для выбранной категории - используем derivedStateOf для оптимизации
|
||||
@@ -631,7 +630,7 @@ fun AppleEmojiPickerPanel(
|
||||
}
|
||||
}
|
||||
|
||||
// Сбрасываем скролл при смене категории
|
||||
// 🚀 Убираем анимацию скролла для мгновенного переключения категорий
|
||||
LaunchedEffect(selectedCategory) {
|
||||
gridState.scrollToItem(0)
|
||||
}
|
||||
@@ -700,6 +699,7 @@ fun AppleEmojiPickerPanel(
|
||||
)
|
||||
}
|
||||
} else {
|
||||
// 🚀 Оптимизированная LazyVerticalGrid для быстрого рендеринга
|
||||
LazyVerticalGrid(
|
||||
state = gridState,
|
||||
columns = GridCells.Fixed(8),
|
||||
|
||||
Reference in New Issue
Block a user