Fix downloaded filter unmatched state in manga screen (#8897)

This commit is contained in:
zbue 2023-01-13 11:26:04 +08:00 committed by GitHub
parent db4ae134aa
commit 768bb7b503
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,6 @@ package eu.kanade.presentation.manga
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
@ -76,14 +75,9 @@ fun ChapterSettingsDialog(
) { ) {
when (page) { when (page) {
0 -> { 0 -> {
val forceDownloaded = manga?.forceDownloaded() == true
FilterPage( FilterPage(
downloadFilter = if (forceDownloaded) { downloadFilter = manga?.downloadedFilter ?: TriStateFilter.DISABLED,
TriStateFilter.ENABLED_NOT onDownloadFilterChanged = onDownloadFilterChanged.takeUnless { manga?.forceDownloaded() == true },
} else {
manga?.downloadedFilter
} ?: TriStateFilter.DISABLED,
onDownloadFilterChanged = onDownloadFilterChanged.takeUnless { forceDownloaded },
unreadFilter = manga?.unreadFilter ?: TriStateFilter.DISABLED, unreadFilter = manga?.unreadFilter ?: TriStateFilter.DISABLED,
onUnreadFilterChanged = onUnreadFilterChanged, onUnreadFilterChanged = onUnreadFilterChanged,
bookmarkedFilter = manga?.bookmarkedFilter ?: TriStateFilter.DISABLED, bookmarkedFilter = manga?.bookmarkedFilter ?: TriStateFilter.DISABLED,
@ -158,7 +152,7 @@ private fun SetAsDefaultDialog(
} }
@Composable @Composable
private fun ColumnScope.FilterPage( private fun FilterPage(
downloadFilter: TriStateFilter, downloadFilter: TriStateFilter,
onDownloadFilterChanged: ((TriStateFilter) -> Unit)?, onDownloadFilterChanged: ((TriStateFilter) -> Unit)?,
unreadFilter: TriStateFilter, unreadFilter: TriStateFilter,
@ -184,7 +178,7 @@ private fun ColumnScope.FilterPage(
} }
@Composable @Composable
private fun ColumnScope.SortPage( private fun SortPage(
sortingMode: Long, sortingMode: Long,
sortDescending: Boolean, sortDescending: Boolean,
onItemSelected: (Long) -> Unit, onItemSelected: (Long) -> Unit,
@ -207,7 +201,7 @@ private fun ColumnScope.SortPage(
} }
@Composable @Composable
private fun ColumnScope.DisplayPage( private fun DisplayPage(
displayMode: Long, displayMode: Long,
onItemSelected: (Long) -> Unit, onItemSelected: (Long) -> Unit,
) { ) {