Don't run automatic backup or library update jobs if battery is low
(cherry picked from commit 74f74eef56ce83b52cd7969f705e370c7977af87) # Conflicts: # app/build.gradle.kts # app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateJob.kt
This commit is contained in:
parent
8f07b7ab5b
commit
105a971a4c
@ -27,7 +27,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "eu.kanade.tachiyomi.sy"
|
applicationId = "eu.kanade.tachiyomi.sy"
|
||||||
|
|
||||||
versionCode = 55
|
versionCode = 56
|
||||||
versionName = "1.9.3"
|
versionName = "1.9.3"
|
||||||
|
|
||||||
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
||||||
|
@ -168,7 +168,7 @@ private fun ColumnScope.SortPage(
|
|||||||
screenModel: LibrarySettingsScreenModel,
|
screenModel: LibrarySettingsScreenModel,
|
||||||
) {
|
) {
|
||||||
// SY -->
|
// SY -->
|
||||||
val globalSortMode by screenModel.libraryPreferences.librarySortingMode().collectAsState()
|
val globalSortMode by screenModel.libraryPreferences.sortingMode().collectAsState()
|
||||||
val sortingMode = if (screenModel.grouping == LibraryGroup.BY_DEFAULT) {
|
val sortingMode = if (screenModel.grouping == LibraryGroup.BY_DEFAULT) {
|
||||||
category.sort.type
|
category.sort.type
|
||||||
} else {
|
} else {
|
||||||
@ -226,7 +226,7 @@ private val displayModes = listOf(
|
|||||||
private fun ColumnScope.DisplayPage(
|
private fun ColumnScope.DisplayPage(
|
||||||
screenModel: LibrarySettingsScreenModel,
|
screenModel: LibrarySettingsScreenModel,
|
||||||
) {
|
) {
|
||||||
val displayMode by screenModel.libraryPreferences.libraryDisplayMode().collectAsState()
|
val displayMode by screenModel.libraryPreferences.displayMode().collectAsState()
|
||||||
SettingsChipRow(R.string.action_display_mode) {
|
SettingsChipRow(R.string.action_display_mode) {
|
||||||
displayModes.map { (titleRes, mode) ->
|
displayModes.map { (titleRes, mode) ->
|
||||||
FilterChip(
|
FilterChip(
|
||||||
|
@ -34,7 +34,6 @@ import tachiyomi.domain.category.interactor.ResetCategoryFlags
|
|||||||
import tachiyomi.domain.category.model.Category
|
import tachiyomi.domain.category.model.Category
|
||||||
import tachiyomi.domain.library.model.GroupLibraryMode
|
import tachiyomi.domain.library.model.GroupLibraryMode
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences
|
import tachiyomi.domain.library.service.LibraryPreferences
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_BATTERY_NOT_LOW
|
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_CHARGING
|
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_CHARGING
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_NETWORK_NOT_METERED
|
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_NETWORK_NOT_METERED
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY_ON_WIFI
|
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY_ON_WIFI
|
||||||
@ -133,14 +132,14 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
): Preference.PreferenceGroup {
|
): Preference.PreferenceGroup {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
val libraryUpdateIntervalPref = libraryPreferences.libraryUpdateInterval()
|
val autoUpdateIntervalPref = libraryPreferences.autoUpdateInterval()
|
||||||
val libraryUpdateCategoriesPref = libraryPreferences.libraryUpdateCategories()
|
val autoUpdateCategoriesPref = libraryPreferences.updateCategories()
|
||||||
val libraryUpdateCategoriesExcludePref = libraryPreferences.libraryUpdateCategoriesExclude()
|
val autoUpdateCategoriesExcludePref = libraryPreferences.updateCategoriesExclude()
|
||||||
|
|
||||||
val libraryUpdateInterval by libraryUpdateIntervalPref.collectAsState()
|
val autoUpdateInterval by autoUpdateIntervalPref.collectAsState()
|
||||||
|
|
||||||
val included by libraryUpdateCategoriesPref.collectAsState()
|
val included by autoUpdateCategoriesPref.collectAsState()
|
||||||
val excluded by libraryUpdateCategoriesExcludePref.collectAsState()
|
val excluded by autoUpdateCategoriesExcludePref.collectAsState()
|
||||||
var showCategoriesDialog by rememberSaveable { mutableStateOf(false) }
|
var showCategoriesDialog by rememberSaveable { mutableStateOf(false) }
|
||||||
if (showCategoriesDialog) {
|
if (showCategoriesDialog) {
|
||||||
TriStateListDialog(
|
TriStateListDialog(
|
||||||
@ -152,8 +151,8 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
itemLabel = { it.visualName },
|
itemLabel = { it.visualName },
|
||||||
onDismissRequest = { showCategoriesDialog = false },
|
onDismissRequest = { showCategoriesDialog = false },
|
||||||
onValueChanged = { newIncluded, newExcluded ->
|
onValueChanged = { newIncluded, newExcluded ->
|
||||||
libraryUpdateCategoriesPref.set(newIncluded.map { it.id.toString() }.toSet())
|
autoUpdateCategoriesPref.set(newIncluded.map { it.id.toString() }.toSet())
|
||||||
libraryUpdateCategoriesExcludePref.set(newExcluded.map { it.id.toString() }.toSet())
|
autoUpdateCategoriesExcludePref.set(newExcluded.map { it.id.toString() }.toSet())
|
||||||
showCategoriesDialog = false
|
showCategoriesDialog = false
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -163,7 +162,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
title = stringResource(R.string.pref_category_library_update),
|
title = stringResource(R.string.pref_category_library_update),
|
||||||
preferenceItems = listOf(
|
preferenceItems = listOf(
|
||||||
Preference.PreferenceItem.ListPreference(
|
Preference.PreferenceItem.ListPreference(
|
||||||
pref = libraryUpdateIntervalPref,
|
pref = autoUpdateIntervalPref,
|
||||||
title = stringResource(R.string.pref_library_update_interval),
|
title = stringResource(R.string.pref_library_update_interval),
|
||||||
entries = mapOf(
|
entries = mapOf(
|
||||||
0 to stringResource(R.string.update_never),
|
0 to stringResource(R.string.update_never),
|
||||||
@ -179,15 +178,14 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.MultiSelectListPreference(
|
Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
pref = libraryPreferences.libraryUpdateDeviceRestriction(),
|
pref = libraryPreferences.autoUpdateDeviceRestrictions(),
|
||||||
enabled = libraryUpdateInterval > 0,
|
enabled = autoUpdateInterval > 0,
|
||||||
title = stringResource(R.string.pref_library_update_restriction),
|
title = stringResource(R.string.pref_library_update_restriction),
|
||||||
subtitle = stringResource(R.string.restrictions),
|
subtitle = stringResource(R.string.restrictions),
|
||||||
entries = mapOf(
|
entries = mapOf(
|
||||||
DEVICE_ONLY_ON_WIFI to stringResource(R.string.connected_to_wifi),
|
DEVICE_ONLY_ON_WIFI to stringResource(R.string.connected_to_wifi),
|
||||||
DEVICE_NETWORK_NOT_METERED to stringResource(R.string.network_not_metered),
|
DEVICE_NETWORK_NOT_METERED to stringResource(R.string.network_not_metered),
|
||||||
DEVICE_CHARGING to stringResource(R.string.charging),
|
DEVICE_CHARGING to stringResource(R.string.charging),
|
||||||
DEVICE_BATTERY_NOT_LOW to stringResource(R.string.battery_not_low),
|
|
||||||
),
|
),
|
||||||
onValueChanged = {
|
onValueChanged = {
|
||||||
// Post to event looper to allow the preference to be updated.
|
// Post to event looper to allow the preference to be updated.
|
||||||
@ -227,7 +225,7 @@ object SettingsLibraryScreen : SearchableSettings {
|
|||||||
subtitle = stringResource(R.string.pref_library_update_refresh_trackers_summary),
|
subtitle = stringResource(R.string.pref_library_update_refresh_trackers_summary),
|
||||||
),
|
),
|
||||||
Preference.PreferenceItem.MultiSelectListPreference(
|
Preference.PreferenceItem.MultiSelectListPreference(
|
||||||
pref = libraryPreferences.libraryUpdateMangaRestriction(),
|
pref = libraryPreferences.autoUpdateMangaRestrictions(),
|
||||||
title = stringResource(R.string.pref_library_update_manga_restriction),
|
title = stringResource(R.string.pref_library_update_manga_restriction),
|
||||||
entries = mapOf(
|
entries = mapOf(
|
||||||
MANGA_HAS_UNREAD to stringResource(R.string.pref_update_only_completely_read),
|
MANGA_HAS_UNREAD to stringResource(R.string.pref_update_only_completely_read),
|
||||||
|
@ -103,7 +103,7 @@ fun EhLoginWebViewScreen(
|
|||||||
object : AccompanistWebViewClient() {
|
object : AccompanistWebViewClient() {
|
||||||
override fun onPageFinished(view: WebView, url: String?) {
|
override fun onPageFinished(view: WebView, url: String?) {
|
||||||
super.onPageFinished(view, url)
|
super.onPageFinished(view, url)
|
||||||
onPageFinished(view ?: return, url ?: return)
|
onPageFinished(view, url ?: return)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import eu.kanade.tachiyomi.util.system.toast
|
|||||||
import eu.kanade.tachiyomi.util.system.workManager
|
import eu.kanade.tachiyomi.util.system.workManager
|
||||||
import tachiyomi.core.preference.PreferenceStore
|
import tachiyomi.core.preference.PreferenceStore
|
||||||
import tachiyomi.core.preference.TriState
|
import tachiyomi.core.preference.TriState
|
||||||
|
import tachiyomi.core.preference.getAndSet
|
||||||
import tachiyomi.core.preference.getEnum
|
import tachiyomi.core.preference.getEnum
|
||||||
import tachiyomi.core.preference.minusAssign
|
import tachiyomi.core.preference.minusAssign
|
||||||
import tachiyomi.core.preference.plusAssign
|
import tachiyomi.core.preference.plusAssign
|
||||||
@ -103,11 +104,11 @@ object Migrations {
|
|||||||
}
|
}
|
||||||
if (oldVersion < 44) {
|
if (oldVersion < 44) {
|
||||||
// Reset sorting preference if using removed sort by source
|
// Reset sorting preference if using removed sort by source
|
||||||
val oldSortingMode = prefs.getInt(libraryPreferences.librarySortingMode().key(), 0)
|
val oldSortingMode = prefs.getInt(libraryPreferences.sortingMode().key(), 0)
|
||||||
|
|
||||||
if (oldSortingMode == 5) { // SOURCE = 5
|
if (oldSortingMode == 5) { // SOURCE = 5
|
||||||
prefs.edit {
|
prefs.edit {
|
||||||
putInt(libraryPreferences.librarySortingMode().key(), 0) // ALPHABETICAL = 0
|
putInt(libraryPreferences.sortingMode().key(), 0) // ALPHABETICAL = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,14 +183,14 @@ object Migrations {
|
|||||||
}
|
}
|
||||||
if (oldVersion < 61) {
|
if (oldVersion < 61) {
|
||||||
// Handle removed every 1 or 2 hour library updates
|
// Handle removed every 1 or 2 hour library updates
|
||||||
val updateInterval = libraryPreferences.libraryUpdateInterval().get()
|
val updateInterval = libraryPreferences.autoUpdateInterval().get()
|
||||||
if (updateInterval == 1 || updateInterval == 2) {
|
if (updateInterval == 1 || updateInterval == 2) {
|
||||||
libraryPreferences.libraryUpdateInterval().set(3)
|
libraryPreferences.autoUpdateInterval().set(3)
|
||||||
LibraryUpdateJob.setupTask(context, 3)
|
LibraryUpdateJob.setupTask(context, 3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldVersion < 64) {
|
if (oldVersion < 64) {
|
||||||
val oldSortingMode = prefs.getInt(libraryPreferences.librarySortingMode().key(), 0)
|
val oldSortingMode = prefs.getInt(libraryPreferences.sortingMode().key(), 0)
|
||||||
val oldSortingDirection = prefs.getBoolean("library_sorting_ascending", true)
|
val oldSortingDirection = prefs.getBoolean("library_sorting_ascending", true)
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
@ -211,12 +212,12 @@ object Migrations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prefs.edit(commit = true) {
|
prefs.edit(commit = true) {
|
||||||
remove(libraryPreferences.librarySortingMode().key())
|
remove(libraryPreferences.sortingMode().key())
|
||||||
remove("library_sorting_ascending")
|
remove("library_sorting_ascending")
|
||||||
}
|
}
|
||||||
|
|
||||||
prefs.edit {
|
prefs.edit {
|
||||||
putString(libraryPreferences.librarySortingMode().key(), newSortingMode)
|
putString(libraryPreferences.sortingMode().key(), newSortingMode)
|
||||||
putString("library_sorting_ascending", newSortingDirection)
|
putString("library_sorting_ascending", newSortingDirection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -227,16 +228,16 @@ object Migrations {
|
|||||||
}
|
}
|
||||||
if (oldVersion < 71) {
|
if (oldVersion < 71) {
|
||||||
// Handle removed every 3, 4, 6, and 8 hour library updates
|
// Handle removed every 3, 4, 6, and 8 hour library updates
|
||||||
val updateInterval = libraryPreferences.libraryUpdateInterval().get()
|
val updateInterval = libraryPreferences.autoUpdateInterval().get()
|
||||||
if (updateInterval in listOf(3, 4, 6, 8)) {
|
if (updateInterval in listOf(3, 4, 6, 8)) {
|
||||||
libraryPreferences.libraryUpdateInterval().set(12)
|
libraryPreferences.autoUpdateInterval().set(12)
|
||||||
LibraryUpdateJob.setupTask(context, 12)
|
LibraryUpdateJob.setupTask(context, 12)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldVersion < 72) {
|
if (oldVersion < 72) {
|
||||||
val oldUpdateOngoingOnly = prefs.getBoolean("pref_update_only_non_completed_key", true)
|
val oldUpdateOngoingOnly = prefs.getBoolean("pref_update_only_non_completed_key", true)
|
||||||
if (!oldUpdateOngoingOnly) {
|
if (!oldUpdateOngoingOnly) {
|
||||||
libraryPreferences.libraryUpdateMangaRestriction() -= MANGA_NON_COMPLETED
|
libraryPreferences.autoUpdateMangaRestrictions() -= MANGA_NON_COMPLETED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldVersion < 75) {
|
if (oldVersion < 75) {
|
||||||
@ -261,20 +262,20 @@ object Migrations {
|
|||||||
if (oldVersion < 81) {
|
if (oldVersion < 81) {
|
||||||
// Handle renamed enum values
|
// Handle renamed enum values
|
||||||
prefs.edit {
|
prefs.edit {
|
||||||
val newSortingMode = when (val oldSortingMode = prefs.getString(libraryPreferences.librarySortingMode().key(), "ALPHABETICAL")) {
|
val newSortingMode = when (val oldSortingMode = prefs.getString(libraryPreferences.sortingMode().key(), "ALPHABETICAL")) {
|
||||||
"LAST_CHECKED" -> "LAST_MANGA_UPDATE"
|
"LAST_CHECKED" -> "LAST_MANGA_UPDATE"
|
||||||
"UNREAD" -> "UNREAD_COUNT"
|
"UNREAD" -> "UNREAD_COUNT"
|
||||||
"DATE_FETCHED" -> "CHAPTER_FETCH_DATE"
|
"DATE_FETCHED" -> "CHAPTER_FETCH_DATE"
|
||||||
else -> oldSortingMode
|
else -> oldSortingMode
|
||||||
}
|
}
|
||||||
putString(libraryPreferences.librarySortingMode().key(), newSortingMode)
|
putString(libraryPreferences.sortingMode().key(), newSortingMode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldVersion < 82) {
|
if (oldVersion < 82) {
|
||||||
prefs.edit {
|
prefs.edit {
|
||||||
val sort = prefs.getString(libraryPreferences.librarySortingMode().key(), null) ?: return@edit
|
val sort = prefs.getString(libraryPreferences.sortingMode().key(), null) ?: return@edit
|
||||||
val direction = prefs.getString("library_sorting_ascending", "ASCENDING")!!
|
val direction = prefs.getString("library_sorting_ascending", "ASCENDING")!!
|
||||||
putString(libraryPreferences.librarySortingMode().key(), "$sort,$direction")
|
putString(libraryPreferences.sortingMode().key(), "$sort,$direction")
|
||||||
remove("library_sorting_ascending")
|
remove("library_sorting_ascending")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,6 +372,12 @@ object Migrations {
|
|||||||
readerPreferences.longStripSplitWebtoon().set(false)
|
readerPreferences.longStripSplitWebtoon().set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (oldVersion < 105) {
|
||||||
|
val pref = libraryPreferences.autoUpdateDeviceRestrictions()
|
||||||
|
if (pref.isSet() && "battery_not_low" in pref.get()) {
|
||||||
|
pref.getAndSet { it - "battery_not_low" }
|
||||||
|
}
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import android.content.Context
|
|||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import androidx.work.BackoffPolicy
|
import androidx.work.BackoffPolicy
|
||||||
|
import androidx.work.Constraints
|
||||||
import androidx.work.CoroutineWorker
|
import androidx.work.CoroutineWorker
|
||||||
import androidx.work.ExistingPeriodicWorkPolicy
|
import androidx.work.ExistingPeriodicWorkPolicy
|
||||||
import androidx.work.ExistingWorkPolicy
|
import androidx.work.ExistingWorkPolicy
|
||||||
@ -76,6 +77,10 @@ class BackupCreateJob(private val context: Context, workerParams: WorkerParamete
|
|||||||
val backupPreferences = Injekt.get<BackupPreferences>()
|
val backupPreferences = Injekt.get<BackupPreferences>()
|
||||||
val interval = prefInterval ?: backupPreferences.backupInterval().get()
|
val interval = prefInterval ?: backupPreferences.backupInterval().get()
|
||||||
if (interval > 0) {
|
if (interval > 0) {
|
||||||
|
val constraints = Constraints(
|
||||||
|
requiresBatteryNotLow = true,
|
||||||
|
)
|
||||||
|
|
||||||
val request = PeriodicWorkRequestBuilder<BackupCreateJob>(
|
val request = PeriodicWorkRequestBuilder<BackupCreateJob>(
|
||||||
interval.toLong(),
|
interval.toLong(),
|
||||||
TimeUnit.HOURS,
|
TimeUnit.HOURS,
|
||||||
@ -84,6 +89,7 @@ class BackupCreateJob(private val context: Context, workerParams: WorkerParamete
|
|||||||
)
|
)
|
||||||
.setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 10.minutes.toJavaDuration())
|
.setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 10.minutes.toJavaDuration())
|
||||||
.addTag(TAG_AUTO)
|
.addTag(TAG_AUTO)
|
||||||
|
.setConstraints(constraints)
|
||||||
.setInputData(workDataOf(IS_AUTO_BACKUP_KEY to true))
|
.setInputData(workDataOf(IS_AUTO_BACKUP_KEY to true))
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
@ -72,7 +72,6 @@ import tachiyomi.domain.library.model.GroupLibraryMode
|
|||||||
import tachiyomi.domain.library.model.LibraryGroup
|
import tachiyomi.domain.library.model.LibraryGroup
|
||||||
import tachiyomi.domain.library.model.LibraryManga
|
import tachiyomi.domain.library.model.LibraryManga
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences
|
import tachiyomi.domain.library.service.LibraryPreferences
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_BATTERY_NOT_LOW
|
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_CHARGING
|
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_CHARGING
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_NETWORK_NOT_METERED
|
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_NETWORK_NOT_METERED
|
||||||
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY_ON_WIFI
|
import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY_ON_WIFI
|
||||||
@ -137,7 +136,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
|
|||||||
override suspend fun doWork(): Result {
|
override suspend fun doWork(): Result {
|
||||||
if (tags.contains(WORK_NAME_AUTO)) {
|
if (tags.contains(WORK_NAME_AUTO)) {
|
||||||
val preferences = Injekt.get<LibraryPreferences>()
|
val preferences = Injekt.get<LibraryPreferences>()
|
||||||
val restrictions = preferences.libraryUpdateDeviceRestriction().get()
|
val restrictions = preferences.autoUpdateDeviceRestrictions().get()
|
||||||
if ((DEVICE_ONLY_ON_WIFI in restrictions) && !context.isConnectedToWifi()) {
|
if ((DEVICE_ONLY_ON_WIFI in restrictions) && !context.isConnectedToWifi()) {
|
||||||
return Result.retry()
|
return Result.retry()
|
||||||
}
|
}
|
||||||
@ -158,7 +157,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
|
|||||||
|
|
||||||
// If this is a chapter update, set the last update time to now
|
// If this is a chapter update, set the last update time to now
|
||||||
if (target == Target.CHAPTERS) {
|
if (target == Target.CHAPTERS) {
|
||||||
libraryPreferences.libraryUpdateLastTimestamp().set(Date().time)
|
libraryPreferences.lastUpdatedTimestamp().set(Date().time)
|
||||||
}
|
}
|
||||||
|
|
||||||
val categoryId = inputData.getLong(KEY_CATEGORY, -1L)
|
val categoryId = inputData.getLong(KEY_CATEGORY, -1L)
|
||||||
@ -220,14 +219,14 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
|
|||||||
groupLibraryUpdateType == GroupLibraryMode.GLOBAL ||
|
groupLibraryUpdateType == GroupLibraryMode.GLOBAL ||
|
||||||
(groupLibraryUpdateType == GroupLibraryMode.ALL_BUT_UNGROUPED && group == LibraryGroup.UNGROUPED)
|
(groupLibraryUpdateType == GroupLibraryMode.ALL_BUT_UNGROUPED && group == LibraryGroup.UNGROUPED)
|
||||||
) {
|
) {
|
||||||
val categoriesToUpdate = libraryPreferences.libraryUpdateCategories().get().map(String::toLong)
|
val categoriesToUpdate = libraryPreferences.updateCategories().get().map(String::toLong)
|
||||||
val includedManga = if (categoriesToUpdate.isNotEmpty()) {
|
val includedManga = if (categoriesToUpdate.isNotEmpty()) {
|
||||||
libraryManga.filter { it.category in categoriesToUpdate }
|
libraryManga.filter { it.category in categoriesToUpdate }
|
||||||
} else {
|
} else {
|
||||||
libraryManga
|
libraryManga
|
||||||
}
|
}
|
||||||
|
|
||||||
val categoriesToExclude = libraryPreferences.libraryUpdateCategoriesExclude().get().map { it.toLong() }
|
val categoriesToExclude = libraryPreferences.updateCategoriesExclude().get().map { it.toLong() }
|
||||||
val excludedMangaIds = if (categoriesToExclude.isNotEmpty()) {
|
val excludedMangaIds = if (categoriesToExclude.isNotEmpty()) {
|
||||||
libraryManga.filter { it.category in categoriesToExclude }.map { it.manga.id }
|
libraryManga.filter { it.category in categoriesToExclude }.map { it.manga.id }
|
||||||
} else {
|
} else {
|
||||||
@ -302,7 +301,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
|
|||||||
val skippedUpdates = CopyOnWriteArrayList<Pair<Manga, String?>>()
|
val skippedUpdates = CopyOnWriteArrayList<Pair<Manga, String?>>()
|
||||||
val failedUpdates = CopyOnWriteArrayList<Pair<Manga, String?>>()
|
val failedUpdates = CopyOnWriteArrayList<Pair<Manga, String?>>()
|
||||||
val hasDownloads = AtomicBoolean(false)
|
val hasDownloads = AtomicBoolean(false)
|
||||||
val restrictions = libraryPreferences.libraryUpdateMangaRestriction().get()
|
val restrictions = libraryPreferences.autoUpdateMangaRestrictions().get()
|
||||||
// SY -->
|
// SY -->
|
||||||
val mdlistLogged = trackManager.services.any { it.isLogged && it.id == TrackManager.MDLIST }
|
val mdlistLogged = trackManager.services.any { it.isLogged && it.id == TrackManager.MDLIST }
|
||||||
// SY <--
|
// SY <--
|
||||||
@ -771,13 +770,13 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
|
|||||||
prefInterval: Int? = null,
|
prefInterval: Int? = null,
|
||||||
) {
|
) {
|
||||||
val preferences = Injekt.get<LibraryPreferences>()
|
val preferences = Injekt.get<LibraryPreferences>()
|
||||||
val interval = prefInterval ?: preferences.libraryUpdateInterval().get()
|
val interval = prefInterval ?: preferences.autoUpdateInterval().get()
|
||||||
if (interval > 0) {
|
if (interval > 0) {
|
||||||
val restrictions = preferences.libraryUpdateDeviceRestriction().get()
|
val restrictions = preferences.autoUpdateDeviceRestrictions().get()
|
||||||
val constraints = Constraints(
|
val constraints = Constraints(
|
||||||
requiredNetworkType = if (DEVICE_NETWORK_NOT_METERED in restrictions) { NetworkType.UNMETERED } else { NetworkType.CONNECTED },
|
requiredNetworkType = if (DEVICE_NETWORK_NOT_METERED in restrictions) { NetworkType.UNMETERED } else { NetworkType.CONNECTED },
|
||||||
requiresCharging = DEVICE_CHARGING in restrictions,
|
requiresCharging = DEVICE_CHARGING in restrictions,
|
||||||
requiresBatteryNotLow = DEVICE_BATTERY_NOT_LOW in restrictions,
|
requiresBatteryNotLow = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
val request = PeriodicWorkRequestBuilder<LibraryUpdateJob>(
|
val request = PeriodicWorkRequestBuilder<LibraryUpdateJob>(
|
||||||
|
@ -172,7 +172,7 @@ class LibraryScreenModel(
|
|||||||
// SY -->
|
// SY -->
|
||||||
combine(
|
combine(
|
||||||
state.map { it.groupType }.distinctUntilChanged(),
|
state.map { it.groupType }.distinctUntilChanged(),
|
||||||
libraryPreferences.librarySortingMode().changes(),
|
libraryPreferences.sortingMode().changes(),
|
||||||
::Pair,
|
::Pair,
|
||||||
),
|
),
|
||||||
// SY <--
|
// SY <--
|
||||||
@ -795,7 +795,7 @@ class LibraryScreenModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getDisplayMode(): PreferenceMutableState<LibraryDisplayMode> {
|
fun getDisplayMode(): PreferenceMutableState<LibraryDisplayMode> {
|
||||||
return libraryPreferences.libraryDisplayMode().asState(coroutineScope)
|
return libraryPreferences.displayMode().asState(coroutineScope)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getColumnsPreferenceForCurrentOrientation(isLandscape: Boolean): PreferenceMutableState<Int> {
|
fun getColumnsPreferenceForCurrentOrientation(isLandscape: Boolean): PreferenceMutableState<Int> {
|
||||||
|
@ -192,7 +192,7 @@ class MangaScreenModel(
|
|||||||
val dateFormat by mutableStateOf(UiPreferences.dateFormat(uiPreferences.dateFormat().get()))
|
val dateFormat by mutableStateOf(UiPreferences.dateFormat(uiPreferences.dateFormat().get()))
|
||||||
private val skipFiltered by readerPreferences.skipFiltered().asState(coroutineScope)
|
private val skipFiltered by readerPreferences.skipFiltered().asState(coroutineScope)
|
||||||
|
|
||||||
val isUpdateIntervalEnabled = LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in libraryPreferences.libraryUpdateMangaRestriction().get()
|
val isUpdateIntervalEnabled = LibraryPreferences.MANGA_OUTSIDE_RELEASE_PERIOD in libraryPreferences.autoUpdateMangaRestrictions().get()
|
||||||
|
|
||||||
private val selectedPositions: Array<Int> = arrayOf(-1, -1) // first and last selected index in list
|
private val selectedPositions: Array<Int> = arrayOf(-1, -1) // first and last selected index in list
|
||||||
private val selectedChapterIds: HashSet<Long> = HashSet()
|
private val selectedChapterIds: HashSet<Long> = HashSet()
|
||||||
|
@ -108,14 +108,14 @@ class StatsScreenModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getGlobalUpdateItemCount(libraryManga: List<LibraryManga>): Int {
|
private fun getGlobalUpdateItemCount(libraryManga: List<LibraryManga>): Int {
|
||||||
val includedCategories = preferences.libraryUpdateCategories().get().map { it.toLong() }
|
val includedCategories = preferences.updateCategories().get().map { it.toLong() }
|
||||||
val includedManga = if (includedCategories.isNotEmpty()) {
|
val includedManga = if (includedCategories.isNotEmpty()) {
|
||||||
libraryManga.filter { it.category in includedCategories }
|
libraryManga.filter { it.category in includedCategories }
|
||||||
} else {
|
} else {
|
||||||
libraryManga
|
libraryManga
|
||||||
}
|
}
|
||||||
|
|
||||||
val excludedCategories = preferences.libraryUpdateCategoriesExclude().get().map { it.toLong() }
|
val excludedCategories = preferences.updateCategoriesExclude().get().map { it.toLong() }
|
||||||
val excludedMangaIds = if (excludedCategories.isNotEmpty()) {
|
val excludedMangaIds = if (excludedCategories.isNotEmpty()) {
|
||||||
libraryManga.fastMapNotNull { manga ->
|
libraryManga.fastMapNotNull { manga ->
|
||||||
manga.id.takeIf { manga.category in excludedCategories }
|
manga.id.takeIf { manga.category in excludedCategories }
|
||||||
@ -124,7 +124,7 @@ class StatsScreenModel(
|
|||||||
emptyList()
|
emptyList()
|
||||||
}
|
}
|
||||||
|
|
||||||
val updateRestrictions = preferences.libraryUpdateMangaRestriction().get()
|
val updateRestrictions = preferences.autoUpdateMangaRestrictions().get()
|
||||||
return includedManga
|
return includedManga
|
||||||
.fastFilterNot { it.manga.id in excludedMangaIds }
|
.fastFilterNot { it.manga.id in excludedMangaIds }
|
||||||
.fastDistinctBy { it.manga.id }
|
.fastDistinctBy { it.manga.id }
|
||||||
|
@ -70,7 +70,7 @@ class UpdatesScreenModel(
|
|||||||
private val _events: Channel<Event> = Channel(Int.MAX_VALUE)
|
private val _events: Channel<Event> = Channel(Int.MAX_VALUE)
|
||||||
val events: Flow<Event> = _events.receiveAsFlow()
|
val events: Flow<Event> = _events.receiveAsFlow()
|
||||||
|
|
||||||
val lastUpdated by libraryPreferences.libraryUpdateLastTimestamp().asState(coroutineScope)
|
val lastUpdated by libraryPreferences.lastUpdatedTimestamp().asState(coroutineScope)
|
||||||
|
|
||||||
// SY -->
|
// SY -->
|
||||||
val preserveReadingPosition by readerPreferences.preserveReadingPosition().asState(coroutineScope)
|
val preserveReadingPosition by readerPreferences.preserveReadingPosition().asState(coroutineScope)
|
||||||
|
@ -41,6 +41,7 @@ import kotlinx.serialization.json.jsonArray
|
|||||||
import kotlinx.serialization.json.jsonPrimitive
|
import kotlinx.serialization.json.jsonPrimitive
|
||||||
import tachiyomi.core.preference.PreferenceStore
|
import tachiyomi.core.preference.PreferenceStore
|
||||||
import tachiyomi.core.preference.TriState
|
import tachiyomi.core.preference.TriState
|
||||||
|
import tachiyomi.core.preference.getAndSet
|
||||||
import tachiyomi.core.preference.getEnum
|
import tachiyomi.core.preference.getEnum
|
||||||
import tachiyomi.core.preference.minusAssign
|
import tachiyomi.core.preference.minusAssign
|
||||||
import tachiyomi.core.util.system.logcat
|
import tachiyomi.core.util.system.logcat
|
||||||
@ -259,15 +260,15 @@ object EXHMigrations {
|
|||||||
if (readerTheme == 4) {
|
if (readerTheme == 4) {
|
||||||
readerPreferences.readerTheme().set(3)
|
readerPreferences.readerTheme().set(3)
|
||||||
}
|
}
|
||||||
val updateInterval = libraryPreferences.libraryUpdateInterval().get()
|
val updateInterval = libraryPreferences.autoUpdateInterval().get()
|
||||||
if (updateInterval == 1 || updateInterval == 2) {
|
if (updateInterval == 1 || updateInterval == 2) {
|
||||||
libraryPreferences.libraryUpdateInterval().set(3)
|
libraryPreferences.autoUpdateInterval().set(3)
|
||||||
LibraryUpdateJob.setupTask(context, 3)
|
LibraryUpdateJob.setupTask(context, 3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldVersion under 20) {
|
if (oldVersion under 20) {
|
||||||
try {
|
try {
|
||||||
val oldSortingMode = prefs.getInt(libraryPreferences.librarySortingMode().key(), 0 /* ALPHABETICAL */)
|
val oldSortingMode = prefs.getInt(libraryPreferences.sortingMode().key(), 0 /* ALPHABETICAL */)
|
||||||
val oldSortingDirection = prefs.getBoolean("library_sorting_ascending", true)
|
val oldSortingDirection = prefs.getBoolean("library_sorting_ascending", true)
|
||||||
|
|
||||||
val newSortingMode = when (oldSortingMode) {
|
val newSortingMode = when (oldSortingMode) {
|
||||||
@ -290,12 +291,12 @@ object EXHMigrations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prefs.edit(commit = true) {
|
prefs.edit(commit = true) {
|
||||||
remove(libraryPreferences.librarySortingMode().key())
|
remove(libraryPreferences.sortingMode().key())
|
||||||
remove("library_sorting_ascending")
|
remove("library_sorting_ascending")
|
||||||
}
|
}
|
||||||
|
|
||||||
prefs.edit {
|
prefs.edit {
|
||||||
putString(libraryPreferences.librarySortingMode().key(), newSortingMode)
|
putString(libraryPreferences.sortingMode().key(), newSortingMode)
|
||||||
putString("library_sorting_ascending", newSortingDirection)
|
putString("library_sorting_ascending", newSortingDirection)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@ -312,16 +313,16 @@ object EXHMigrations {
|
|||||||
}
|
}
|
||||||
if (oldVersion under 22) {
|
if (oldVersion under 22) {
|
||||||
// Handle removed every 3, 4, 6, and 8 hour library updates
|
// Handle removed every 3, 4, 6, and 8 hour library updates
|
||||||
val updateInterval = libraryPreferences.libraryUpdateInterval().get()
|
val updateInterval = libraryPreferences.autoUpdateInterval().get()
|
||||||
if (updateInterval in listOf(3, 4, 6, 8)) {
|
if (updateInterval in listOf(3, 4, 6, 8)) {
|
||||||
libraryPreferences.libraryUpdateInterval().set(12)
|
libraryPreferences.autoUpdateInterval().set(12)
|
||||||
LibraryUpdateJob.setupTask(context, 12)
|
LibraryUpdateJob.setupTask(context, 12)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldVersion under 23) {
|
if (oldVersion under 23) {
|
||||||
val oldUpdateOngoingOnly = prefs.getBoolean("pref_update_only_non_completed_key", true)
|
val oldUpdateOngoingOnly = prefs.getBoolean("pref_update_only_non_completed_key", true)
|
||||||
if (!oldUpdateOngoingOnly) {
|
if (!oldUpdateOngoingOnly) {
|
||||||
libraryPreferences.libraryUpdateMangaRestriction() -= MANGA_NON_COMPLETED
|
libraryPreferences.autoUpdateMangaRestrictions() -= MANGA_NON_COMPLETED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldVersion under 24) {
|
if (oldVersion under 24) {
|
||||||
@ -414,8 +415,7 @@ object EXHMigrations {
|
|||||||
}
|
}
|
||||||
if (oldVersion under 38) {
|
if (oldVersion under 38) {
|
||||||
// Handle renamed enum values
|
// Handle renamed enum values
|
||||||
@Suppress("DEPRECATION")
|
val newSortingMode = when (val oldSortingMode = prefs.getString(libraryPreferences.sortingMode().key(), "ALPHABETICAL")) {
|
||||||
val newSortingMode = when (val oldSortingMode = prefs.getString(libraryPreferences.librarySortingMode().key(), "ALPHABETICAL")) {
|
|
||||||
"LAST_CHECKED" -> "LAST_MANGA_UPDATE"
|
"LAST_CHECKED" -> "LAST_MANGA_UPDATE"
|
||||||
"UNREAD" -> "UNREAD_COUNT"
|
"UNREAD" -> "UNREAD_COUNT"
|
||||||
"DATE_FETCHED" -> "CHAPTER_FETCH_DATE"
|
"DATE_FETCHED" -> "CHAPTER_FETCH_DATE"
|
||||||
@ -423,7 +423,7 @@ object EXHMigrations {
|
|||||||
else -> oldSortingMode
|
else -> oldSortingMode
|
||||||
}
|
}
|
||||||
prefs.edit {
|
prefs.edit {
|
||||||
putString(libraryPreferences.librarySortingMode().key(), newSortingMode)
|
putString(libraryPreferences.sortingMode().key(), newSortingMode)
|
||||||
}
|
}
|
||||||
runBlocking {
|
runBlocking {
|
||||||
handler.await(true) {
|
handler.await(true) {
|
||||||
@ -442,9 +442,9 @@ object EXHMigrations {
|
|||||||
}
|
}
|
||||||
if (oldVersion under 39) {
|
if (oldVersion under 39) {
|
||||||
prefs.edit {
|
prefs.edit {
|
||||||
val sort = prefs.getString(libraryPreferences.librarySortingMode().key(), null) ?: return@edit
|
val sort = prefs.getString(libraryPreferences.sortingMode().key(), null) ?: return@edit
|
||||||
val direction = prefs.getString("library_sorting_ascending", "ASCENDING")!!
|
val direction = prefs.getString("library_sorting_ascending", "ASCENDING")!!
|
||||||
putString(libraryPreferences.librarySortingMode().key(), "$sort,$direction")
|
putString(libraryPreferences.sortingMode().key(), "$sort,$direction")
|
||||||
remove("library_sorting_ascending")
|
remove("library_sorting_ascending")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -458,7 +458,6 @@ object EXHMigrations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldVersion under 41) {
|
if (oldVersion under 41) {
|
||||||
@Suppress("NAME_SHADOWING")
|
|
||||||
val preferences = listOf(
|
val preferences = listOf(
|
||||||
libraryPreferences.filterChapterByRead(),
|
libraryPreferences.filterChapterByRead(),
|
||||||
libraryPreferences.filterChapterByDownloaded(),
|
libraryPreferences.filterChapterByDownloaded(),
|
||||||
@ -548,6 +547,12 @@ object EXHMigrations {
|
|||||||
readerPreferences.longStripSplitWebtoon().set(false)
|
readerPreferences.longStripSplitWebtoon().set(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (oldVersion under 56) {
|
||||||
|
val pref = libraryPreferences.autoUpdateDeviceRestrictions()
|
||||||
|
if (pref.isSet() && "battery_not_low" in pref.get()) {
|
||||||
|
pref.getAndSet { it - "battery_not_low" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if (oldVersion under 1) { } (1 is current release version)
|
// if (oldVersion under 1) { } (1 is current release version)
|
||||||
// do stuff here when releasing changed crap
|
// do stuff here when releasing changed crap
|
||||||
|
@ -14,7 +14,7 @@ class CreateCategoryWithName(
|
|||||||
|
|
||||||
private val initialFlags: Long
|
private val initialFlags: Long
|
||||||
get() {
|
get() {
|
||||||
val sort = preferences.librarySortingMode().get()
|
val sort = preferences.sortingMode().get()
|
||||||
return sort.type.flag or sort.direction.flag
|
return sort.type.flag or sort.direction.flag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ class ResetCategoryFlags(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
suspend fun await() {
|
suspend fun await() {
|
||||||
val sort = preferences.librarySortingMode().get()
|
val sort = preferences.sortingMode().get()
|
||||||
categoryRepository.updateAllFlags(sort.type + sort.direction)
|
categoryRepository.updateAllFlags(sort.type + sort.direction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,6 @@ class SetDisplayMode(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
fun await(display: LibraryDisplayMode) {
|
fun await(display: LibraryDisplayMode) {
|
||||||
preferences.libraryDisplayMode().set(display)
|
preferences.displayMode().set(display)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ class SetSortModeForCategory(
|
|||||||
suspend fun await(categoryId: Long?, type: LibrarySort.Type, direction: LibrarySort.Direction) {
|
suspend fun await(categoryId: Long?, type: LibrarySort.Type, direction: LibrarySort.Direction) {
|
||||||
// SY -->
|
// SY -->
|
||||||
if (preferences.groupLibraryBy().get() != LibraryGroup.BY_DEFAULT) {
|
if (preferences.groupLibraryBy().get() != LibraryGroup.BY_DEFAULT) {
|
||||||
preferences.librarySortingMode().set(LibrarySort(type, direction))
|
preferences.sortingMode().set(LibrarySort(type, direction))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// SY <--
|
// SY <--
|
||||||
@ -30,7 +30,7 @@ class SetSortModeForCategory(
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
preferences.librarySortingMode().set(LibrarySort(type, direction))
|
preferences.sortingMode().set(LibrarySort(type, direction))
|
||||||
categoryRepository.updateAllFlags(flags)
|
categoryRepository.updateAllFlags(flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,24 +13,24 @@ class LibraryPreferences(
|
|||||||
private val preferenceStore: PreferenceStore,
|
private val preferenceStore: PreferenceStore,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun libraryDisplayMode() = preferenceStore.getObject("pref_display_mode_library", LibraryDisplayMode.default, LibraryDisplayMode.Serializer::serialize, LibraryDisplayMode.Serializer::deserialize)
|
fun displayMode() = preferenceStore.getObject("pref_display_mode_library", LibraryDisplayMode.default, LibraryDisplayMode.Serializer::serialize, LibraryDisplayMode.Serializer::deserialize)
|
||||||
|
|
||||||
fun librarySortingMode() = preferenceStore.getObject("library_sorting_mode", LibrarySort.default, LibrarySort.Serializer::serialize, LibrarySort.Serializer::deserialize)
|
fun sortingMode() = preferenceStore.getObject("library_sorting_mode", LibrarySort.default, LibrarySort.Serializer::serialize, LibrarySort.Serializer::deserialize)
|
||||||
|
|
||||||
fun portraitColumns() = preferenceStore.getInt("pref_library_columns_portrait_key", 0)
|
fun portraitColumns() = preferenceStore.getInt("pref_library_columns_portrait_key", 0)
|
||||||
|
|
||||||
fun landscapeColumns() = preferenceStore.getInt("pref_library_columns_landscape_key", 0)
|
fun landscapeColumns() = preferenceStore.getInt("pref_library_columns_landscape_key", 0)
|
||||||
|
|
||||||
fun libraryUpdateInterval() = preferenceStore.getInt("pref_library_update_interval_key", 0)
|
fun lastUpdatedTimestamp() = preferenceStore.getLong("library_update_last_timestamp", 0L)
|
||||||
fun libraryUpdateLastTimestamp() = preferenceStore.getLong("library_update_last_timestamp", 0L)
|
fun autoUpdateInterval() = preferenceStore.getInt("pref_library_update_interval_key", 0)
|
||||||
|
|
||||||
fun libraryUpdateDeviceRestriction() = preferenceStore.getStringSet(
|
fun autoUpdateDeviceRestrictions() = preferenceStore.getStringSet(
|
||||||
"library_update_restriction",
|
"library_update_restriction",
|
||||||
setOf(
|
setOf(
|
||||||
DEVICE_ONLY_ON_WIFI,
|
DEVICE_ONLY_ON_WIFI,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
fun libraryUpdateMangaRestriction() = preferenceStore.getStringSet(
|
fun autoUpdateMangaRestrictions() = preferenceStore.getStringSet(
|
||||||
"library_update_manga_restriction",
|
"library_update_manga_restriction",
|
||||||
setOf(
|
setOf(
|
||||||
MANGA_HAS_UNREAD,
|
MANGA_HAS_UNREAD,
|
||||||
@ -101,9 +101,9 @@ class LibraryPreferences(
|
|||||||
|
|
||||||
fun categorizedDisplaySettings() = preferenceStore.getBoolean("categorized_display", false)
|
fun categorizedDisplaySettings() = preferenceStore.getBoolean("categorized_display", false)
|
||||||
|
|
||||||
fun libraryUpdateCategories() = preferenceStore.getStringSet("library_update_categories", emptySet())
|
fun updateCategories() = preferenceStore.getStringSet("library_update_categories", emptySet())
|
||||||
|
|
||||||
fun libraryUpdateCategoriesExclude() = preferenceStore.getStringSet("library_update_categories_exclude", emptySet())
|
fun updateCategoriesExclude() = preferenceStore.getStringSet("library_update_categories_exclude", emptySet())
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
|
||||||
@ -164,7 +164,6 @@ class LibraryPreferences(
|
|||||||
const val DEVICE_ONLY_ON_WIFI = "wifi"
|
const val DEVICE_ONLY_ON_WIFI = "wifi"
|
||||||
const val DEVICE_NETWORK_NOT_METERED = "network_not_metered"
|
const val DEVICE_NETWORK_NOT_METERED = "network_not_metered"
|
||||||
const val DEVICE_CHARGING = "ac"
|
const val DEVICE_CHARGING = "ac"
|
||||||
const val DEVICE_BATTERY_NOT_LOW = "battery_not_low"
|
|
||||||
|
|
||||||
const val MANGA_NON_COMPLETED = "manga_ongoing"
|
const val MANGA_NON_COMPLETED = "manga_ongoing"
|
||||||
const val MANGA_HAS_UNREAD = "manga_fully_read"
|
const val MANGA_HAS_UNREAD = "manga_fully_read"
|
||||||
|
@ -249,7 +249,6 @@
|
|||||||
<string name="connected_to_wifi">Only on Wi-Fi</string>
|
<string name="connected_to_wifi">Only on Wi-Fi</string>
|
||||||
<string name="network_not_metered">Only on unmetered network</string>
|
<string name="network_not_metered">Only on unmetered network</string>
|
||||||
<string name="charging">When charging</string>
|
<string name="charging">When charging</string>
|
||||||
<string name="battery_not_low">When battery not low</string>
|
|
||||||
<string name="restrictions">Restrictions: %s</string>
|
<string name="restrictions">Restrictions: %s</string>
|
||||||
|
|
||||||
<string name="pref_library_update_manga_restriction">Skip updating entries</string>
|
<string name="pref_library_update_manga_restriction">Skip updating entries</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user