Moves uncited hashtag parsing to a thread
This commit is contained in:
+5
-6
@@ -37,7 +37,7 @@ import com.vitorpamplona.amethyst.ui.theme.lessImportantLink
|
||||
import com.vitorpamplona.quartz.events.Event
|
||||
import com.vitorpamplona.quartz.events.toImmutableListOfLists
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Composable
|
||||
fun DisplayUncitedHashtags(
|
||||
@@ -56,12 +56,10 @@ fun DisplayUncitedHashtags(
|
||||
) {
|
||||
val unusedHashtags by
|
||||
produceState(initialValue = emptyList<String>()) {
|
||||
withContext(Dispatchers.Default) {
|
||||
val state = CachedRichTextParser.parseText(content, event.tags.toImmutableListOfLists())
|
||||
|
||||
val tagsInEvent = event.hashtags()
|
||||
|
||||
if (tagsInEvent.isEmpty()) return@withContext
|
||||
if (tagsInEvent.isNotEmpty()) {
|
||||
launch(Dispatchers.Default) {
|
||||
val state = CachedRichTextParser.parseText(content, event.tags.toImmutableListOfLists())
|
||||
|
||||
val tagsInContent =
|
||||
state
|
||||
@@ -88,6 +86,7 @@ fun DisplayUncitedHashtags(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (unusedHashtags.isNotEmpty()) {
|
||||
val style =
|
||||
|
||||
Reference in New Issue
Block a user