mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-11-05 18:30:59 +01:00
Fix favorites not querying for people & fix restoring focus on search page for discover items (#1961)
## Description Fix two bugs: - Favorites page didn't query for favorite people, introduced by #1864 - Fixes restoring focus on the search page after clicking a discover item and going back ### Related issues N/A ### Testing Emulator ## Screenshots N/A ## AI or LLM usage None
This commit is contained in:
parent
2fb295cbed
commit
45c1ceca27
3 changed files with 12 additions and 3 deletions
|
|
@ -787,7 +787,9 @@ fun List<Library>.possibleFavoriteTypes(sort: Boolean) =
|
|||
flatMap { it.collectionType.baseItemKinds }
|
||||
.distinct()
|
||||
.filter { it in favoriteOptions }
|
||||
.let { list ->
|
||||
.let {
|
||||
// No library for persons, so always include it
|
||||
val list = it + listOf(BaseItemKind.PERSON)
|
||||
if (sort) {
|
||||
list.sortedWith(compareBy { favoriteOptions.indexOf(it) })
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ fun SearchPage(
|
|||
val focusRequesters =
|
||||
remember(state.includedSearchableTypes.size) { List(RESULTS_START + state.includedSearchableTypes.size) { FocusRequester() } }
|
||||
|
||||
val seerrActive by viewModel.seerrActive.collectAsState(initial = false)
|
||||
val seerrActive by viewModel.seerrActive.collectAsState()
|
||||
var selectedTab by rememberSaveable(seerrActive, state.discoverEnabled) { mutableIntStateOf(0) }
|
||||
var showViewOptions by rememberSaveable { mutableStateOf(false) }
|
||||
var showFilterTypeDialog by rememberSaveable { mutableStateOf(false) }
|
||||
|
|
|
|||
|
|
@ -43,9 +43,11 @@ import dagger.hilt.android.lifecycle.HiltViewModel
|
|||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jellyfin.sdk.api.client.ApiClient
|
||||
|
|
@ -79,7 +81,12 @@ class SearchViewModel
|
|||
private val navDrawerService: NavDrawerService,
|
||||
) : ViewModel(),
|
||||
ContextMenuProvider {
|
||||
val seerrActive = seerrService.active
|
||||
val seerrActive =
|
||||
seerrService.active.stateIn(
|
||||
scope = viewModelScope,
|
||||
started = SharingStarted.Eagerly,
|
||||
initialValue = false,
|
||||
)
|
||||
|
||||
private val _state = MutableStateFlow(SearchState())
|
||||
val state: StateFlow<SearchState> = _state
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue