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 <kaiserbh@proton.me>
This commit is contained in:
KaiserBh 2023-11-14 17:44:15 +11:00
parent 19227d6c5b
commit 71872ead81
No known key found for this signature in database
GPG Key ID: 14D73B142042BBA9
5 changed files with 0 additions and 42 deletions

View File

@ -435,11 +435,6 @@ fun PurgeConfirmationDialog(
@Composable @Composable
private fun getSelfHostPreferences(syncPreferences: SyncPreferences): List<Preference> { private fun getSelfHostPreferences(syncPreferences: SyncPreferences): List<Preference> {
return listOf( 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( Preference.PreferenceItem.EditTextPreference(
title = stringResource(R.string.pref_sync_host), title = stringResource(R.string.pref_sync_host),
subtitle = stringResource(R.string.pref_sync_host_summ), subtitle = stringResource(R.string.pref_sync_host_summ),

View File

@ -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.BackupManga
import eu.kanade.tachiyomi.data.backup.models.BackupSerializer import eu.kanade.tachiyomi.data.backup.models.BackupSerializer
import eu.kanade.tachiyomi.data.sync.models.SyncData 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.GoogleDriveSyncService
import eu.kanade.tachiyomi.data.sync.service.SyncYomiSyncService import eu.kanade.tachiyomi.data.sync.service.SyncYomiSyncService
import kotlinx.serialization.json.Json import kotlinx.serialization.json.Json
@ -32,7 +30,6 @@ import uy.kohesive.injekt.api.get
import java.io.File import java.io.File
import java.io.FileOutputStream import java.io.FileOutputStream
import java.io.IOException import java.io.IOException
import java.time.Instant
import java.util.Date import java.util.Date
/** /**
@ -85,22 +82,9 @@ class SyncManager(
backupCreator.backupSourcePreferences(BackupCreateFlags.AutomaticDefaults), 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 // Create the SyncData object
val syncData = SyncData( val syncData = SyncData(
sync = syncStatus,
backup = backup, backup = backup,
device = device,
) )
// Handle sync based on the selected service // Handle sync based on the selected service

View File

@ -1,23 +1,9 @@
package eu.kanade.tachiyomi.data.sync.models package eu.kanade.tachiyomi.data.sync.models
import eu.kanade.tachiyomi.data.backup.models.Backup import eu.kanade.tachiyomi.data.backup.models.Backup
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable 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 @Serializable
data class SyncData( data class SyncData(
val sync: SyncStatus? = null,
val backup: Backup? = null, val backup: Backup? = null,
val device: SyncDevice? = null,
) )

View File

@ -12,11 +12,6 @@ class SyncPreferences(
fun syncInterval() = preferenceStore.getInt("sync_interval", 0) 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) fun syncService() = preferenceStore.getInt("sync_service", 0)
private fun googleDriveAccessToken() = preferenceStore.getString( private fun googleDriveAccessToken() = preferenceStore.getString(

View File

@ -533,8 +533,6 @@
<string name="sync_error">Syncing library failed</string> <string name="sync_error">Syncing library failed</string>
<string name="sync_complete">Syncing library complete</string> <string name="sync_complete">Syncing library complete</string>
<string name="sync_in_progress">Sync is already in progress</string> <string name="sync_in_progress">Sync is already in progress</string>
<string name="pref_sync_device_name">Device name</string>
<string name="pref_sync_device_name_summ">Enter a name for this device</string>
<string name="pref_sync_host">Host</string> <string name="pref_sync_host">Host</string>
<string name="pref_sync_host_summ">Enter the host address for synchronizing your library</string> <string name="pref_sync_host_summ">Enter the host address for synchronizing your library</string>
<string name="pref_sync_api_key">API key</string> <string name="pref_sync_api_key">API key</string>