refactor(android): DRY

This commit is contained in:
Harsh Shandilya 2023-09-30 02:45:43 +05:30
parent cf93eda6c1
commit 58bab2f538
No known key found for this signature in database

View file

@ -44,14 +44,11 @@ fun WidgetListEntry(
) {
val titleStyle = MaterialTheme.typography.titleMedium
val subtitleStyle = MaterialTheme.typography.labelLarge
val postAction =
if (post.url.isNotEmpty()) {
actionStartActivity(Intent(Intent.ACTION_VIEW, Uri.parse(post.url)))
} else {
actionStartActivity<MainActivity>(actionParametersOf(destinationKey to post.shortId))
}
val commentsAction =
actionStartActivity<MainActivity>(actionParametersOf(destinationKey to post.shortId))
val postAction =
if (post.url.isNotEmpty()) actionStartActivity(Intent(Intent.ACTION_VIEW, Uri.parse(post.url)))
else commentsAction
Box(modifier.padding(8.dp)) {
Row(
verticalAlignment = Alignment.CenterVertically,