Skip to content

Commit

Permalink
fix: change timeline type in homepage (#782)
Browse files Browse the repository at this point in the history
* fix visual bug introduced by #781 in post detail

* fix: ignore loading state when changing timeline type
  • Loading branch information
AkesiSeli authored Feb 1, 2025
1 parent de7184e commit 06f9cbb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ class EntryDetailScreen(
},
) {
LazyColumn(
modifier = Modifier.fillMaxSize(),
state = lazyListState,
) {
itemsIndexed(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,10 +564,11 @@ class TimelineScreen : Screen {
}

if (timelineTypeSelectorOpen) {
val items = uiState.availableTimelineTypes
CustomModalBottomSheet(
title = LocalStrings.current.feedTypeTitle,
items =
uiState.availableTimelineTypes.map {
items.map {
CustomModalBottomSheetItem(
label = it.toReadableName(),
trailingContent = {
Expand All @@ -583,7 +584,7 @@ class TimelineScreen : Screen {
onSelected = { index ->
timelineTypeSelectorOpen = false
if (index != null) {
val type = uiState.availableTimelineTypes[index]
val type = items[index]
model.reduce(TimelineMviModel.Intent.ChangeType(type))
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import com.livefast.eattrash.raccoonforfriendica.core.utils.vibrate.HapticFeedba
import com.livefast.eattrash.raccoonforfriendica.domain.content.data.TimelineEntryModel
import com.livefast.eattrash.raccoonforfriendica.domain.content.data.TimelineType
import com.livefast.eattrash.raccoonforfriendica.domain.content.data.blurHashParamsForPreload
import com.livefast.eattrash.raccoonforfriendica.domain.content.data.nodeName
import com.livefast.eattrash.raccoonforfriendica.domain.content.data.original
import com.livefast.eattrash.raccoonforfriendica.domain.content.data.toTimelineType
import com.livefast.eattrash.raccoonforfriendica.domain.content.data.urlsForPreload
Expand Down Expand Up @@ -208,10 +207,6 @@ class TimelineViewModel(
}

private suspend fun changeTimelineType(type: TimelineType) {
if (uiState.value.loading) {
return
}

updateState {
it.copy(
initial = true,
Expand Down

0 comments on commit 06f9cbb

Please sign in to comment.