Skip to content

Commit

Permalink
[1.39.*] Pre-release merge (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
tramline-github[bot] authored Jan 19, 2024
2 parents 7a38a7e + 512fcc2 commit f529c80
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ package dev.sasikanth.rss.reader.feeds
sealed interface FeedsEffect {

data object MinimizeSheet : FeedsEffect

data object SelectedFeedChanged : FeedsEffect
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ class FeedsPresenter(
if (_state.value.selectedFeed?.link != feed.link) {
observableSelectedFeed.selectFeed(feed)
}

effects.emit(FeedsEffect.SelectedFeedChanged)
effects.emit(FeedsEffect.MinimizeSheet)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ internal fun FeedsBottomSheet(
feedsSheetMode: FeedsSheetMode,
closeSheet: () -> Unit,
editFeeds: () -> Unit,
exitFeedsEdit: () -> Unit
exitFeedsEdit: () -> Unit,
selectedFeedChanged: () -> Unit
) {
val state by feedsPresenter.state.collectAsState()
val selectedFeed = state.selectedFeed
Expand All @@ -114,6 +115,7 @@ internal fun FeedsBottomSheet(
feedsPresenter.effects.collect { effect ->
when (effect) {
FeedsEffect.MinimizeSheet -> closeSheet()
FeedsEffect.SelectedFeedChanged -> selectedFeedChanged()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.coerceIn
import androidx.compose.ui.unit.dp
import androidx.paging.LoadState
import app.cash.paging.compose.collectAsLazyPagingItems
Expand Down Expand Up @@ -154,11 +153,6 @@ internal fun HomeScreen(homePresenter: HomePresenter, modifier: Modifier = Modif
}
}

LaunchedEffect(state.selectedFeed) {
listState.scrollToItem(0)
featuredPostsPagerState.scrollToPage(0)
}

LaunchedEffect(bottomSheetState.targetValue) {
if (bottomSheetState.targetValue == BottomSheetValue.Collapsed) {
homePresenter.dispatch(HomeEvent.OnCancelAddFeedClicked)
Expand Down Expand Up @@ -204,7 +198,13 @@ internal fun HomeScreen(homePresenter: HomePresenter, modifier: Modifier = Modif
feedsSheetMode = state.feedsSheetMode,
closeSheet = { coroutineScope.launch { bottomSheetState.collapse() } },
editFeeds = { homePresenter.dispatch(HomeEvent.EditFeedsClicked) },
exitFeedsEdit = { homePresenter.dispatch(HomeEvent.ExitFeedsEdit) }
exitFeedsEdit = { homePresenter.dispatch(HomeEvent.ExitFeedsEdit) },
selectedFeedChanged = {
coroutineScope.launch {
listState.scrollToItem(0)
featuredPostsPagerState.scrollToPage(0)
}
}
)
},
snackbarHost = {
Expand Down

0 comments on commit f529c80

Please sign in to comment.