fix(widget): open comments screen directly for lobsters-native posts

Fixes COMPOSE-LOBSTERS-2P
This commit is contained in:
Harsh Shandilya 2024-03-16 18:01:30 +05:30
parent 7762733da2
commit 5c0b5bb4f7
2 changed files with 8 additions and 2 deletions

View file

@ -43,9 +43,10 @@ fun WidgetListEntry(post: UIPost, modifier: GlanceModifier = GlanceModifier) {
val titleStyle = MaterialTheme.typography.titleMedium
val commentsAction =
actionStartActivity<MainActivity>(actionParametersOf(destinationKey to post.shortId))
// If the URL starts with a /, it's a relative URL and we should open the comments page directly.
val postAction =
if (post.url.isNotEmpty()) actionStartActivity(Intent(Intent.ACTION_VIEW, Uri.parse(post.url)))
else commentsAction
if (post.url.startsWith('/')) commentsAction
else actionStartActivity(Intent(Intent.ACTION_VIEW, Uri.parse(post.url)))
Box(modifier.padding(8.dp)) {
Row(
verticalAlignment = Alignment.CenterVertically,