Load and populate follow sets in Account(since Account is initialized in AccountViewModel anyway).
This commit is contained in:
@@ -23,6 +23,7 @@ package com.vitorpamplona.amethyst.model
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.compose.runtime.Immutable
|
import androidx.compose.runtime.Immutable
|
||||||
import androidx.compose.runtime.Stable
|
import androidx.compose.runtime.Stable
|
||||||
|
import androidx.compose.ui.util.fastFilter
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.asLiveData
|
import androidx.lifecycle.asLiveData
|
||||||
import androidx.lifecycle.liveData
|
import androidx.lifecycle.liveData
|
||||||
@@ -2903,6 +2904,15 @@ class Account(
|
|||||||
.flowOn(Dispatchers.IO)
|
.flowOn(Dispatchers.IO)
|
||||||
.stateIn(scope)
|
.stateIn(scope)
|
||||||
|
|
||||||
|
fun loadUserFollowSets() {
|
||||||
|
val sets =
|
||||||
|
getFollowSetNotes()
|
||||||
|
.fastFilter { !it.dTag().isNullOrBlank() }
|
||||||
|
.associate { note -> note.dTag().toString() to note.event as PeopleListEvent }
|
||||||
|
|
||||||
|
userProfile().followSets = sets
|
||||||
|
}
|
||||||
|
|
||||||
fun getMuteListFlow(): StateFlow<NoteState> = getMuteListNote().flow().metadata.stateFlow
|
fun getMuteListFlow(): StateFlow<NoteState> = getMuteListNote().flow().metadata.stateFlow
|
||||||
|
|
||||||
fun getBlockList(): PeopleListEvent? = getBlockListNote().event as? PeopleListEvent
|
fun getBlockList(): PeopleListEvent? = getBlockListNote().event as? PeopleListEvent
|
||||||
@@ -3696,6 +3706,11 @@ class Account(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scope.launch(Dispatchers.IO) {
|
||||||
|
Log.d("AccountFollowSetsWorker", "Loading Follow Sets for Account")
|
||||||
|
loadUserFollowSets()
|
||||||
|
}
|
||||||
|
|
||||||
scope.launch(Dispatchers.Default) {
|
scope.launch(Dispatchers.Default) {
|
||||||
Log.d("AccountRegisterObservers", "Mute List Collector Start")
|
Log.d("AccountRegisterObservers", "Mute List Collector Start")
|
||||||
getMuteListFlow().collect {
|
getMuteListFlow().collect {
|
||||||
|
|||||||
Reference in New Issue
Block a user