diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBackupAndSyncScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBackupAndSyncScreen.kt index 42190ca80..cd7ca1c04 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBackupAndSyncScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBackupAndSyncScreen.kt @@ -86,8 +86,9 @@ object SettingsBackupAndSyncScreen : SearchableSettings { pref = syncPreferences.syncService(), title = stringResource(R.string.pref_sync_service), entries = mapOf( - SyncManager.SyncService.GOOGLE_DRIVE.value to stringResource(R.string.google_drive), + SyncManager.SyncService.NONE.value to stringResource(R.string.off), SyncManager.SyncService.SYNCYOMI.value to stringResource(R.string.syncyomi), + SyncManager.SyncService.GOOGLE_DRIVE.value to stringResource(R.string.google_drive), ), onValueChanged = { true }, ), @@ -423,12 +424,15 @@ object SettingsBackupAndSyncScreen : SearchableSettings { private fun getSyncServicePreferences(syncPreferences: SyncPreferences, syncService: Int): List { val syncServiceType = SyncManager.SyncService.fromInt(syncService) return when (syncServiceType) { + SyncManager.SyncService.NONE -> emptyList() SyncManager.SyncService.SYNCYOMI -> getSelfHostPreferences(syncPreferences) SyncManager.SyncService.GOOGLE_DRIVE -> getGoogleDrivePreferences() - else -> { + } + + if (syncServiceType == SyncManager.SyncService.NONE) { emptyList() + } else { + listOf(getSyncNowPref(), getAutomaticSyncGroup(syncPreferences)) } - } + listOf(getSyncNowPref(), getAutomaticSyncGroup(syncPreferences)) } @Composable diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/sync/SyncManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/sync/SyncManager.kt index 388d5973a..7dcee9851 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/sync/SyncManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/sync/SyncManager.kt @@ -57,12 +57,13 @@ class SyncManager( private val backupRestorer: BackupRestorer = BackupRestorer(context, backupNotify) enum class SyncService(val value: Int) { - GOOGLE_DRIVE(1), - SYNCYOMI(2), + NONE(0), + SYNCYOMI(1), + GOOGLE_DRIVE(2), ; companion object { - fun fromInt(value: Int) = entries.firstOrNull { it.value == value } ?: 1 + fun fromInt(value: Int) = values().firstOrNull { it.value == value } ?: NONE } } diff --git a/domain/src/main/java/tachiyomi/domain/sync/SyncPreferences.kt b/domain/src/main/java/tachiyomi/domain/sync/SyncPreferences.kt index bbc48d275..8e7fa8499 100644 --- a/domain/src/main/java/tachiyomi/domain/sync/SyncPreferences.kt +++ b/domain/src/main/java/tachiyomi/domain/sync/SyncPreferences.kt @@ -14,7 +14,7 @@ class SyncPreferences( fun deviceName() = preferenceStore.getString("device_name", android.os.Build.MANUFACTURER + android.os.Build.PRODUCT) - fun syncService() = preferenceStore.getInt("sync_service", 1) + fun syncService() = preferenceStore.getInt("sync_service", 0) private fun googleDriveAccessToken() = preferenceStore.getString("google_drive_access_token", "")