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