mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 08:17:04 +05:30
android: move comments URL hackery to the right location
This commit is contained in:
parent
de28ae2d95
commit
c556f26d77
2 changed files with 8 additions and 13 deletions
|
@ -95,7 +95,13 @@ fun rememberPostActions(
|
|||
}
|
||||
|
||||
override fun viewCommentsPage(commentsUrl: String) {
|
||||
urlLauncher.openUri(commentsUrl)
|
||||
// Post links from lobste.rs are of the form $baseUrl/s/$postId/$postTitle
|
||||
// Interestingly, lobste.rs does not actually care for the value of $postTitle, and will
|
||||
// happily accept both a missing as well as a completely arbitrary $postTitle. We
|
||||
// leverage this to create a new URL format which looks like
|
||||
// $baseUrl/s/$postId/$postTitle/r, and does not trigger our deeplinks,
|
||||
// instead opening in the custom tab as we want it to.
|
||||
urlLauncher.openUri(commentsUrl.replaceAfterLast('/', "r"))
|
||||
}
|
||||
|
||||
override fun toggleSave(post: SavedPost) {
|
||||
|
|
|
@ -61,21 +61,10 @@ fun CommentsHeader(
|
|||
Spacer(Modifier.height(4.dp))
|
||||
|
||||
if (postDetails.url.isNotBlank()) {
|
||||
// Post links from lobste.rs are of the form $baseUrl/s/$postId/$postTitle
|
||||
// Interestingly, lobste.rs does not actually care for the value of $postTitle, and will
|
||||
// happily accept both a missing as well as a completely arbitrary $postTitle. We
|
||||
// leverage this to create a new URL format which looks like
|
||||
// $baseUrl/s/$postId/$postTitle/r, and does not trigger our deeplinks,
|
||||
// instead opening in the custom tab as we want it to.
|
||||
PostLink(
|
||||
link = postDetails.url,
|
||||
modifier =
|
||||
Modifier.clickable {
|
||||
postActions.viewPost(
|
||||
postDetails.url,
|
||||
postDetails.commentsUrl.replaceAfterLast('/', "r")
|
||||
)
|
||||
},
|
||||
Modifier.clickable { postActions.viewPost(postDetails.url, postDetails.commentsUrl) },
|
||||
)
|
||||
Spacer(Modifier.height(4.dp))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue