Timeline : rename isTimelineEmpty to hasAnyEvent
This commit is contained in:
parent
0e98659cc9
commit
6632b2a998
2 changed files with 5 additions and 7 deletions
|
|
@ -33,7 +33,7 @@ data class TimelineState(
|
|||
val focusRequestState: FocusRequestState,
|
||||
val eventSink: (TimelineEvents) -> Unit,
|
||||
){
|
||||
val isTimelineEmpty = timelineItems.none { it is TimelineItem.Event }
|
||||
val hasAnyEvent = timelineItems.any { it is TimelineItem.Event }
|
||||
}
|
||||
|
||||
sealed interface FocusRequestState {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
package io.element.android.features.messages.impl.timeline
|
||||
|
||||
import android.view.accessibility.AccessibilityManager
|
||||
import androidx.activity.compose.BackHandler
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.ExperimentalAnimationApi
|
||||
import androidx.compose.animation.core.tween
|
||||
|
|
@ -75,7 +74,6 @@ import io.element.android.libraries.matrix.api.core.EventId
|
|||
import io.element.android.libraries.matrix.api.core.UserId
|
||||
import io.element.android.libraries.ui.strings.CommonStrings
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
import kotlin.math.abs
|
||||
|
||||
@Composable
|
||||
|
|
@ -166,7 +164,7 @@ fun TimelineView(
|
|||
)
|
||||
|
||||
TimelineScrollHelper(
|
||||
isTimelineEmpty = state.isTimelineEmpty,
|
||||
hasAnyEvent = state.hasAnyEvent,
|
||||
lazyListState = lazyListState,
|
||||
forceJumpToBottomVisibility = forceJumpToBottomVisibility,
|
||||
newEventState = state.newEventState,
|
||||
|
|
@ -203,7 +201,7 @@ private fun FocusRequestStateView(
|
|||
|
||||
@Composable
|
||||
private fun BoxScope.TimelineScrollHelper(
|
||||
isTimelineEmpty: Boolean,
|
||||
hasAnyEvent: Boolean,
|
||||
lazyListState: LazyListState,
|
||||
newEventState: NewEventState,
|
||||
isLive: Boolean,
|
||||
|
|
@ -258,8 +256,8 @@ private fun BoxScope.TimelineScrollHelper(
|
|||
}
|
||||
|
||||
val latestOnScrollFinishedAt by rememberUpdatedState(onScrollFinishedAt)
|
||||
LaunchedEffect(isScrollFinished, isTimelineEmpty) {
|
||||
if (isScrollFinished && !isTimelineEmpty) {
|
||||
LaunchedEffect(isScrollFinished, hasAnyEvent) {
|
||||
if (isScrollFinished && hasAnyEvent) {
|
||||
// Notify the parent composable about the first visible item index when scrolling finishes
|
||||
latestOnScrollFinishedAt(lazyListState.firstVisibleItemIndex)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue