mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-20 17:29:14 +01:00
chore: lint
Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
parent
57f9aed411
commit
8cd7774054
@ -41,9 +41,6 @@ import eu.kanade.tachiyomi.data.sync.SyncDataJob
|
||||
import eu.kanade.tachiyomi.data.sync.SyncManager
|
||||
import eu.kanade.tachiyomi.data.sync.service.GoogleDriveService
|
||||
import eu.kanade.tachiyomi.data.sync.service.GoogleDriveSyncService
|
||||
import eu.kanade.tachiyomi.util.storage.DiskUtil
|
||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.collections.immutable.persistentMapOf
|
||||
@ -284,7 +281,6 @@ object SettingsDataScreen : SearchableSettings {
|
||||
) + getSyncServicePreferences(syncPreferences, syncService)
|
||||
}
|
||||
|
||||
|
||||
@Composable
|
||||
private fun getSyncServicePreferences(syncPreferences: SyncPreferences, syncService: Int): List<Preference> {
|
||||
val syncServiceType = SyncManager.SyncService.fromInt(syncService)
|
||||
@ -505,5 +501,4 @@ object SettingsDataScreen : SearchableSettings {
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -130,11 +130,16 @@ class SyncManager(
|
||||
val backupUri = writeSyncDataToCache(context, newSyncData)
|
||||
logcat(LogPriority.DEBUG) { "Got Backup Uri: $backupUri" }
|
||||
if (backupUri != null) {
|
||||
BackupRestoreJob.start(context, backupUri, sync = true, options = RestoreOptions(
|
||||
BackupRestoreJob.start(
|
||||
context,
|
||||
backupUri,
|
||||
sync = true,
|
||||
options = RestoreOptions(
|
||||
appSettings = true,
|
||||
sourceSettings = true,
|
||||
library = true,
|
||||
))
|
||||
),
|
||||
)
|
||||
} else {
|
||||
logcat(LogPriority.ERROR) { "Failed to write sync data to file" }
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ abstract class SyncService(
|
||||
*/
|
||||
private fun mergeMangaLists(
|
||||
localMangaList: List<BackupManga>?,
|
||||
remoteMangaList: List<BackupManga>?
|
||||
remoteMangaList: List<BackupManga>?,
|
||||
): List<BackupManga> {
|
||||
// Convert null lists to empty to simplify logic
|
||||
val localMangaListSafe = localMangaList.orEmpty()
|
||||
@ -114,15 +114,17 @@ abstract class SyncService(
|
||||
val remoteTime = Instant.ofEpochMilli(remote.lastModifiedAt)
|
||||
val mergedChapters = mergeChapters(local.chapters, remote.chapters)
|
||||
|
||||
if (localTime >= remoteTime) local.copy(chapters = mergedChapters)
|
||||
else remote.copy(chapters = mergedChapters)
|
||||
if (localTime >= remoteTime) {
|
||||
local.copy(chapters = mergedChapters)
|
||||
} else {
|
||||
remote.copy(chapters = mergedChapters)
|
||||
}
|
||||
}
|
||||
else -> null // This case occurs if both are null, which shouldn't happen but is handled for completeness.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Merges two lists of BackupChapter objects, selecting the most recent chapter based on the lastModifiedAt value.
|
||||
* If lastModifiedAt is null for a chapter, it treats that chapter as the oldest possible for comparison purposes.
|
||||
@ -142,7 +144,7 @@ abstract class SyncService(
|
||||
*/
|
||||
private fun mergeChapters(
|
||||
localChapters: List<BackupChapter>,
|
||||
remoteChapters: List<BackupChapter>
|
||||
remoteChapters: List<BackupChapter>,
|
||||
): List<BackupChapter> {
|
||||
// Associate chapters by URL for both local and remote
|
||||
val localChapterMap = localChapters.associateBy { it.url }
|
||||
|
Loading…
Reference in New Issue
Block a user