Update Detekt baseline

This commit is contained in:
Jobobby04
2024-03-16 12:22:18 -04:00
parent 0e959c4594
commit 54cb379a50
4 changed files with 72 additions and 70 deletions
@@ -469,9 +469,10 @@ class GoogleDriveService(private val context: Context) {
}
/**
* Handles the authorization code returned after the user has granted the application permission to access their Google Drive account.
* It obtains the access token and refresh token using the authorization code, saves the tokens to the SyncPreferences,
* sets up the Google Drive service using the obtained tokens, and initializes the service.
* Handles the authorization code returned after the user has granted the application permission to access their
* Google Drive account.
* It obtains the access token and refresh token using the authorization code, saves the tokens to the
* SyncPreferences, sets up the Google Drive service using the obtained tokens, and initializes the service.
* @param authorizationCode The authorization code obtained from the OAuthCallbackServer.
* @param activity The current activity.
* @param onSuccess A callback function to be called on successful authorization.
@@ -70,7 +70,8 @@ abstract class SyncService(
val mergedCategoriesList =
mergeCategoriesLists(localSyncData.backup?.backupCategories, remoteSyncData.backup?.backupCategories)
val mergedSourcesList = mergeSourcesLists(localSyncData.backup?.backupSources, remoteSyncData.backup?.backupSources)
val mergedSourcesList =
mergeSourcesLists(localSyncData.backup?.backupSources, remoteSyncData.backup?.backupSources)
val mergedPreferencesList =
mergePreferencesLists(localSyncData.backup?.backupPreferences, remoteSyncData.backup?.backupPreferences)
val mergedSourcePreferencesList = mergeSourcePreferencesLists(
@@ -85,7 +86,6 @@ abstract class SyncService(
)
// SY <--
// Create the merged Backup object
val mergedBackup = Backup(
backupManga = mergedMangaList,
@@ -150,10 +150,14 @@ abstract class SyncService(
local != null && remote != null -> {
// Compare versions to decide which manga to keep
if (local.version >= remote.version) {
logcat(LogPriority.DEBUG, logTag) { "Keeping local version of ${local.title} with merged chapters." }
logcat(LogPriority.DEBUG, logTag) {
"Keeping local version of ${local.title} with merged chapters."
}
local.copy(chapters = mergeChapters(local.chapters, remote.chapters))
} else {
logcat(LogPriority.DEBUG, logTag) { "Keeping remote version of ${remote.title} with merged chapters." }
logcat(LogPriority.DEBUG, logTag) {
"Keeping remote version of ${remote.title} with merged chapters."
}
remote.copy(chapters = mergeChapters(local.chapters, remote.chapters))
}
}
@@ -227,7 +231,11 @@ abstract class SyncService(
}
localChapter != null && remoteChapter != null -> {
// Use version number to decide which chapter to keep
val chosenChapter = if (localChapter.version >= remoteChapter.version) localChapter else remoteChapter
val chosenChapter = if (localChapter.version >= remoteChapter.version) {
localChapter
} else {
remoteChapter
}
logcat(LogPriority.DEBUG, logTag) {
"Merging chapter: ${chosenChapter.name}. Chosen version from: ${
if (localChapter.version >= remoteChapter.version) "Local" else "Remote"
@@ -427,7 +435,8 @@ abstract class SyncService(
}
localSourcePreference != null && remoteSourcePreference != null -> {
// Merge the individual preferences within the source preferences
val mergedPrefs = mergeIndividualPreferences(localSourcePreference.prefs, remoteSourcePreference.prefs)
val mergedPrefs =
mergeIndividualPreferences(localSourcePreference.prefs, remoteSourcePreference.prefs)
BackupSourcePreferences(sourceKey, mergedPrefs)
}
else -> null
@@ -449,8 +458,6 @@ abstract class SyncService(
return mergedPrefsMap.values.toList()
}
// SY -->
private fun mergeSavedSearchesLists(
localSearches: List<BackupSavedSearch>?,
@@ -507,5 +514,4 @@ abstract class SyncService(
return mergedSearches
}
// SY <--
}
@@ -41,8 +41,8 @@ import eu.kanade.presentation.more.onboarding.GETTING_STARTED_URL
import eu.kanade.presentation.util.Tab
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
import eu.kanade.tachiyomi.ui.browse.migration.advanced.design.PreMigrationScreen
import eu.kanade.tachiyomi.data.sync.SyncDataJob
import eu.kanade.tachiyomi.ui.browse.migration.advanced.design.PreMigrationScreen
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchScreen
import eu.kanade.tachiyomi.ui.category.CategoryScreen
import eu.kanade.tachiyomi.ui.home.HomeScreen
@@ -52,7 +52,6 @@ import eu.kanade.tachiyomi.ui.reader.ReaderActivity
import eu.kanade.tachiyomi.util.system.toast
import exh.favorites.FavoritesSyncStatus
import exh.source.MERGED_SOURCE_ID
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.collectLatest