Presubscribe to the bottom navigation items in the start up of the app.
This commit is contained in:
+1
-2
@@ -22,12 +22,11 @@ package com.vitorpamplona.amethyst.service.relayClient.reqCommand.account
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import com.vitorpamplona.amethyst.Amethyst
|
||||
import com.vitorpamplona.amethyst.service.relayClient.KeyDataSourceSubscription
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
|
||||
@Composable
|
||||
fun AccountFilterAssemblerSubscription(accountViewModel: AccountViewModel) = AccountFilterAssemblerSubscription(accountViewModel, Amethyst.instance.sources.account)
|
||||
fun AccountFilterAssemblerSubscription(accountViewModel: AccountViewModel) = AccountFilterAssemblerSubscription(accountViewModel, accountViewModel.dataSources().account)
|
||||
|
||||
@Composable
|
||||
fun AccountFilterAssemblerSubscription(
|
||||
|
||||
@@ -50,6 +50,10 @@ import com.vitorpamplona.amethyst.ui.navigation.AppNavigation
|
||||
import com.vitorpamplona.amethyst.ui.navigation.Route
|
||||
import com.vitorpamplona.amethyst.ui.screen.AccountStateViewModel
|
||||
import com.vitorpamplona.amethyst.ui.screen.SharedPreferencesViewModel
|
||||
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.home.datasource.HomeFilterAssemblerSubscription
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.video.datasource.VideoFilterAssemblerSubscription
|
||||
import com.vitorpamplona.amethyst.ui.tor.TorServiceStatus
|
||||
import com.vitorpamplona.amethyst.ui.tor.TorType
|
||||
import com.vitorpamplona.quartz.nip55AndroidSigner.NostrSignerExternal
|
||||
@@ -83,6 +87,11 @@ fun LoggedInPage(
|
||||
// Loads account information from Relays.
|
||||
AccountFilterAssemblerSubscription(accountViewModel)
|
||||
|
||||
HomeFilterAssemblerSubscription(accountViewModel)
|
||||
ChatroomListFilterAssemblerSubscription(accountViewModel)
|
||||
VideoFilterAssemblerSubscription(accountViewModel)
|
||||
DiscoveryFilterAssemblerSubscription(accountViewModel)
|
||||
|
||||
// TODO: Is this needed?
|
||||
RelaySubscriptionsCoordinatorSubscription()
|
||||
|
||||
|
||||
+8
@@ -25,6 +25,14 @@ import androidx.compose.runtime.remember
|
||||
import com.vitorpamplona.amethyst.service.relayClient.KeyDataSourceSubscription
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
|
||||
@Composable
|
||||
fun ChatroomListFilterAssemblerSubscription(accountViewModel: AccountViewModel) {
|
||||
ChatroomListFilterAssemblerSubscription(
|
||||
accountViewModel.dataSources().chatroomList,
|
||||
accountViewModel,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ChatroomListFilterAssemblerSubscription(
|
||||
dataSource: ChatroomListFilterAssembler,
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ fun MessagesSinglePane(
|
||||
WatchLifecycleAndUpdateModel(knownFeedContentState)
|
||||
WatchLifecycleAndUpdateModel(newFeedContentState)
|
||||
|
||||
ChatroomListFilterAssemblerSubscription(accountViewModel.dataSources().chatroomList, accountViewModel)
|
||||
ChatroomListFilterAssemblerSubscription(accountViewModel)
|
||||
|
||||
val tabs by
|
||||
remember(knownFeedContentState, markKnownAsRead) {
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ fun ChatroomList(
|
||||
WatchLifecycleAndUpdateModel(knownFeedContentState)
|
||||
WatchLifecycleAndUpdateModel(newFeedContentState)
|
||||
|
||||
ChatroomListFilterAssemblerSubscription(accountViewModel.dataSources().chatroomList, accountViewModel)
|
||||
ChatroomListFilterAssemblerSubscription(accountViewModel)
|
||||
|
||||
val tabs by
|
||||
remember(knownFeedContentState, markKnownAsRead) {
|
||||
|
||||
+8
@@ -26,6 +26,14 @@ import androidx.lifecycle.viewModelScope
|
||||
import com.vitorpamplona.amethyst.service.relayClient.KeyDataSourceSubscription
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
|
||||
@Composable
|
||||
fun DiscoveryFilterAssemblerSubscription(accountViewModel: AccountViewModel) {
|
||||
DiscoveryFilterAssemblerSubscription(
|
||||
accountViewModel.dataSources().discovery,
|
||||
accountViewModel,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun DiscoveryFilterAssemblerSubscription(
|
||||
dataSource: DiscoveryFilterAssembler,
|
||||
|
||||
+2
-1
@@ -96,7 +96,8 @@ fun HomeScreen(
|
||||
|
||||
WatchLifecycleAndUpdateModel(newThreadsFeedState)
|
||||
WatchLifecycleAndUpdateModel(repliesFeedState)
|
||||
HomeFilterAssemblerSubscription(accountViewModel.dataSources().home, accountViewModel)
|
||||
|
||||
HomeFilterAssemblerSubscription(accountViewModel)
|
||||
|
||||
AssembleHomeTabs(newThreadsFeedState, repliesFeedState) { pagerState, tabItems ->
|
||||
HomePages(pagerState, tabItems, accountViewModel, nav)
|
||||
|
||||
+8
@@ -26,6 +26,14 @@ import androidx.lifecycle.viewModelScope
|
||||
import com.vitorpamplona.amethyst.service.relayClient.KeyDataSourceSubscription
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
|
||||
@Composable
|
||||
fun HomeFilterAssemblerSubscription(accountViewModel: AccountViewModel) {
|
||||
HomeFilterAssemblerSubscription(
|
||||
accountViewModel.dataSources().home,
|
||||
accountViewModel,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun HomeFilterAssemblerSubscription(
|
||||
dataSource: HomeFilterAssembler,
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ fun VideoScreen(
|
||||
) {
|
||||
WatchLifecycleAndUpdateModel(videoFeedContentState)
|
||||
WatchAccountForVideoScreen(videoFeedContentState = videoFeedContentState, accountViewModel = accountViewModel)
|
||||
VideoFilterAssemblerSubscription(accountViewModel.dataSources().video, accountViewModel)
|
||||
VideoFilterAssemblerSubscription(accountViewModel)
|
||||
|
||||
DisappearingScaffold(
|
||||
isInvertedLayout = false,
|
||||
|
||||
+8
@@ -26,6 +26,14 @@ import androidx.lifecycle.viewModelScope
|
||||
import com.vitorpamplona.amethyst.service.relayClient.KeyDataSourceSubscription
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
|
||||
@Composable
|
||||
fun VideoFilterAssemblerSubscription(accountViewModel: AccountViewModel) {
|
||||
VideoFilterAssemblerSubscription(
|
||||
accountViewModel.dataSources().video,
|
||||
accountViewModel,
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun VideoFilterAssemblerSubscription(
|
||||
filterAssembler: VideoFilterAssembler,
|
||||
|
||||
Reference in New Issue
Block a user