mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-15 15:02:49 +01:00
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:
parent
19227d6c5b
commit
71872ead81
@ -435,11 +435,6 @@ fun PurgeConfirmationDialog(
|
||||
@Composable
|
||||
private fun getSelfHostPreferences(syncPreferences: SyncPreferences): List<Preference> {
|
||||
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),
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
)
|
||||
|
@ -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(
|
||||
|
@ -533,8 +533,6 @@
|
||||
<string name="sync_error">Syncing library failed</string>
|
||||
<string name="sync_complete">Syncing library complete</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_summ">Enter the host address for synchronizing your library</string>
|
||||
<string name="pref_sync_api_key">API key</string>
|
||||
|
Loading…
Reference in New Issue
Block a user