Loads the user profile before building the live set.
This commit is contained in:
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user