From 71872ead81803a374ae3f2ef0ad0f52f5d1c3d45 Mon Sep 17 00:00:00 2001 From: KaiserBh Date: Tue, 14 Nov 2023 17:44:15 +1100 Subject: [PATCH] refactor: clean up. - Removed SyncDevice, device name since it's not used anymore by syncyomi server. - Removed SyncStatus, used internally in the server doesn't need the data to be sent from tachi app. - This way we just keep the manga data/backup that we can send to many services more generic. Signed-off-by: KaiserBh --- .../more/settings/screen/SettingsDataScreen.kt | 5 ----- .../eu/kanade/tachiyomi/data/sync/SyncManager.kt | 16 ---------------- .../eu/kanade/tachiyomi/data/sync/models/Sync.kt | 14 -------------- .../tachiyomi/domain/sync/SyncPreferences.kt | 5 ----- i18n/src/main/res/values/strings.xml | 2 -- 5 files changed, 42 deletions(-) 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 381f1abe9..9a22457da 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 @@ -435,11 +435,6 @@ fun PurgeConfirmationDialog( @Composable private fun getSelfHostPreferences(syncPreferences: SyncPreferences): List { return listOf( - Preference.PreferenceItem.EditTextPreference( - title = stringResource(R.string.pref_sync_device_name), - subtitle = stringResource(R.string.pref_sync_device_name_summ), - pref = syncPreferences.deviceName(), - ), Preference.PreferenceItem.EditTextPreference( title = stringResource(R.string.pref_sync_host), subtitle = stringResource(R.string.pref_sync_host_summ), 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 dd629cd14..52219cd93 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 @@ -12,8 +12,6 @@ import eu.kanade.tachiyomi.data.backup.models.BackupChapter import eu.kanade.tachiyomi.data.backup.models.BackupManga import eu.kanade.tachiyomi.data.backup.models.BackupSerializer import eu.kanade.tachiyomi.data.sync.models.SyncData -import eu.kanade.tachiyomi.data.sync.models.SyncDevice -import eu.kanade.tachiyomi.data.sync.models.SyncStatus import eu.kanade.tachiyomi.data.sync.service.GoogleDriveSyncService import eu.kanade.tachiyomi.data.sync.service.SyncYomiSyncService import kotlinx.serialization.json.Json @@ -32,7 +30,6 @@ import uy.kohesive.injekt.api.get import java.io.File import java.io.FileOutputStream import java.io.IOException -import java.time.Instant import java.util.Date /** @@ -85,22 +82,9 @@ class SyncManager( backupCreator.backupSourcePreferences(BackupCreateFlags.AutomaticDefaults), ) - // Create the SyncStatus object - val syncStatus = SyncStatus( - lastSynced = Instant.now().toString(), - status = "completed", - ) - - // Create the Device object - val device = SyncDevice( - name = syncPreferences.deviceName().get(), - ) - // Create the SyncData object val syncData = SyncData( - sync = syncStatus, backup = backup, - device = device, ) // Handle sync based on the selected service diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/sync/models/Sync.kt b/app/src/main/java/eu/kanade/tachiyomi/data/sync/models/Sync.kt index bcac22513..13640eebb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/sync/models/Sync.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/sync/models/Sync.kt @@ -1,23 +1,9 @@ package eu.kanade.tachiyomi.data.sync.models import eu.kanade.tachiyomi.data.backup.models.Backup -import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -@Serializable -data class SyncStatus( - @SerialName("last_synced") val lastSynced: String? = null, - val status: String? = null, -) - -@Serializable -data class SyncDevice( - val name: String? = null, -) - @Serializable data class SyncData( - val sync: SyncStatus? = null, val backup: Backup? = null, - val device: SyncDevice? = null, ) diff --git a/domain/src/main/java/tachiyomi/domain/sync/SyncPreferences.kt b/domain/src/main/java/tachiyomi/domain/sync/SyncPreferences.kt index 789d01c7a..9c4d99970 100644 --- a/domain/src/main/java/tachiyomi/domain/sync/SyncPreferences.kt +++ b/domain/src/main/java/tachiyomi/domain/sync/SyncPreferences.kt @@ -12,11 +12,6 @@ class SyncPreferences( fun syncInterval() = preferenceStore.getInt("sync_interval", 0) - fun deviceName() = preferenceStore.getString( - Preference.appStateKey("device_name"), - android.os.Build.MANUFACTURER + android.os.Build.PRODUCT, - ) - fun syncService() = preferenceStore.getInt("sync_service", 0) private fun googleDriveAccessToken() = preferenceStore.getString( diff --git a/i18n/src/main/res/values/strings.xml b/i18n/src/main/res/values/strings.xml index 72822bbb9..9d7c21bab 100644 --- a/i18n/src/main/res/values/strings.xml +++ b/i18n/src/main/res/values/strings.xml @@ -533,8 +533,6 @@ Syncing library failed Syncing library complete Sync is already in progress - Device name - Enter a name for this device Host Enter the host address for synchronizing your library API key