Fix detekt issues

This commit is contained in:
Benoit Marty
2024-04-26 15:23:24 +02:00
parent ee7f0bac8b
commit 9b4fa0f03d
4 changed files with 9 additions and 3 deletions

View File

@@ -235,6 +235,7 @@ private fun BoxScope.TimelineScrollHelper(
}
}
val latestOnClearFocusRequestState by rememberUpdatedState(onClearFocusRequestState)
LaunchedEffect(focusRequestState) {
if (focusRequestState is FocusRequestState.Cached) {
if (abs(lazyListState.firstVisibleItemIndex - focusRequestState.index) < 10) {
@@ -242,7 +243,7 @@ private fun BoxScope.TimelineScrollHelper(
} else {
lazyListState.scrollToItem(focusRequestState.index)
}
onClearFocusRequestState()
latestOnClearFocusRequestState()
}
}

View File

@@ -135,6 +135,7 @@ internal fun TimelineItemRow(
}
}
@Suppress("ModifierComposable")
@Composable
private fun Modifier.focusedEvent(
focusedEventOffset: Dp

View File

@@ -20,6 +20,8 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Spacer
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Modifier
import io.element.android.features.messages.impl.timeline.TimelineEvents
import io.element.android.features.messages.impl.timeline.TimelineRoomInfo
@@ -51,8 +53,9 @@ fun TimelineItemVirtualRow(
TimelineItemRoomBeginningModel -> TimelineItemRoomBeginningView(roomName = timelineRoomInfo.name)
is TimelineItemLoadingIndicatorModel -> {
TimelineLoadingMoreIndicator(virtual.model.direction)
val latestEventSink by rememberUpdatedState(eventSink)
LaunchedEffect(virtual.model.timestamp) {
eventSink(TimelineEvents.LoadMore(virtual.model.direction))
latestEventSink(TimelineEvents.LoadMore(virtual.model.direction))
}
}
is TimelineItemLastForwardIndicatorModel -> {

View File

@@ -222,7 +222,8 @@ class RustTimeline(
isDm = matrixRoom.isDm,
hasMoreToLoadBackwards = hasMoreToLoadBackward
)
}.let { items -> loadingIndicatorsPostProcessor.process(items, hasMoreToLoadBackward, hasMoreToLoadForward) }
}
.let { items -> loadingIndicatorsPostProcessor.process(items, hasMoreToLoadBackward, hasMoreToLoadForward) }
// Keep lastForwardIndicatorsPostProcessor last
.let { items -> lastForwardIndicatorsPostProcessor.process(items) }
}