mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-21 18:10:33 +02:00
Displays hashtags that are not in the text at the bottom of each note
This commit is contained in:
@@ -47,7 +47,7 @@ open class Event(
|
|||||||
if (aTagValue != null) ATag.parse(aTagValue, relay) else null
|
if (aTagValue != null) ATag.parse(aTagValue, relay) else null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hashtags() = tags.filter { it.firstOrNull() == "t" }.mapNotNull { it.getOrNull(1) }
|
override fun hashtags() = tags.filter { it.firstOrNull() == "t" }.mapNotNull { it.getOrNull(1) }
|
||||||
|
|
||||||
override fun isTaggedUser(idHex: String) = tags.any { it.getOrNull(0) == "p" && it.getOrNull(1) == idHex }
|
override fun isTaggedUser(idHex: String) = tags.any { it.getOrNull(0) == "p" && it.getOrNull(1) == idHex }
|
||||||
|
|
||||||
|
@@ -28,4 +28,5 @@ interface EventInterface {
|
|||||||
fun isTaggedHash(hashtag: String): Boolean
|
fun isTaggedHash(hashtag: String): Boolean
|
||||||
fun isTaggedHashes(hashtag: Set<String>): Boolean
|
fun isTaggedHashes(hashtag: Set<String>): Boolean
|
||||||
fun firstIsTaggedHashes(hashtag: Set<String>): String?
|
fun firstIsTaggedHashes(hashtag: Set<String>): String?
|
||||||
|
fun hashtags(): List<String>
|
||||||
}
|
}
|
||||||
|
@@ -482,6 +482,25 @@ fun NoteCompose(
|
|||||||
accountViewModel,
|
accountViewModel,
|
||||||
navController
|
navController
|
||||||
)
|
)
|
||||||
|
|
||||||
|
val hashtags = noteEvent.hashtags()
|
||||||
|
if (hashtags.isNotEmpty()) {
|
||||||
|
FlowRow() {
|
||||||
|
hashtags.forEach {
|
||||||
|
if (!eventContent.contains(it, true)) {
|
||||||
|
ClickableText(
|
||||||
|
text = AnnotatedString("#$it "),
|
||||||
|
onClick = { navController.navigate("Hashtag/$it") },
|
||||||
|
style = LocalTextStyle.current.copy(
|
||||||
|
color = MaterialTheme.colors.primary.copy(
|
||||||
|
alpha = 0.52f
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!makeItShort) {
|
if (!makeItShort) {
|
||||||
|
Reference in New Issue
Block a user