Skip to content

Commit

Permalink
[1.134.*] Pre-release merge (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
tramline-github[bot] authored Apr 18, 2024
2 parents d289684 + 876538f commit 86e2603
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.distinctUntilChangedBy
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
Expand Down Expand Up @@ -263,17 +264,17 @@ class HomePresenter(
}
}

rssRepository.featuredPosts(
selectedFeedId = activeSource?.id,
unreadOnly = unreadOnly,
after = postsAfter
)
rssRepository
.featuredPosts(
selectedFeedId = activeSource?.id,
unreadOnly = unreadOnly,
after = postsAfter
)
.map { Triple(it, postsType, activeSource) }
}
.distinctUntilChanged()
.onEach { featuredPosts ->
.distinctUntilChangedBy { (featuredPosts, _, _) -> featuredPosts }
.onEach { (featuredPosts, postsType, activeSource) ->
val featuredPostIds = featuredPosts.map { it.id }
val postsType = _state.value.postsType
val activeSource = _state.value.activeSource

val unreadOnly =
when (postsType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ internal fun HomeScreen(homePresenter: HomePresenter, modifier: Modifier = Modif

val listState = rememberLazyListState()
val featuredPostsPagerState = rememberPagerState(pageCount = { state.featuredPosts?.size ?: 0 })
val showScrollToTop by remember { derivedStateOf { listState.firstVisibleItemIndex > 1 } }

val strings = LocalStrings.current
val linkHandler = LocalLinkHandler.current
Expand Down Expand Up @@ -144,7 +145,6 @@ internal fun HomeScreen(homePresenter: HomePresenter, modifier: Modifier = Modif
val sheetPeekHeight =
BOTTOM_SHEET_PEEK_HEIGHT +
WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding()
val showScrollToTop by remember { derivedStateOf { listState.firstVisibleItemIndex > 0 } }

BottomSheetScaffold(
modifier =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,20 @@ internal fun PostsList(
state = listState,
contentPadding = PaddingValues(top = topContentPadding, bottom = 128.dp)
) {
item {
FeaturedSection(
paddingValues = paddingValues,
pagerState = featuredPostsPagerState,
featuredPosts = featuredPosts,
featuredItemBlurEnabled = featuredItemBlurEnabled,
onItemClick = onPostClicked,
onPostBookmarkClick = onPostBookmarkClick,
onPostCommentsClick = onPostCommentsClick,
onPostSourceClick = onPostSourceClick,
onTogglePostReadClick = onTogglePostReadClick
)
if (featuredPosts.isNotEmpty()) {
item {
FeaturedSection(
paddingValues = paddingValues,
pagerState = featuredPostsPagerState,
featuredPosts = featuredPosts,
featuredItemBlurEnabled = featuredItemBlurEnabled,
onItemClick = onPostClicked,
onPostBookmarkClick = onPostBookmarkClick,
onPostCommentsClick = onPostCommentsClick,
onPostSourceClick = onPostSourceClick,
onTogglePostReadClick = onTogglePostReadClick
)
}
}

items(posts.itemCount) { index ->
Expand Down

0 comments on commit 86e2603

Please sign in to comment.