mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 19:17:02 +05:30
feat(android): feature flag "read posts" feature
This commit is contained in:
parent
bc3a1266f4
commit
fcd85dc8e1
2 changed files with 17 additions and 2 deletions
|
@ -12,6 +12,7 @@ import androidx.activity.ComponentActivity
|
|||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.navigation.NavController
|
||||
import dev.msfjarvis.claw.android.BuildConfig
|
||||
import dev.msfjarvis.claw.android.ui.navigation.Destinations
|
||||
import dev.msfjarvis.claw.android.viewmodel.ClawViewModel
|
||||
import dev.msfjarvis.claw.common.posts.PostActions
|
||||
|
@ -37,12 +38,16 @@ fun rememberPostActions(
|
|||
return remember {
|
||||
object : PostActions {
|
||||
override fun viewPost(postId: String, postUrl: String, commentsUrl: String) {
|
||||
viewModel.markPostAsRead(postId)
|
||||
if (BuildConfig.ENABLE_READ_COMMENTS) {
|
||||
viewModel.markPostAsRead(postId)
|
||||
}
|
||||
urlLauncher.openUri(postUrl.ifEmpty { commentsUrl })
|
||||
}
|
||||
|
||||
override fun viewComments(postId: String) {
|
||||
viewModel.markPostAsRead(postId)
|
||||
if (BuildConfig.ENABLE_READ_COMMENTS) {
|
||||
viewModel.markPostAsRead(postId)
|
||||
}
|
||||
val currentRoute = navController.currentDestination?.route
|
||||
val newRoute =
|
||||
Destinations.Comments.route.replace(Destinations.Comments.placeholder, postId)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue