kopia lustrzana https://github.com/vitorpamplona/amethyst
Fixes missing elements in the previous commit
rodzic
b8cb6295f4
commit
71dad0c69e
|
@ -15,6 +15,7 @@ import com.vitorpamplona.amethyst.ui.dal.HomeConversationsFeedFilter
|
||||||
import com.vitorpamplona.amethyst.ui.dal.HomeNewThreadFeedFilter
|
import com.vitorpamplona.amethyst.ui.dal.HomeNewThreadFeedFilter
|
||||||
import com.vitorpamplona.amethyst.ui.dal.ThreadFeedFilter
|
import com.vitorpamplona.amethyst.ui.dal.ThreadFeedFilter
|
||||||
import com.vitorpamplona.amethyst.ui.dal.UserProfileNoteFeedFilter
|
import com.vitorpamplona.amethyst.ui.dal.UserProfileNoteFeedFilter
|
||||||
|
import com.vitorpamplona.amethyst.ui.dal.UserProfileReportsFeedFilter
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
@ -32,6 +33,7 @@ class NostrChatRoomFeedViewModel: FeedViewModel(ChatroomFeedFilter)
|
||||||
class NostrGlobalFeedViewModel: FeedViewModel(GlobalFeedFilter)
|
class NostrGlobalFeedViewModel: FeedViewModel(GlobalFeedFilter)
|
||||||
class NostrThreadFeedViewModel: FeedViewModel(ThreadFeedFilter)
|
class NostrThreadFeedViewModel: FeedViewModel(ThreadFeedFilter)
|
||||||
class NostrUserProfileFeedViewModel: FeedViewModel(UserProfileNoteFeedFilter)
|
class NostrUserProfileFeedViewModel: FeedViewModel(UserProfileNoteFeedFilter)
|
||||||
|
class NostrUserProfileReportFeedViewModel: FeedViewModel(UserProfileReportsFeedFilter)
|
||||||
class NostrChatroomListKnownFeedViewModel: FeedViewModel(ChatroomListKnownFeedFilter)
|
class NostrChatroomListKnownFeedViewModel: FeedViewModel(ChatroomListKnownFeedFilter)
|
||||||
class NostrChatroomListNewFeedViewModel: FeedViewModel(ChatroomListNewFeedFilter)
|
class NostrChatroomListNewFeedViewModel: FeedViewModel(ChatroomListNewFeedFilter)
|
||||||
class NostrHomeFeedViewModel: FeedViewModel(HomeNewThreadFeedFilter)
|
class NostrHomeFeedViewModel: FeedViewModel(HomeNewThreadFeedFilter)
|
||||||
|
@ -42,12 +44,11 @@ abstract class FeedViewModel(val localFilter: FeedFilter<Note>): ViewModel() {
|
||||||
private val _feedContent = MutableStateFlow<FeedState>(FeedState.Loading)
|
private val _feedContent = MutableStateFlow<FeedState>(FeedState.Loading)
|
||||||
val feedContent = _feedContent.asStateFlow()
|
val feedContent = _feedContent.asStateFlow()
|
||||||
|
|
||||||
open fun newListFromDataSource(): List<Note> {
|
fun newListFromDataSource(): List<Note> {
|
||||||
return localFilter.loadTop()
|
return localFilter.loadTop()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun refresh() {
|
fun refresh() {
|
||||||
println("Model Refresh: ${this::class.simpleName}")
|
|
||||||
val scope = CoroutineScope(Job() + Dispatchers.Default)
|
val scope = CoroutineScope(Job() + Dispatchers.Default)
|
||||||
scope.launch {
|
scope.launch {
|
||||||
refreshSuspended()
|
refreshSuspended()
|
||||||
|
@ -72,7 +73,6 @@ abstract class FeedViewModel(val localFilter: FeedFilter<Note>): ViewModel() {
|
||||||
val scope = CoroutineScope(Job() + Dispatchers.Main)
|
val scope = CoroutineScope(Job() + Dispatchers.Main)
|
||||||
scope.launch {
|
scope.launch {
|
||||||
val currentState = feedContent.value
|
val currentState = feedContent.value
|
||||||
|
|
||||||
if (notes.isEmpty()) {
|
if (notes.isEmpty()) {
|
||||||
_feedContent.update { FeedState.Empty }
|
_feedContent.update { FeedState.Empty }
|
||||||
} else if (currentState is FeedState.Loaded) {
|
} else if (currentState is FeedState.Loaded) {
|
||||||
|
|
Ładowanie…
Reference in New Issue