mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-16 18:23:35 +00:00
Adds the highlight to the base URL so that when the user opens the link, it highlights on the page.
This commit is contained in:
parent
38ba456a22
commit
b440661e0d
@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.vitorpamplona.amethyst.ui.note.types
|
package com.vitorpamplona.amethyst.ui.note.types
|
||||||
|
|
||||||
|
import android.net.Uri
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||||
@ -127,8 +128,9 @@ fun DisplayHighlight(
|
|||||||
verticalArrangement = Arrangement.Center,
|
verticalArrangement = Arrangement.Center,
|
||||||
) {
|
) {
|
||||||
DisplayQuoteAuthor(
|
DisplayQuoteAuthor(
|
||||||
|
highlightQuote = highlight,
|
||||||
authorHex = authorHex,
|
authorHex = authorHex,
|
||||||
url = url,
|
baseUrl = url,
|
||||||
postAddress = postAddress,
|
postAddress = postAddress,
|
||||||
postVersion = postVersion,
|
postVersion = postVersion,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
@ -139,8 +141,9 @@ fun DisplayHighlight(
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun DisplayQuoteAuthor(
|
private fun DisplayQuoteAuthor(
|
||||||
|
highlightQuote: String,
|
||||||
authorHex: String?,
|
authorHex: String?,
|
||||||
url: String?,
|
baseUrl: String?,
|
||||||
postAddress: ATag?,
|
postAddress: ATag?,
|
||||||
postVersion: HexKey?,
|
postVersion: HexKey?,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
@ -196,7 +199,9 @@ private fun DisplayQuoteAuthor(
|
|||||||
version?.let {
|
version?.let {
|
||||||
DisplayEntryForNote(it, userBase, accountViewModel, nav)
|
DisplayEntryForNote(it, userBase, accountViewModel, nav)
|
||||||
}
|
}
|
||||||
} else if (url != null) {
|
} else if (baseUrl != null) {
|
||||||
|
val url = "$baseUrl${if (baseUrl.contains("#")) "&" else "#"}:~:text=${Uri.encode(highlightQuote)}"
|
||||||
|
|
||||||
DisplayEntryForAUrl(url, userBase, accountViewModel, nav)
|
DisplayEntryForAUrl(url, userBase, accountViewModel, nav)
|
||||||
} else if (userBase != null) {
|
} else if (userBase != null) {
|
||||||
userBase?.let {
|
userBase?.let {
|
||||||
|
Loading…
Reference in New Issue
Block a user