kopia lustrzana https://github.com/vitorpamplona/amethyst
Loads the user profile before building the live set.
rodzic
7596f2a43e
commit
c6e6bf6032
|
@ -22,6 +22,7 @@ import com.vitorpamplona.quartz.events.TextNoteEvent
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
object NostrHomeDataSource : NostrDataSource("HomeFeed") {
|
object NostrHomeDataSource : NostrDataSource("HomeFeed") {
|
||||||
lateinit var account: Account
|
lateinit var account: Account
|
||||||
|
@ -34,6 +35,10 @@ object NostrHomeDataSource : NostrDataSource("HomeFeed") {
|
||||||
override fun start() {
|
override fun start() {
|
||||||
job?.cancel()
|
job?.cancel()
|
||||||
job = account.scope.launch(Dispatchers.IO) {
|
job = account.scope.launch(Dispatchers.IO) {
|
||||||
|
// creates cache on main
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
account.userProfile().live()
|
||||||
|
}
|
||||||
account.liveHomeFollowLists.collect {
|
account.liveHomeFollowLists.collect {
|
||||||
if (this@NostrHomeDataSource::account.isInitialized) {
|
if (this@NostrHomeDataSource::account.isInitialized) {
|
||||||
invalidateFilters()
|
invalidateFilters()
|
||||||
|
|
Ładowanie…
Reference in New Issue