From 58bab2f53837457c448975cb5a949b27ea174c39 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 30 Sep 2023 02:45:43 +0530 Subject: [PATCH] refactor(android): DRY --- .../dev/msfjarvis/claw/android/glance/WidgetListEntry.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/android/src/main/kotlin/dev/msfjarvis/claw/android/glance/WidgetListEntry.kt b/android/src/main/kotlin/dev/msfjarvis/claw/android/glance/WidgetListEntry.kt index 9f31018f..f9242469 100644 --- a/android/src/main/kotlin/dev/msfjarvis/claw/android/glance/WidgetListEntry.kt +++ b/android/src/main/kotlin/dev/msfjarvis/claw/android/glance/WidgetListEntry.kt @@ -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(actionParametersOf(destinationKey to post.shortId)) - } val commentsAction = actionStartActivity(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,