Skip to content

Commit

Permalink
fix(ui): prefetch articleid before mark as read
Browse files Browse the repository at this point in the history
  • Loading branch information
JunkFood02 committed Feb 7, 2024
1 parent 1b758df commit 38ab828
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,16 @@ fun ReadingPage(
}
}

LaunchedEffect(readerState.articleId) {
Log.i("RLog", "ReadPage: ${readingUiState.articleWithFeed}")
readerState.articleId?.let {
LaunchedEffect(readerState.articleId, pagingItems.size) {
if (pagingItems.isNotEmpty() && readerState.articleId != null) {
// Log.i("RLog", "ReadPage: ${readingUiState.articleWithFeed}")
readingViewModel.prefetchArticleId(pagingItems)
if (readingUiState.isUnread) {
readingViewModel.markAsRead()
}
}
}

LaunchedEffect(readerState.articleId, pagingItems.size) {
if (pagingItems.isNotEmpty() && readerState.articleId != null)
readingViewModel.prefetchArticleId(pagingItems)
}

Scaffold(
containerColor = MaterialTheme.colorScheme.surface,
// topBarTonalElevation = tonalElevation.value.dp,
Expand Down

0 comments on commit 38ab828

Please sign in to comment.