mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 01:47:03 +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) {
|
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) {
|
override fun toggleSave(post: SavedPost) {
|
||||||
|
|
|
@ -61,21 +61,10 @@ fun CommentsHeader(
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
|
|
||||||
if (postDetails.url.isNotBlank()) {
|
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(
|
PostLink(
|
||||||
link = postDetails.url,
|
link = postDetails.url,
|
||||||
modifier =
|
modifier =
|
||||||
Modifier.clickable {
|
Modifier.clickable { postActions.viewPost(postDetails.url, postDetails.commentsUrl) },
|
||||||
postActions.viewPost(
|
|
||||||
postDetails.url,
|
|
||||||
postDetails.commentsUrl.replaceAfterLast('/', "r")
|
|
||||||
)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue