mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-15 15:02:49 +01:00
chore: lint
This commit is contained in:
parent
2f9f673326
commit
d407d698c8
@ -70,7 +70,8 @@ abstract class SyncService(
|
|||||||
val mergedCategoriesList =
|
val mergedCategoriesList =
|
||||||
mergeCategoriesLists(localSyncData.backup?.backupCategories, remoteSyncData.backup?.backupCategories)
|
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 =
|
val mergedPreferencesList =
|
||||||
mergePreferencesLists(localSyncData.backup?.backupPreferences, remoteSyncData.backup?.backupPreferences)
|
mergePreferencesLists(localSyncData.backup?.backupPreferences, remoteSyncData.backup?.backupPreferences)
|
||||||
val mergedSourcePreferencesList = mergeSourcePreferencesLists(
|
val mergedSourcePreferencesList = mergeSourcePreferencesLists(
|
||||||
@ -331,7 +332,7 @@ abstract class SyncService(
|
|||||||
|
|
||||||
private fun mergeSourcesLists(
|
private fun mergeSourcesLists(
|
||||||
localSources: List<BackupSource>?,
|
localSources: List<BackupSource>?,
|
||||||
remoteSources: List<BackupSource>?
|
remoteSources: List<BackupSource>?,
|
||||||
): List<BackupSource> {
|
): List<BackupSource> {
|
||||||
val logTag = "MergeSources"
|
val logTag = "MergeSources"
|
||||||
|
|
||||||
@ -376,7 +377,7 @@ abstract class SyncService(
|
|||||||
|
|
||||||
private fun mergePreferencesLists(
|
private fun mergePreferencesLists(
|
||||||
localPreferences: List<BackupPreference>?,
|
localPreferences: List<BackupPreference>?,
|
||||||
remotePreferences: List<BackupPreference>?
|
remotePreferences: List<BackupPreference>?,
|
||||||
): List<BackupPreference> {
|
): List<BackupPreference> {
|
||||||
val logTag = "MergePreferences"
|
val logTag = "MergePreferences"
|
||||||
|
|
||||||
@ -424,7 +425,7 @@ abstract class SyncService(
|
|||||||
|
|
||||||
private fun mergeSourcePreferencesLists(
|
private fun mergeSourcePreferencesLists(
|
||||||
localPreferences: List<BackupSourcePreferences>?,
|
localPreferences: List<BackupSourcePreferences>?,
|
||||||
remotePreferences: List<BackupSourcePreferences>?
|
remotePreferences: List<BackupSourcePreferences>?,
|
||||||
): List<BackupSourcePreferences> {
|
): List<BackupSourcePreferences> {
|
||||||
val logTag = "MergeSourcePreferences"
|
val logTag = "MergeSourcePreferences"
|
||||||
|
|
||||||
@ -438,7 +439,8 @@ abstract class SyncService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Merge both source preferences maps
|
// Merge both source preferences maps
|
||||||
val mergedSourcePreferences = (localPreferencesMap.keys + remotePreferencesMap.keys).distinct().mapNotNull { sourceKey ->
|
val mergedSourcePreferences = (localPreferencesMap.keys + remotePreferencesMap.keys).distinct().mapNotNull {
|
||||||
|
sourceKey ->
|
||||||
val localSourcePreference = localPreferencesMap[sourceKey]
|
val localSourcePreference = localPreferencesMap[sourceKey]
|
||||||
val remoteSourcePreference = remotePreferencesMap[sourceKey]
|
val remoteSourcePreference = remotePreferencesMap[sourceKey]
|
||||||
|
|
||||||
@ -463,7 +465,8 @@ abstract class SyncService(
|
|||||||
}
|
}
|
||||||
localSourcePreference != null && remoteSourcePreference != null -> {
|
localSourcePreference != null && remoteSourcePreference != null -> {
|
||||||
// Merge the individual preferences within the source preferences
|
// 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)
|
BackupSourcePreferences(sourceKey, mergedPrefs)
|
||||||
}
|
}
|
||||||
else -> null
|
else -> null
|
||||||
@ -479,7 +482,7 @@ abstract class SyncService(
|
|||||||
|
|
||||||
private fun mergeIndividualPreferences(
|
private fun mergeIndividualPreferences(
|
||||||
localPrefs: List<BackupPreference>,
|
localPrefs: List<BackupPreference>,
|
||||||
remotePrefs: List<BackupPreference>
|
remotePrefs: List<BackupPreference>,
|
||||||
): List<BackupPreference> {
|
): List<BackupPreference> {
|
||||||
val mergedPrefsMap = (localPrefs + remotePrefs).associateBy { it.key }
|
val mergedPrefsMap = (localPrefs + remotePrefs).associateBy { it.key }
|
||||||
return mergedPrefsMap.values.toList()
|
return mergedPrefsMap.values.toList()
|
||||||
|
Loading…
Reference in New Issue
Block a user