mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 23:12:12 +00:00
ref: integrate profile state management in HomeScreen and clear HomeRepository on profile change
This commit is contained in:
parent
632f5571e1
commit
ebc695cbc5
2 changed files with 8 additions and 2 deletions
|
|
@ -45,6 +45,7 @@ import com.nuvio.app.features.watchprogress.toUpNextContinueWatchingItem
|
|||
import com.nuvio.app.features.watching.application.WatchingState
|
||||
import com.nuvio.app.features.watching.domain.WatchingContentRef
|
||||
import com.nuvio.app.features.collection.CollectionRepository
|
||||
import com.nuvio.app.features.profiles.ProfileRepository
|
||||
import com.nuvio.app.features.home.components.HomeCollectionRowSection
|
||||
import com.nuvio.app.features.watchprogress.ContinueWatchingSectionStyle
|
||||
import kotlinx.coroutines.async
|
||||
|
|
@ -149,9 +150,12 @@ fun HomeScreen(
|
|||
latestCompletedBySeries = latestCompletedBySeries,
|
||||
)
|
||||
}
|
||||
var nextUpItemsBySeries by remember { mutableStateOf<Map<String, Pair<Long, ContinueWatchingItem>>>(emptyMap()) }
|
||||
val profileState by ProfileRepository.state.collectAsStateWithLifecycle()
|
||||
val activeProfileId = profileState.activeProfile?.profileIndex ?: 1
|
||||
|
||||
val cachedSnapshots = remember { ContinueWatchingEnrichmentCache.getSnapshots() }
|
||||
var nextUpItemsBySeries by remember(activeProfileId) { mutableStateOf<Map<String, Pair<Long, ContinueWatchingItem>>>(emptyMap()) }
|
||||
|
||||
val cachedSnapshots = remember(activeProfileId) { ContinueWatchingEnrichmentCache.getSnapshots() }
|
||||
val cachedNextUpItems = remember(cachedSnapshots.first, continueWatchingPreferences.dismissedNextUpKeys) {
|
||||
cachedSnapshots.first.mapNotNull { cached ->
|
||||
if (nextUpDismissKey(cached.contentId, cached.seedSeason, cached.seedEpisode) in continueWatchingPreferences.dismissedNextUpKeys) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.nuvio.app.features.collection.CollectionRepository
|
|||
import com.nuvio.app.features.downloads.DownloadsRepository
|
||||
import com.nuvio.app.features.details.MetaScreenSettingsRepository
|
||||
import com.nuvio.app.features.home.HomeCatalogSettingsRepository
|
||||
import com.nuvio.app.features.home.HomeRepository
|
||||
import com.nuvio.app.core.ui.PosterCardStyleRepository
|
||||
import com.nuvio.app.features.library.LibraryRepository
|
||||
import com.nuvio.app.features.mdblist.MdbListSettingsRepository
|
||||
|
|
@ -138,6 +139,7 @@ object ProfileRepository {
|
|||
PosterCardStyleRepository.onProfileChanged()
|
||||
PlayerSettingsRepository.onProfileChanged()
|
||||
HomeCatalogSettingsRepository.onProfileChanged()
|
||||
HomeRepository.clear()
|
||||
MetaScreenSettingsRepository.onProfileChanged()
|
||||
ContinueWatchingPreferencesRepository.onProfileChanged()
|
||||
EpisodeReleaseNotificationsRepository.onProfileChanged()
|
||||
|
|
|
|||
Loading…
Reference in a new issue