diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt index f30c153dc..62ad0b4d3 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt @@ -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 create(modelClass: Class): NostrUserFollowSetFeedViewModel = NostrUserListFeedViewModel(account) as NostrUserFollowSetFeedViewModel - } -} - @Stable abstract class FeedViewModel( localFilter: FeedFilter, diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomListsScreen.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomListsScreen.kt index 673ba3495..016e73831 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomListsScreen.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/CustomListsScreen.kt @@ -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() diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/NostrListFeedViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/NostrUserListFeedViewModel.kt similarity index 97% rename from amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/NostrListFeedViewModel.kt rename to amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/NostrUserListFeedViewModel.kt index d007751fd..484da3e3f 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/NostrListFeedViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/lists/NostrUserListFeedViewModel.kt @@ -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, ) : 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 create(modelClass: Class): T = NostrListFeedViewModel(FollowSetFeedFilter(account)) as T + override fun create(modelClass: Class): T = NostrUserListFeedViewModel(FollowSetFeedFilter(account)) as T } }