HACK: app: add workaround to prevent deeplinking comment replies back to the app

Signed-off-by: Aditya Wasan <adityawasan55@gmail.com>
This commit is contained in:
Aditya Wasan
2021-05-16 22:52:23 +05:30
committed by Harsh Shandilya
parent bdb1c8ef1b
commit 96d8bfdb73
2 changed files with 20 additions and 2 deletions
+11 -1
View File
@@ -62,7 +62,17 @@
<data
android:host="lobste.rs"
android:scheme="https"
android:pathPrefix="/s/" />
android:pathPattern="/s/......"/>
<data
android:host="lobste.rs"
android:scheme="https"
android:pathPattern="/s/....../"/>
<data
android:host="lobste.rs"
android:scheme="https"
android:pathPattern="/s/....../...*"/>
</intent-filter>
</activity>
<activity
@@ -100,7 +100,15 @@ private fun CommentsPageInternal(
tween(durationMillis = AnimationDuration, easing = FastOutLinearInEasing),
)
) {
FloatingActionButton(onClick = { urlLauncher.launch(details.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.
FloatingActionButton(
onClick = { urlLauncher.launch(details.commentsUrl.replaceAfterLast('/', "r")) }
) {
IconResource(
resourceId = R.drawable.ic_reply_24dp,
contentDescription = Strings.ReplyButtonContentDescription.get()