Moves Home and Video screen invalidations to follow the scrollTop parameter
This commit is contained in:
@@ -36,6 +36,7 @@ import com.vitorpamplona.amethyst.ui.screen.FeedViewModel
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.NostrHomeFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrHomeFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.NostrHomeRepliesFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrHomeRepliesFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys
|
import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@@ -58,9 +59,6 @@ fun HomeScreen(
|
|||||||
LaunchedEffect(accountViewModel, account.defaultHomeFollowList) {
|
LaunchedEffect(accountViewModel, account.defaultHomeFollowList) {
|
||||||
HomeNewThreadFeedFilter.account = account
|
HomeNewThreadFeedFilter.account = account
|
||||||
HomeConversationsFeedFilter.account = account
|
HomeConversationsFeedFilter.account = account
|
||||||
NostrHomeDataSource.resetFilters()
|
|
||||||
homeFeedViewModel.invalidateData()
|
|
||||||
repliesFeedViewModel.invalidateData()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wantsToAddNip47 != null) {
|
if (wantsToAddNip47 != null) {
|
||||||
@@ -73,9 +71,6 @@ fun HomeScreen(
|
|||||||
if (event == Lifecycle.Event.ON_RESUME) {
|
if (event == Lifecycle.Event.ON_RESUME) {
|
||||||
HomeNewThreadFeedFilter.account = account
|
HomeNewThreadFeedFilter.account = account
|
||||||
HomeConversationsFeedFilter.account = account
|
HomeConversationsFeedFilter.account = account
|
||||||
NostrHomeDataSource.resetFilters()
|
|
||||||
homeFeedViewModel.invalidateData()
|
|
||||||
repliesFeedViewModel.invalidateData()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,6 +80,17 @@ fun HomeScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scrollToTop) {
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
LaunchedEffect(key1 = Unit) {
|
||||||
|
scope.launch(Dispatchers.IO) {
|
||||||
|
NostrHomeDataSource.resetFilters()
|
||||||
|
homeFeedViewModel.invalidateData(true)
|
||||||
|
repliesFeedViewModel.invalidateData(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val tabs by remember(homeFeedViewModel, repliesFeedViewModel) {
|
val tabs by remember(homeFeedViewModel, repliesFeedViewModel) {
|
||||||
mutableStateOf(
|
mutableStateOf(
|
||||||
listOf(
|
listOf(
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ import com.vitorpamplona.amethyst.ui.screen.LoadingFeed
|
|||||||
import com.vitorpamplona.amethyst.ui.screen.NostrVideoFeedViewModel
|
import com.vitorpamplona.amethyst.ui.screen.NostrVideoFeedViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys
|
import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys
|
||||||
import com.vitorpamplona.amethyst.ui.screen.rememberForeverPagerState
|
import com.vitorpamplona.amethyst.ui.screen.rememberForeverPagerState
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@@ -109,11 +110,19 @@ fun VideoScreen(
|
|||||||
NostrVideoDataSource.account = account
|
NostrVideoDataSource.account = account
|
||||||
VideoFeedFilter.account = account
|
VideoFeedFilter.account = account
|
||||||
|
|
||||||
|
if (scrollToTop) {
|
||||||
|
val scope = rememberCoroutineScope()
|
||||||
|
LaunchedEffect(key1 = Unit) {
|
||||||
|
scope.launch(Dispatchers.IO) {
|
||||||
|
NostrVideoDataSource.resetFilters()
|
||||||
|
videoFeedView.invalidateData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LaunchedEffect(accountViewModel, accountState.value?.account?.defaultStoriesFollowList) {
|
LaunchedEffect(accountViewModel, accountState.value?.account?.defaultStoriesFollowList) {
|
||||||
VideoFeedFilter.account = account
|
VideoFeedFilter.account = account
|
||||||
NostrVideoDataSource.account = account
|
NostrVideoDataSource.account = account
|
||||||
NostrVideoDataSource.resetFilters()
|
|
||||||
videoFeedView.invalidateData()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DisposableEffect(accountViewModel) {
|
DisposableEffect(accountViewModel) {
|
||||||
@@ -123,7 +132,6 @@ fun VideoScreen(
|
|||||||
VideoFeedFilter.account = account
|
VideoFeedFilter.account = account
|
||||||
NostrVideoDataSource.account = account
|
NostrVideoDataSource.account = account
|
||||||
NostrVideoDataSource.start()
|
NostrVideoDataSource.start()
|
||||||
videoFeedView.invalidateData()
|
|
||||||
}
|
}
|
||||||
if (event == Lifecycle.Event.ON_PAUSE) {
|
if (event == Lifecycle.Event.ON_PAUSE) {
|
||||||
println("Video Stop")
|
println("Video Stop")
|
||||||
|
|||||||
Reference in New Issue
Block a user