mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 02:57:04 +05:30
fix(widget): open comments screen directly for lobsters-native posts
Fixes COMPOSE-LOBSTERS-2P
This commit is contained in:
parent
7762733da2
commit
5c0b5bb4f7
2 changed files with 8 additions and 2 deletions
|
@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Fix crash when trying to open a comments-only post from
|
||||||
|
the home screen widget
|
||||||
|
|
||||||
## [1.42.0] - 2024-03-16
|
## [1.42.0] - 2024-03-16
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -43,9 +43,10 @@ fun WidgetListEntry(post: UIPost, modifier: GlanceModifier = GlanceModifier) {
|
||||||
val titleStyle = MaterialTheme.typography.titleMedium
|
val titleStyle = MaterialTheme.typography.titleMedium
|
||||||
val commentsAction =
|
val commentsAction =
|
||||||
actionStartActivity<MainActivity>(actionParametersOf(destinationKey to post.shortId))
|
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 =
|
val postAction =
|
||||||
if (post.url.isNotEmpty()) actionStartActivity(Intent(Intent.ACTION_VIEW, Uri.parse(post.url)))
|
if (post.url.startsWith('/')) commentsAction
|
||||||
else commentsAction
|
else actionStartActivity(Intent(Intent.ACTION_VIEW, Uri.parse(post.url)))
|
||||||
Box(modifier.padding(8.dp)) {
|
Box(modifier.padding(8.dp)) {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue