Skip to content

Commit

Permalink
Filter posts based on feed when post source is clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Oct 10, 2023
1 parent 1f5015a commit e686fb0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ sealed interface HomeEvent {

data class OnPostClicked(val post: PostWithMetadata) : HomeEvent

data class OnPostSourceClicked(val feedLink: String) : HomeEvent

data class FeedsSheetStateChanged(val feedsSheetState: BottomSheetValue) : HomeEvent

object OnHomeSelected : HomeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,14 @@ class HomePresenter(
}
HomeEvent.EditFeedsClicked -> editFeedsClicked()
HomeEvent.ExitFeedsEdit -> exitFeedsEdit()
is HomeEvent.OnPostSourceClicked -> postSourceClicked(event.feedLink)
}
}

private fun postSourceClicked(feedLink: String) {
coroutineScope.launch {
val feed = rssRepository.feed(feedLink)
observableSelectedFeed.selectFeed(feed)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ fun HomeScreen(
onPostClicked = { homePresenter.dispatch(HomeEvent.OnPostClicked(it)) },
onPostBookmarkClick = { homePresenter.dispatch(HomeEvent.OnPostBookmarkClick(it)) },
onPostCommentsClick = { commentsLink -> openLink(commentsLink) },
onPostSourceClick = {
// TODO
onPostSourceClick = { feedLink ->
homePresenter.dispatch(HomeEvent.OnPostSourceClicked(feedLink))
},
onNoFeedsSwipeUp = { coroutineScope.launch { bottomSheetState.expand() } },
)
Expand Down

0 comments on commit e686fb0

Please sign in to comment.