common: add PostActions#viewCommentsPage

This commit is contained in:
Harsh Shandilya 2021-10-25 00:48:53 +05:30
parent 53905c80de
commit 4573f82f50
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
3 changed files with 9 additions and 0 deletions

View file

@ -78,6 +78,10 @@ fun LobstersApp(
navController.navigate(Destinations.Comments.format(postId)) navController.navigate(Destinations.Comments.format(postId))
} }
override fun viewCommentsPage(commentsUrl: String) {
urlLauncher.launch(commentsUrl)
}
override fun toggleSave(post: SavedPost) { override fun toggleSave(post: SavedPost) {
viewModel.toggleSave(post) viewModel.toggleSave(post)
} }

View file

@ -5,5 +5,6 @@ import dev.msfjarvis.claw.database.local.SavedPost
interface PostActions { interface PostActions {
fun viewPost(postUrl: String, commentsUrl: String) fun viewPost(postUrl: String, commentsUrl: String)
fun viewComments(postId: String) fun viewComments(postId: String)
fun viewCommentsPage(commentsUrl: String)
fun toggleSave(post: SavedPost) fun toggleSave(post: SavedPost)
} }

View file

@ -44,6 +44,10 @@ fun main() = application {
urlLauncher.launch("${LobstersApi.BASE_URL}/s/${postId}") urlLauncher.launch("${LobstersApi.BASE_URL}/s/${postId}")
} }
override fun viewCommentsPage(commentsUrl: String) {
urlLauncher.launch(commentsUrl)
}
override fun toggleSave(post: SavedPost) {} override fun toggleSave(post: SavedPost) {}
} }
} }