diff --git a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/HomeEvent.kt b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/HomeEvent.kt index 1b9069154..dd44a90c6 100644 --- a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/HomeEvent.kt +++ b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/HomeEvent.kt @@ -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 diff --git a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/HomePresenter.kt b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/HomePresenter.kt index b86ad8c7d..535af5835 100644 --- a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/HomePresenter.kt +++ b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/HomePresenter.kt @@ -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) } } diff --git a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/ui/HomeScreen.kt b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/ui/HomeScreen.kt index 5351125b4..d90b3957f 100644 --- a/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/ui/HomeScreen.kt +++ b/shared/src/commonMain/kotlin/dev/sasikanth/rss/reader/home/ui/HomeScreen.kt @@ -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() } }, )