diff --git a/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt b/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt index cfe618b07..8a3b1f9fe 100644 --- a/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/MoreScreen.kt @@ -144,7 +144,7 @@ fun MoreScreen( } item { TextPreferenceWidget( - title = stringResource(MR.strings.label_backup_and_sync), + title = stringResource(MR.strings.label_data_storage), icon = Icons.Outlined.Storage, onPreferenceClick = onClickDataAndStorage, ) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt index 8029ef35a..45e3b38bd 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt @@ -65,7 +65,7 @@ object SettingsDataScreen : SearchableSettings { @ReadOnlyComposable @Composable - override fun getTitleRes() = MR.strings.label_backup_and_sync + override fun getTitleRes() = MR.strings.label_data_storage @Composable override fun getPreferences(): List { @@ -79,23 +79,7 @@ object SettingsDataScreen : SearchableSettings { return listOf( getBackupAndRestoreGroup(backupPreferences = backupPreferences), getDataGroup(), - ) + listOf( - Preference.PreferenceGroup( - title = stringResource(MR.strings.label_sync), - preferenceItems = listOf( - Preference.PreferenceItem.ListPreference( - pref = syncPreferences.syncService(), - title = stringResource(MR.strings.pref_sync_service), - entries = mapOf( - SyncManager.SyncService.NONE.value to stringResource(MR.strings.off), - SyncManager.SyncService.SYNCYOMI.value to stringResource(MR.strings.syncyomi), - SyncManager.SyncService.GOOGLE_DRIVE.value to stringResource(MR.strings.google_drive), - ), - onValueChanged = { true }, - ), - ), - ), - ) + getSyncServicePreferences(syncPreferences, syncService) + ) + getSyncPreferences(syncPreferences = syncPreferences, syncService = syncService) } @Composable @@ -342,21 +326,51 @@ object SettingsDataScreen : SearchableSettings { ) } } + + @Composable + private fun getSyncPreferences(syncPreferences: SyncPreferences, syncService: Int): List { + return listOf( + Preference.PreferenceItem.ListPreference( + pref = syncPreferences.syncService(), + title = stringResource(MR.strings.pref_sync_service), + entries = mapOf( + SyncManager.SyncService.NONE.value to stringResource(MR.strings.off), + SyncManager.SyncService.SYNCYOMI.value to stringResource(MR.strings.syncyomi), + SyncManager.SyncService.GOOGLE_DRIVE.value to stringResource(MR.strings.google_drive), + ), + onValueChanged = { true }, + ), + ) + getSyncServicePreferences(syncPreferences, syncService) + } + } @Composable private fun getSyncServicePreferences(syncPreferences: SyncPreferences, syncService: Int): List { val syncServiceType = SyncManager.SyncService.fromInt(syncService) + + val basePreferences = getBasePreferences(syncServiceType, syncPreferences) + + return if (syncServiceType != SyncManager.SyncService.NONE) { + basePreferences + getAdditionalPreferences(syncPreferences) + } else { + basePreferences + } +} + + +@Composable +private fun getBasePreferences(syncServiceType: SyncManager.SyncService, syncPreferences: SyncPreferences): List { return when (syncServiceType) { SyncManager.SyncService.NONE -> emptyList() SyncManager.SyncService.SYNCYOMI -> getSelfHostPreferences(syncPreferences) SyncManager.SyncService.GOOGLE_DRIVE -> getGoogleDrivePreferences() - } + - if (syncServiceType == SyncManager.SyncService.NONE) { - emptyList() - } else { - listOf(getSyncNowPref(), getAutomaticSyncGroup(syncPreferences)) - } + } +} + +@Composable +private fun getAdditionalPreferences(syncPreferences: SyncPreferences): List { + return listOf(getSyncNowPref(), getAutomaticSyncGroup(syncPreferences)) } @Composable diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt index 5ccbdd7c0..cfb010e59 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsMainScreen.kt @@ -209,7 +209,7 @@ object SettingsMainScreen : Screen() { screen = SettingsBrowseScreen, ), Item( - titleRes = MR.strings.label_backup_and_sync, + titleRes = MR.strings.label_data_storage, subtitleRes = MR.strings.pref_backup_summary, icon = Icons.Outlined.Storage, screen = SettingsDataScreen, diff --git a/i18n/src/commonMain/resources/MR/base/strings.xml b/i18n/src/commonMain/resources/MR/base/strings.xml index 0d14e63b0..a5f9090d1 100644 --- a/i18n/src/commonMain/resources/MR/base/strings.xml +++ b/i18n/src/commonMain/resources/MR/base/strings.xml @@ -30,7 +30,6 @@ Sources Data and storage Backup - Backup and Sync Sync Statistics Migrate