Add ability to reset chapter flags to defaults

Closes #10063
This commit is contained in:
arkon
2023-10-28 15:28:39 -04:00
parent eed57b80be
commit 118d3b7fcc
7 changed files with 26 additions and 8 deletions

View File

@@ -40,6 +40,7 @@ fun ChapterSettingsDialog(
onSortModeChanged: (Long) -> Unit,
onDisplayModeChanged: (Long) -> Unit,
onSetAsDefault: (applyToExistingManga: Boolean) -> Unit,
onResetToDefault: () -> Unit,
) {
var showSetAsDefaultDialog by rememberSaveable { mutableStateOf(false) }
if (showSetAsDefaultDialog) {
@@ -64,6 +65,13 @@ fun ChapterSettingsDialog(
closeMenu()
},
)
DropdownMenuItem(
text = { Text(stringResource(R.string.action_reset)) },
onClick = {
onResetToDefault()
closeMenu()
},
)
},
) { page ->
Column(

View File

@@ -59,7 +59,7 @@ import okhttp3.Headers
import tachiyomi.core.util.lang.launchNonCancellable
import tachiyomi.core.util.lang.withUIContext
import tachiyomi.core.util.system.logcat
import tachiyomi.domain.manga.repository.MangaRepository
import tachiyomi.domain.manga.interactor.ResetViewerFlags
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@@ -309,7 +309,7 @@ object SettingsAdvancedScreen : SearchableSettings {
subtitle = stringResource(R.string.pref_reset_viewer_flags_summary),
onClick = {
scope.launchNonCancellable {
val success = Injekt.get<MangaRepository>().resetViewerFlags()
val success = Injekt.get<ResetViewerFlags>().await()
withUIContext {
val message = if (success) {
R.string.pref_reset_viewer_flags_success