Removes the list view model from the LoginPage
This commit is contained in:
@@ -79,7 +79,6 @@ import com.vitorpamplona.amethyst.ui.screen.loggedIn.hashtag.HashtagScreen
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.HomeScreen
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.HomeScreen
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.ShortNotePostScreen
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.ShortNotePostScreen
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.ListsAndSetsScreen
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.ListsAndSetsScreen
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.NostrUserListFeedViewModel
|
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.followsets.FollowSetScreen
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.followsets.FollowSetScreen
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.followsets.FollowSetsManagementDialog
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.followsets.FollowSetsManagementDialog
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.NotificationScreen
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications.NotificationScreen
|
||||||
@@ -110,7 +109,6 @@ import java.net.URI
|
|||||||
fun AppNavigation(
|
fun AppNavigation(
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
accountStateViewModel: AccountStateViewModel,
|
accountStateViewModel: AccountStateViewModel,
|
||||||
listsViewModel: NostrUserListFeedViewModel,
|
|
||||||
) {
|
) {
|
||||||
val nav = rememberNav()
|
val nav = rememberNav()
|
||||||
|
|
||||||
@@ -127,12 +125,12 @@ fun AppNavigation(
|
|||||||
composable<Route.Discover> { DiscoverScreen(accountViewModel, nav) }
|
composable<Route.Discover> { DiscoverScreen(accountViewModel, nav) }
|
||||||
composable<Route.Notification> { NotificationScreen(accountViewModel, nav) }
|
composable<Route.Notification> { NotificationScreen(accountViewModel, nav) }
|
||||||
|
|
||||||
composableFromEnd<Route.Lists> { ListsAndSetsScreen(accountViewModel, listsViewModel, nav) }
|
composableFromEnd<Route.Lists> { ListsAndSetsScreen(accountViewModel, nav) }
|
||||||
composableArgs<Route.FollowSetRoute> {
|
composableArgs<Route.FollowSetRoute> {
|
||||||
FollowSetScreen(it.setIdentifier, accountViewModel, listsViewModel, nav)
|
FollowSetScreen(it.setIdentifier, accountViewModel, nav)
|
||||||
}
|
}
|
||||||
composableArgs<Route.FollowSetManagement> {
|
composableArgs<Route.FollowSetManagement> {
|
||||||
FollowSetsManagementDialog(it.userHexKey, accountViewModel.account, listsViewModel, nav)
|
FollowSetsManagementDialog(it.userHexKey, accountViewModel, nav)
|
||||||
}
|
}
|
||||||
|
|
||||||
composable<Route.EditProfile> { NewUserMetadataScreen(nav, accountViewModel) }
|
composable<Route.EditProfile> { NewUserMetadataScreen(nav, accountViewModel) }
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.rooms.datasource.ChatroomListFilterAssemblerSubscription
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.rooms.datasource.ChatroomListFilterAssemblerSubscription
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.datasource.DiscoveryFilterAssemblerSubscription
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.discover.datasource.DiscoveryFilterAssemblerSubscription
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.datasource.HomeFilterAssemblerSubscription
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.home.datasource.HomeFilterAssemblerSubscription
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.NostrUserListFeedViewModel
|
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.video.datasource.VideoFilterAssemblerSubscription
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.video.datasource.VideoFilterAssemblerSubscription
|
||||||
import com.vitorpamplona.quartz.nip55AndroidSigner.client.IActivityLauncher
|
import com.vitorpamplona.quartz.nip55AndroidSigner.client.IActivityLauncher
|
||||||
import com.vitorpamplona.quartz.utils.Log
|
import com.vitorpamplona.quartz.utils.Log
|
||||||
@@ -75,12 +74,6 @@ fun LoggedInPage(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
val listsViewModel: NostrUserListFeedViewModel =
|
|
||||||
viewModel(
|
|
||||||
key = "NostrUserListFeedViewModel",
|
|
||||||
factory = NostrUserListFeedViewModel.Factory(accountViewModel.account),
|
|
||||||
)
|
|
||||||
|
|
||||||
accountViewModel.firstRoute = route
|
accountViewModel.firstRoute = route
|
||||||
|
|
||||||
// Adds this account to the authentication procedures for relays.
|
// Adds this account to the authentication procedures for relays.
|
||||||
@@ -107,7 +100,6 @@ fun LoggedInPage(
|
|||||||
AppNavigation(
|
AppNavigation(
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
accountStateViewModel = accountStateViewModel,
|
accountStateViewModel = accountStateViewModel,
|
||||||
listsViewModel = listsViewModel,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
@@ -58,6 +58,7 @@ import androidx.lifecycle.Lifecycle
|
|||||||
import androidx.lifecycle.LifecycleEventObserver
|
import androidx.lifecycle.LifecycleEventObserver
|
||||||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
import androidx.lifecycle.compose.LocalLifecycleOwner
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.ui.layouts.DisappearingScaffold
|
import com.vitorpamplona.amethyst.ui.layouts.DisappearingScaffold
|
||||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||||
@@ -74,7 +75,25 @@ import kotlinx.coroutines.launch
|
|||||||
@Composable
|
@Composable
|
||||||
fun ListsAndSetsScreen(
|
fun ListsAndSetsScreen(
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
nav: INav,
|
||||||
|
) {
|
||||||
|
val followSetsViewModel: NostrUserListFeedViewModel =
|
||||||
|
viewModel(
|
||||||
|
key = "NostrUserListFeedViewModel",
|
||||||
|
factory = NostrUserListFeedViewModel.Factory(accountViewModel.account),
|
||||||
|
)
|
||||||
|
|
||||||
|
ListsAndSetsScreen(
|
||||||
|
followSetsViewModel,
|
||||||
|
accountViewModel,
|
||||||
|
nav,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ListsAndSetsScreen(
|
||||||
followSetsViewModel: NostrUserListFeedViewModel,
|
followSetsViewModel: NostrUserListFeedViewModel,
|
||||||
|
accountViewModel: AccountViewModel,
|
||||||
nav: INav,
|
nav: INav,
|
||||||
) {
|
) {
|
||||||
val lifeCycleOwner = LocalLifecycleOwner.current
|
val lifeCycleOwner = LocalLifecycleOwner.current
|
||||||
|
|||||||
+17
@@ -60,6 +60,7 @@ import androidx.compose.ui.text.font.FontWeight
|
|||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.model.User
|
import com.vitorpamplona.amethyst.model.User
|
||||||
import com.vitorpamplona.amethyst.ui.components.ClickableBox
|
import com.vitorpamplona.amethyst.ui.components.ClickableBox
|
||||||
@@ -83,7 +84,23 @@ import kotlinx.coroutines.launch
|
|||||||
fun FollowSetScreen(
|
fun FollowSetScreen(
|
||||||
selectedSetIdentifier: String,
|
selectedSetIdentifier: String,
|
||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
|
navigator: INav,
|
||||||
|
) {
|
||||||
|
val followSetViewModel: NostrUserListFeedViewModel =
|
||||||
|
viewModel(
|
||||||
|
key = "NostrUserListFeedViewModel",
|
||||||
|
factory = NostrUserListFeedViewModel.Factory(accountViewModel.account),
|
||||||
|
)
|
||||||
|
|
||||||
|
FollowSetScreen(selectedSetIdentifier, followSetViewModel, accountViewModel, navigator)
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun FollowSetScreen(
|
||||||
|
selectedSetIdentifier: String,
|
||||||
followSetViewModel: NostrUserListFeedViewModel,
|
followSetViewModel: NostrUserListFeedViewModel,
|
||||||
|
accountViewModel: AccountViewModel,
|
||||||
navigator: INav,
|
navigator: INav,
|
||||||
) {
|
) {
|
||||||
val followSetState by followSetViewModel.feedContent.collectAsState()
|
val followSetState by followSetViewModel.feedContent.collectAsState()
|
||||||
|
|||||||
+19
-1
@@ -74,11 +74,13 @@ import androidx.compose.ui.text.style.TextOverflow
|
|||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
import com.vitorpamplona.amethyst.model.Account
|
import com.vitorpamplona.amethyst.model.Account
|
||||||
import com.vitorpamplona.amethyst.model.LocalCache
|
import com.vitorpamplona.amethyst.model.LocalCache
|
||||||
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
import com.vitorpamplona.amethyst.ui.navigation.navs.INav
|
||||||
import com.vitorpamplona.amethyst.ui.note.ArrowBackIcon
|
import com.vitorpamplona.amethyst.ui.note.ArrowBackIcon
|
||||||
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.FollowSetState
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.FollowSetState
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.ListVisibility
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.ListVisibility
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.NewSetCreationDialog
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.lists.NewSetCreationDialog
|
||||||
@@ -92,8 +94,24 @@ import com.vitorpamplona.amethyst.ui.theme.StdVertSpacer
|
|||||||
@Composable
|
@Composable
|
||||||
fun FollowSetsManagementDialog(
|
fun FollowSetsManagementDialog(
|
||||||
userHex: String,
|
userHex: String,
|
||||||
account: Account,
|
accountViewModel: AccountViewModel,
|
||||||
|
navigator: INav,
|
||||||
|
) {
|
||||||
|
val followSetViewModel: NostrUserListFeedViewModel =
|
||||||
|
viewModel(
|
||||||
|
key = "NostrUserListFeedViewModel",
|
||||||
|
factory = NostrUserListFeedViewModel.Factory(accountViewModel.account),
|
||||||
|
)
|
||||||
|
|
||||||
|
FollowSetsManagementDialog(userHex, followSetViewModel, accountViewModel.account, navigator)
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun FollowSetsManagementDialog(
|
||||||
|
userHex: String,
|
||||||
followSetsViewModel: NostrUserListFeedViewModel,
|
followSetsViewModel: NostrUserListFeedViewModel,
|
||||||
|
account: Account,
|
||||||
navigator: INav,
|
navigator: INav,
|
||||||
) {
|
) {
|
||||||
val followSetsState by followSetsViewModel.feedContent.collectAsState()
|
val followSetsState by followSetsViewModel.feedContent.collectAsState()
|
||||||
|
|||||||
Reference in New Issue
Block a user