mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-29 00:10:45 +00:00
Displays hashtags that are not in the text at the bottom of each note
This commit is contained in:
parent
dd9ea5f27e
commit
6626be8e1c
@ -47,7 +47,7 @@ open class Event(
|
||||
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 }
|
||||
|
||||
|
@ -28,4 +28,5 @@ interface EventInterface {
|
||||
fun isTaggedHash(hashtag: String): Boolean
|
||||
fun isTaggedHashes(hashtag: Set<String>): Boolean
|
||||
fun firstIsTaggedHashes(hashtag: Set<String>): String?
|
||||
fun hashtags(): List<String>
|
||||
}
|
||||
|
@ -482,6 +482,25 @@ fun NoteCompose(
|
||||
accountViewModel,
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user