Option to not backup Saved searches & Feeds
This commit is contained in:
parent
982ffe94da
commit
87133eb571
6 changed files with 39 additions and 18 deletions
|
|
@ -106,11 +106,11 @@ class BackupCreator(
|
|||
backupSourcePreferences = backupSourcePreferences(options),
|
||||
|
||||
// SY -->
|
||||
backupSavedSearches = backupSavedSearches(),
|
||||
backupSavedSearches = backupSavedSearches(options),
|
||||
// SY <--
|
||||
|
||||
// KMK -->
|
||||
backupFeeds = backupFeeds(),
|
||||
backupFeeds = backupFeeds(options),
|
||||
// KMK <--
|
||||
)
|
||||
|
||||
|
|
@ -179,8 +179,10 @@ class BackupCreator(
|
|||
}
|
||||
|
||||
// SY -->
|
||||
suspend fun backupSavedSearches(): List<BackupSavedSearch> {
|
||||
return savedSearchBackupCreator.backupSavedSearches()
|
||||
suspend fun backupSavedSearches(options: BackupOptions): List<BackupSavedSearch> {
|
||||
if (!options.savedSearchesFeeds) return emptyList()
|
||||
|
||||
return savedSearchBackupCreator()
|
||||
}
|
||||
// SY <--
|
||||
|
||||
|
|
@ -188,8 +190,10 @@ class BackupCreator(
|
|||
/**
|
||||
* Backup global Popular/Latest feeds
|
||||
*/
|
||||
suspend fun backupFeeds(): List<BackupFeed> {
|
||||
return feedBackupCreator.backupFeeds()
|
||||
suspend fun backupFeeds(options: BackupOptions): List<BackupFeed> {
|
||||
if (!options.savedSearchesFeeds) return emptyList()
|
||||
|
||||
return feedBackupCreator()
|
||||
}
|
||||
// KMK <--
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.backup.create
|
|||
import dev.icerock.moko.resources.StringResource
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import tachiyomi.i18n.MR
|
||||
import tachiyomi.i18n.kmk.KMR
|
||||
import tachiyomi.i18n.sy.SYMR
|
||||
|
||||
data class BackupOptions(
|
||||
|
|
@ -18,6 +19,7 @@ data class BackupOptions(
|
|||
// SY -->
|
||||
val customInfo: Boolean = true,
|
||||
val readEntries: Boolean = true,
|
||||
val savedSearchesFeeds: Boolean = true,
|
||||
// SY <--
|
||||
) {
|
||||
|
||||
|
|
@ -34,10 +36,12 @@ data class BackupOptions(
|
|||
// SY -->
|
||||
customInfo,
|
||||
readEntries,
|
||||
savedSearchesFeeds,
|
||||
// SY <--
|
||||
)
|
||||
|
||||
fun canCreate() = libraryEntries || categories || appSettings || extensionRepoSettings || sourceSettings
|
||||
fun canCreate() =
|
||||
libraryEntries || categories || appSettings || extensionRepoSettings || sourceSettings || savedSearchesFeeds
|
||||
|
||||
companion object {
|
||||
val libraryOptions = persistentListOf(
|
||||
|
|
@ -82,6 +86,13 @@ data class BackupOptions(
|
|||
setter = { options, enabled -> options.copy(readEntries = enabled) },
|
||||
enabled = { it.libraryEntries },
|
||||
),
|
||||
Entry(
|
||||
// KMK-->
|
||||
label = KMR.strings.saved_searches_feeds,
|
||||
// KMK <--
|
||||
getter = BackupOptions::savedSearchesFeeds,
|
||||
setter = { options, enabled -> options.copy(savedSearchesFeeds = enabled) },
|
||||
),
|
||||
// SY <--
|
||||
)
|
||||
|
||||
|
|
@ -122,6 +133,7 @@ data class BackupOptions(
|
|||
// SY -->
|
||||
customInfo = array[9],
|
||||
readEntries = array[10],
|
||||
savedSearchesFeeds = array[11],
|
||||
// SY <--
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,12 @@ class FeedBackupCreator(
|
|||
) {
|
||||
|
||||
/**
|
||||
* Backup global Popular/Latest feeds
|
||||
* Backup:
|
||||
* - Global Popular/Latest feeds
|
||||
* - Global feeds from saved searches
|
||||
* - Source's feeds from saved searches
|
||||
*/
|
||||
suspend fun backupFeeds(): List<BackupFeed> {
|
||||
suspend operator fun invoke(): List<BackupFeed> {
|
||||
return handler.awaitList { feed_saved_searchQueries.selectAllFeedWithSavedSearch(backupFeedMapper) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class SavedSearchBackupCreator(
|
|||
private val handler: DatabaseHandler = Injekt.get(),
|
||||
) {
|
||||
|
||||
suspend fun backupSavedSearches(): List<BackupSavedSearch> {
|
||||
suspend operator fun invoke(): List<BackupSavedSearch> {
|
||||
return handler.awaitList { saved_searchQueries.selectAll(backupSavedSearchMapper) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class BackupRestorer(
|
|||
restoreAmount += 1
|
||||
}
|
||||
// SY -->
|
||||
if (options.savedSearches) {
|
||||
if (options.savedSearchesFeeds) {
|
||||
restoreAmount += 1
|
||||
}
|
||||
// SY <--
|
||||
|
|
@ -108,7 +108,7 @@ class BackupRestorer(
|
|||
restoreCategories(backup.backupCategories)
|
||||
}
|
||||
// SY -->
|
||||
if (options.savedSearches) {
|
||||
if (options.savedSearchesFeeds) {
|
||||
restoreSavedSearches(
|
||||
backup.backupSavedSearches,
|
||||
// KMK -->
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ data class RestoreOptions(
|
|||
val extensionRepoSettings: Boolean = true,
|
||||
val sourceSettings: Boolean = true,
|
||||
// SY -->
|
||||
val savedSearches: Boolean = true,
|
||||
val savedSearchesFeeds: Boolean = true,
|
||||
// SY <--
|
||||
) {
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ data class RestoreOptions(
|
|||
extensionRepoSettings,
|
||||
sourceSettings,
|
||||
// SY -->
|
||||
savedSearches,
|
||||
savedSearchesFeeds,
|
||||
// SY <--
|
||||
)
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ data class RestoreOptions(
|
|||
appSettings ||
|
||||
extensionRepoSettings ||
|
||||
sourceSettings /* SY --> */ ||
|
||||
savedSearches /* SY <-- */
|
||||
savedSearchesFeeds /* SY <-- */
|
||||
|
||||
companion object {
|
||||
val options = persistentListOf(
|
||||
|
|
@ -64,9 +64,11 @@ data class RestoreOptions(
|
|||
),
|
||||
// SY -->
|
||||
Entry(
|
||||
// KMK-->
|
||||
label = KMR.strings.saved_searches_feeds,
|
||||
getter = RestoreOptions::savedSearches,
|
||||
setter = { options, enabled -> options.copy(savedSearches = enabled) },
|
||||
// KMK <--
|
||||
getter = RestoreOptions::savedSearchesFeeds,
|
||||
setter = { options, enabled -> options.copy(savedSearchesFeeds = enabled) },
|
||||
),
|
||||
// SY <--
|
||||
)
|
||||
|
|
@ -78,7 +80,7 @@ data class RestoreOptions(
|
|||
extensionRepoSettings = array[3],
|
||||
sourceSettings = array[4],
|
||||
// SY -->
|
||||
savedSearches = array[5],
|
||||
savedSearchesFeeds = array[5],
|
||||
// SY <--
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue