Rename FollowList ViewModel to match it's actual use.
This commit is contained in:
@@ -23,30 +23,15 @@ package com.vitorpamplona.amethyst.ui.screen
|
||||
import android.util.Log
|
||||
import androidx.compose.runtime.Stable
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.vitorpamplona.amethyst.model.Account
|
||||
import com.vitorpamplona.amethyst.model.LocalCache
|
||||
import com.vitorpamplona.amethyst.model.Note
|
||||
import com.vitorpamplona.amethyst.ui.dal.FeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.dal.FollowSetFeedFilter
|
||||
import com.vitorpamplona.amethyst.ui.feeds.FeedContentState
|
||||
import com.vitorpamplona.amethyst.ui.feeds.InvalidatableContent
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.NostrListFeedViewModel
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Stable
|
||||
class NostrUserListFeedViewModel(
|
||||
val account: Account,
|
||||
) : NostrListFeedViewModel(FollowSetFeedFilter(account)) {
|
||||
class Factory(
|
||||
val account: Account,
|
||||
) : ViewModelProvider.Factory {
|
||||
override fun <NostrUserFollowSetFeedViewModel : ViewModel> create(modelClass: Class<NostrUserFollowSetFeedViewModel>): NostrUserFollowSetFeedViewModel = NostrUserListFeedViewModel(account) as NostrUserFollowSetFeedViewModel
|
||||
}
|
||||
}
|
||||
|
||||
@Stable
|
||||
abstract class FeedViewModel(
|
||||
localFilter: FeedFilter<Note>,
|
||||
|
||||
+2
-2
@@ -77,10 +77,10 @@ fun ListsScreen(
|
||||
accountViewModel: AccountViewModel,
|
||||
nav: INav,
|
||||
) {
|
||||
val followSetsViewModel: NostrListFeedViewModel =
|
||||
val followSetsViewModel: NostrUserListFeedViewModel =
|
||||
viewModel(
|
||||
key = "NostrUserListFeedViewModel",
|
||||
factory = NostrListFeedViewModel.Factory(accountViewModel.account),
|
||||
factory = NostrUserListFeedViewModel.Factory(accountViewModel.account),
|
||||
)
|
||||
|
||||
val currentCoroutineScope = rememberCoroutineScope()
|
||||
|
||||
+4
-4
@@ -48,8 +48,8 @@ import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.UUID
|
||||
|
||||
// TODO: Investigate the addition of feed filters, for bookmark sets and general ones.
|
||||
class NostrListFeedViewModel(
|
||||
// TODO Update: Rename this to be used only for follow sets, and create separate VMs for bookmark sets, etc.
|
||||
class NostrUserListFeedViewModel(
|
||||
val dataSource: FeedFilter<FollowSet>,
|
||||
) : ViewModel(),
|
||||
InvalidatableContent {
|
||||
@@ -105,7 +105,7 @@ class NostrListFeedViewModel(
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e(
|
||||
"NostrListFeedViewModel",
|
||||
"NostrUserListFeedViewModel",
|
||||
"refreshSuspended: Error loading or refreshing feed -> ${e.message}",
|
||||
)
|
||||
_feedContent.update { FollowSetState.FeedError(e.message.toString()) }
|
||||
@@ -264,6 +264,6 @@ class NostrListFeedViewModel(
|
||||
class Factory(
|
||||
val account: Account,
|
||||
) : ViewModelProvider.Factory {
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T = NostrListFeedViewModel(FollowSetFeedFilter(account)) as T
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T = NostrUserListFeedViewModel(FollowSetFeedFilter(account)) as T
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user