search screen crash fix
This commit is contained in:
parent
bd3cc2bce3
commit
0c0fd57ad5
4 changed files with 19 additions and 9 deletions
|
|
@ -25,7 +25,7 @@
|
|||
android:theme="@style/Theme.MyApplication">
|
||||
<meta-data
|
||||
android:name="io.sentry.dsn"
|
||||
android:value="https://fb3eb21fc3c09b22c9986c14fbf69214@o4509536317276160.ingest.de.sentry.io/4510874743734352" />
|
||||
android:value="https://151aefbf907d5fd4a6c8533d9d064441@o4510894222278656.ingest.us.sentry.io/4510894227259392" />
|
||||
<meta-data
|
||||
android:name="io.sentry.send-default-pii"
|
||||
android:value="true" />
|
||||
|
|
@ -50,7 +50,6 @@
|
|||
<meta-data
|
||||
android:name="io.sentry.traces.profiling.start-on-app-start"
|
||||
android:value="true" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ fun CatalogRowSection(
|
|||
trailerPreviewUrls: Map<String, String> = emptyMap(),
|
||||
onRequestTrailerPreview: (MetaPreview) -> Unit = {},
|
||||
modifier: Modifier = Modifier,
|
||||
enableRowFocusRestorer: Boolean = true,
|
||||
initialScrollIndex: Int = 0,
|
||||
focusedItemIndex: Int = -1,
|
||||
onItemFocused: (itemIndex: Int) -> Unit = {},
|
||||
|
|
@ -118,7 +119,7 @@ fun CatalogRowSection(
|
|||
.fillMaxWidth()
|
||||
.focusRequester(rowFocusRequester)
|
||||
.then(
|
||||
if (focusedItemIndex < 0 && catalogRow.items.isNotEmpty()) {
|
||||
if (enableRowFocusRestorer && focusedItemIndex < 0 && catalogRow.items.isNotEmpty()) {
|
||||
Modifier.focusRestorer {
|
||||
val visibleIndex = listState.layoutInfo.visibleItemsInfo
|
||||
.firstOrNull()
|
||||
|
|
|
|||
|
|
@ -61,11 +61,13 @@ class MetaDetailsViewModel @Inject constructor(
|
|||
private var trailerFetchJob: Job? = null
|
||||
|
||||
private var trailerDelayMs = 7000L
|
||||
private var trailerAutoplayEnabled = false
|
||||
|
||||
private var isPlayButtonFocused = false
|
||||
|
||||
init {
|
||||
observeMetaViewSettings()
|
||||
observeTrailerAutoplaySettings()
|
||||
observeLibraryState()
|
||||
observeWatchProgress()
|
||||
observeWatchedEpisodes()
|
||||
|
|
@ -82,6 +84,18 @@ class MetaDetailsViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun observeTrailerAutoplaySettings() {
|
||||
viewModelScope.launch {
|
||||
trailerSettingsDataStore.settings.collectLatest { settings ->
|
||||
trailerAutoplayEnabled = settings.enabled
|
||||
trailerDelayMs = settings.delaySeconds * 1000L
|
||||
if (!settings.enabled) {
|
||||
idleTimerJob?.cancel()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun onEvent(event: MetaDetailsEvent) {
|
||||
when (event) {
|
||||
is MetaDetailsEvent.OnSeasonSelected -> selectSeason(event.season)
|
||||
|
|
@ -865,12 +879,6 @@ class MetaDetailsViewModel @Inject constructor(
|
|||
|
||||
trailerFetchJob?.cancel()
|
||||
trailerFetchJob = viewModelScope.launch {
|
||||
// Check if trailers are enabled in settings
|
||||
val settings = trailerSettingsDataStore.settings.first()
|
||||
if (!settings.enabled) return@launch
|
||||
|
||||
trailerDelayMs = settings.delaySeconds * 1000L
|
||||
|
||||
_uiState.update { it.copy(isTrailerLoading = true) }
|
||||
|
||||
val year = meta.releaseInfo?.split("-")?.firstOrNull()
|
||||
|
|
@ -908,6 +916,7 @@ class MetaDetailsViewModel @Inject constructor(
|
|||
|
||||
val state = _uiState.value
|
||||
if (state.trailerUrl == null || state.isTrailerPlaying) return
|
||||
if (!trailerAutoplayEnabled) return
|
||||
if (!isPlayButtonFocused) return
|
||||
|
||||
idleTimerJob = viewModelScope.launch {
|
||||
|
|
|
|||
|
|
@ -325,6 +325,7 @@ fun SearchScreen(
|
|||
catalogRow = catalogRow,
|
||||
showPosterLabels = uiState.posterLabelsEnabled,
|
||||
showAddonName = uiState.catalogAddonNameEnabled,
|
||||
enableRowFocusRestorer = false,
|
||||
focusedItemIndex = if (focusResults && index == 0) 0 else -1,
|
||||
onItemFocused = {
|
||||
if (focusResults) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue