android: move comments URL hackery to the right location

This commit is contained in:
Harsh Shandilya 2022-03-02 13:40:57 +05:30
parent de28ae2d95
commit c556f26d77
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
2 changed files with 8 additions and 13 deletions

View file

@ -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) {