2017-05-21 07:42:06 -04:00
|
|
|
package eu.kanade.tachiyomi
|
|
|
|
|
2022-09-17 11:48:24 -04:00
|
|
|
import android.content.Context
|
2021-04-19 15:33:08 -04:00
|
|
|
import android.os.Build
|
2020-09-14 17:52:00 -04:00
|
|
|
import androidx.core.content.edit
|
|
|
|
import androidx.preference.PreferenceManager
|
2022-09-22 08:57:42 -04:00
|
|
|
import eu.kanade.domain.backup.service.BackupPreferences
|
2022-09-25 10:07:06 -04:00
|
|
|
import eu.kanade.domain.base.BasePreferences
|
2022-09-19 23:55:07 -04:00
|
|
|
import eu.kanade.domain.library.service.LibraryPreferences
|
2022-09-18 10:36:41 -04:00
|
|
|
import eu.kanade.domain.source.service.SourcePreferences
|
2022-09-25 10:07:06 -04:00
|
|
|
import eu.kanade.domain.ui.UiPreferences
|
|
|
|
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
2022-09-18 13:07:48 -04:00
|
|
|
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
2020-03-13 17:29:51 -04:00
|
|
|
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
|
2017-05-21 07:42:06 -04:00
|
|
|
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
2022-02-14 18:16:22 -05:00
|
|
|
import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED
|
2022-02-05 18:51:08 -05:00
|
|
|
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
2020-12-12 11:26:42 -05:00
|
|
|
import eu.kanade.tachiyomi.data.track.TrackManager
|
2021-10-16 10:21:15 -04:00
|
|
|
import eu.kanade.tachiyomi.data.updater.AppUpdateJob
|
2020-03-20 22:53:24 -04:00
|
|
|
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
|
2022-09-17 11:48:24 -04:00
|
|
|
import eu.kanade.tachiyomi.network.NetworkPreferences
|
2021-04-11 13:10:03 -04:00
|
|
|
import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE
|
2021-04-28 08:32:47 -04:00
|
|
|
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
|
2022-09-20 08:36:57 -04:00
|
|
|
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
2021-12-31 16:32:24 -05:00
|
|
|
import eu.kanade.tachiyomi.util.preference.minusAssign
|
|
|
|
import eu.kanade.tachiyomi.util.preference.plusAssign
|
2022-02-05 23:02:13 -05:00
|
|
|
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
2020-12-13 17:52:21 -05:00
|
|
|
import eu.kanade.tachiyomi.util.system.toast
|
2020-09-14 17:52:00 -04:00
|
|
|
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
|
2020-12-12 11:26:42 -05:00
|
|
|
import uy.kohesive.injekt.Injekt
|
|
|
|
import uy.kohesive.injekt.api.get
|
2017-05-21 07:42:06 -04:00
|
|
|
import java.io.File
|
|
|
|
|
|
|
|
object Migrations {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Performs a migration when the application is updated.
|
|
|
|
*
|
|
|
|
* @param preferences Preferences of the application.
|
|
|
|
* @return true if a migration is performed, false otherwise.
|
|
|
|
*/
|
2022-09-17 11:48:24 -04:00
|
|
|
fun upgrade(
|
|
|
|
context: Context,
|
2022-09-25 10:07:06 -04:00
|
|
|
preferenceStore: PreferenceStore,
|
|
|
|
basePreferences: BasePreferences,
|
|
|
|
uiPreferences: UiPreferences,
|
2022-09-17 11:48:24 -04:00
|
|
|
networkPreferences: NetworkPreferences,
|
2022-09-18 10:36:41 -04:00
|
|
|
sourcePreferences: SourcePreferences,
|
2022-09-18 13:07:48 -04:00
|
|
|
securityPreferences: SecurityPreferences,
|
2022-09-19 23:55:07 -04:00
|
|
|
libraryPreferences: LibraryPreferences,
|
2022-09-20 08:36:57 -04:00
|
|
|
readerPreferences: ReaderPreferences,
|
2022-09-22 08:57:42 -04:00
|
|
|
backupPreferences: BackupPreferences,
|
2022-09-17 11:48:24 -04:00
|
|
|
): Boolean {
|
2022-09-25 10:07:06 -04:00
|
|
|
val lastVersionCode = preferenceStore.getInt("last_version_code", 0)
|
|
|
|
val oldVersion = lastVersionCode.get()
|
2017-05-21 07:42:06 -04:00
|
|
|
if (oldVersion < BuildConfig.VERSION_CODE) {
|
2022-09-25 10:07:06 -04:00
|
|
|
lastVersionCode.set(BuildConfig.VERSION_CODE)
|
2017-05-21 07:42:06 -04:00
|
|
|
|
2021-08-13 18:28:07 -04:00
|
|
|
// Always set up background tasks to ensure they're running
|
|
|
|
if (BuildConfig.INCLUDE_UPDATER) {
|
2021-10-16 10:21:15 -04:00
|
|
|
AppUpdateJob.setupTask(context)
|
2021-08-13 18:28:07 -04:00
|
|
|
}
|
|
|
|
ExtensionUpdateJob.setupTask(context)
|
|
|
|
LibraryUpdateJob.setupTask(context)
|
|
|
|
BackupCreatorJob.setupTask(context)
|
|
|
|
|
2020-03-07 13:11:02 -05:00
|
|
|
// Fresh install
|
|
|
|
if (oldVersion == 0) {
|
|
|
|
return false
|
|
|
|
}
|
2017-05-21 07:42:06 -04:00
|
|
|
|
2021-12-17 09:57:37 -05:00
|
|
|
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
|
|
|
|
|
2017-05-21 07:42:06 -04:00
|
|
|
if (oldVersion < 14) {
|
2020-03-07 13:00:58 -05:00
|
|
|
// Restore jobs after upgrading to Evernote's job scheduler.
|
2020-04-24 10:39:55 -04:00
|
|
|
if (BuildConfig.INCLUDE_UPDATER) {
|
2021-10-16 10:21:15 -04:00
|
|
|
AppUpdateJob.setupTask(context)
|
2017-05-21 07:42:06 -04:00
|
|
|
}
|
2020-03-07 13:00:58 -05:00
|
|
|
LibraryUpdateJob.setupTask(context)
|
2017-05-21 07:42:06 -04:00
|
|
|
}
|
|
|
|
if (oldVersion < 15) {
|
|
|
|
// Delete internal chapter cache dir.
|
|
|
|
File(context.cacheDir, "chapter_disk_cache").deleteRecursively()
|
|
|
|
}
|
|
|
|
if (oldVersion < 19) {
|
|
|
|
// Move covers to external files dir.
|
|
|
|
val oldDir = File(context.externalCacheDir, "cover_disk_cache")
|
|
|
|
if (oldDir.exists()) {
|
|
|
|
val destDir = context.getExternalFilesDir("covers")
|
|
|
|
if (destDir != null) {
|
2020-03-07 13:00:58 -05:00
|
|
|
oldDir.listFiles()?.forEach {
|
2017-05-21 07:42:06 -04:00
|
|
|
it.renameTo(File(destDir, it.name))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-10 06:29:04 -04:00
|
|
|
if (oldVersion < 26) {
|
|
|
|
// Delete external chapter cache dir.
|
|
|
|
val extCache = context.externalCacheDir
|
|
|
|
if (extCache != null) {
|
|
|
|
val chapterCache = File(extCache, "chapter_disk_cache")
|
|
|
|
if (chapterCache.exists()) {
|
|
|
|
chapterCache.deleteRecursively()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-03-13 17:29:51 -04:00
|
|
|
if (oldVersion < 43) {
|
|
|
|
// Restore jobs after migrating from Evernote's job scheduler to WorkManager.
|
2020-04-24 10:39:55 -04:00
|
|
|
if (BuildConfig.INCLUDE_UPDATER) {
|
2021-10-16 10:21:15 -04:00
|
|
|
AppUpdateJob.setupTask(context)
|
2020-03-13 17:29:51 -04:00
|
|
|
}
|
|
|
|
LibraryUpdateJob.setupTask(context)
|
|
|
|
BackupCreatorJob.setupTask(context)
|
2020-04-29 09:09:18 -04:00
|
|
|
|
|
|
|
// New extension update check job
|
2020-04-29 09:42:56 -04:00
|
|
|
ExtensionUpdateJob.setupTask(context)
|
2020-03-13 17:29:51 -04:00
|
|
|
}
|
2020-05-01 19:59:08 -04:00
|
|
|
if (oldVersion < 44) {
|
|
|
|
// Reset sorting preference if using removed sort by source
|
2022-09-19 23:55:07 -04:00
|
|
|
val oldSortingMode = prefs.getInt(libraryPreferences.librarySortingMode().key(), 0)
|
2021-06-26 13:30:16 -04:00
|
|
|
|
2022-08-18 14:06:32 -04:00
|
|
|
if (oldSortingMode == 5) { // SOURCE = 5
|
2021-06-26 13:30:16 -04:00
|
|
|
prefs.edit {
|
2022-09-19 23:55:07 -04:00
|
|
|
putInt(libraryPreferences.librarySortingMode().key(), 0) // ALPHABETICAL = 0
|
2021-06-26 13:30:16 -04:00
|
|
|
}
|
2020-05-01 19:59:08 -04:00
|
|
|
}
|
|
|
|
}
|
2020-09-14 17:52:00 -04:00
|
|
|
if (oldVersion < 52) {
|
|
|
|
// Migrate library filters to tri-state versions
|
|
|
|
fun convertBooleanPrefToTriState(key: String): Int {
|
|
|
|
val oldPrefValue = prefs.getBoolean(key, false)
|
2022-09-10 23:57:03 -04:00
|
|
|
return if (oldPrefValue) {
|
|
|
|
ExtendedNavigationView.Item.TriStateGroup.State.INCLUDE.value
|
|
|
|
} else {
|
|
|
|
ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value
|
|
|
|
}
|
2020-09-14 17:52:00 -04:00
|
|
|
}
|
|
|
|
prefs.edit {
|
2022-09-19 23:55:07 -04:00
|
|
|
putInt(libraryPreferences.filterDownloaded().key(), convertBooleanPrefToTriState("pref_filter_downloaded_key"))
|
2020-09-14 17:52:00 -04:00
|
|
|
remove("pref_filter_downloaded_key")
|
2020-09-15 17:53:01 -04:00
|
|
|
|
2022-09-19 23:55:07 -04:00
|
|
|
putInt(libraryPreferences.filterUnread().key(), convertBooleanPrefToTriState("pref_filter_unread_key"))
|
2020-09-14 17:52:00 -04:00
|
|
|
remove("pref_filter_unread_key")
|
2020-09-15 17:53:01 -04:00
|
|
|
|
2022-09-19 23:55:07 -04:00
|
|
|
putInt(libraryPreferences.filterCompleted().key(), convertBooleanPrefToTriState("pref_filter_completed_key"))
|
2020-09-14 17:52:00 -04:00
|
|
|
remove("pref_filter_completed_key")
|
|
|
|
}
|
2020-12-18 23:20:42 -05:00
|
|
|
}
|
2020-12-21 17:10:08 -05:00
|
|
|
if (oldVersion < 54) {
|
2020-12-12 11:26:42 -05:00
|
|
|
// Force MAL log out due to login flow change
|
2020-12-18 23:20:42 -05:00
|
|
|
// v52: switched from scraping to WebView
|
|
|
|
// v53: switched from WebView to OAuth
|
2020-12-12 11:26:42 -05:00
|
|
|
val trackManager = Injekt.get<TrackManager>()
|
2020-12-13 17:52:21 -05:00
|
|
|
if (trackManager.myAnimeList.isLogged) {
|
|
|
|
trackManager.myAnimeList.logout()
|
|
|
|
context.toast(R.string.myanimelist_relogin)
|
|
|
|
}
|
2020-09-14 17:52:00 -04:00
|
|
|
}
|
2021-04-11 13:10:03 -04:00
|
|
|
if (oldVersion < 57) {
|
|
|
|
// Migrate DNS over HTTPS setting
|
|
|
|
val wasDohEnabled = prefs.getBoolean("enable_doh", false)
|
|
|
|
if (wasDohEnabled) {
|
|
|
|
prefs.edit {
|
2022-09-17 11:48:24 -04:00
|
|
|
putInt(networkPreferences.dohProvider().key(), PREF_DOH_CLOUDFLARE)
|
2021-04-11 13:10:03 -04:00
|
|
|
remove("enable_doh")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-23 22:37:43 -04:00
|
|
|
if (oldVersion < 59) {
|
|
|
|
// Reset rotation to Free after replacing Lock
|
2021-04-28 08:32:47 -04:00
|
|
|
if (prefs.contains("pref_rotation_type_key")) {
|
|
|
|
prefs.edit {
|
|
|
|
putInt("pref_rotation_type_key", 1)
|
|
|
|
}
|
|
|
|
}
|
2021-04-19 15:33:08 -04:00
|
|
|
|
|
|
|
// Disable update check for Android 5.x users
|
|
|
|
if (BuildConfig.INCLUDE_UPDATER && Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
|
2021-10-16 10:21:15 -04:00
|
|
|
AppUpdateJob.cancelTask(context)
|
2021-04-19 15:33:08 -04:00
|
|
|
}
|
2021-04-23 22:37:43 -04:00
|
|
|
}
|
2021-04-28 08:32:47 -04:00
|
|
|
if (oldVersion < 60) {
|
2022-09-18 10:55:30 -04:00
|
|
|
// Re-enable update check that was previously accidentally disabled for M
|
2021-04-28 08:55:30 -04:00
|
|
|
if (BuildConfig.INCLUDE_UPDATER && Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
|
2021-10-16 10:21:15 -04:00
|
|
|
AppUpdateJob.setupTask(context)
|
2021-04-28 08:55:30 -04:00
|
|
|
}
|
|
|
|
|
2021-04-28 08:32:47 -04:00
|
|
|
// Migrate Rotation and Viewer values to default values for viewer_flags
|
|
|
|
val newOrientation = when (prefs.getInt("pref_rotation_type_key", 1)) {
|
|
|
|
1 -> OrientationType.FREE.flagValue
|
|
|
|
2 -> OrientationType.PORTRAIT.flagValue
|
|
|
|
3 -> OrientationType.LANDSCAPE.flagValue
|
|
|
|
4 -> OrientationType.LOCKED_PORTRAIT.flagValue
|
|
|
|
5 -> OrientationType.LOCKED_LANDSCAPE.flagValue
|
|
|
|
else -> OrientationType.FREE.flagValue
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reading mode flag and prefValue is the same value
|
|
|
|
val newReadingMode = prefs.getInt("pref_default_viewer_key", 1)
|
|
|
|
|
|
|
|
prefs.edit {
|
|
|
|
putInt("pref_default_orientation_type_key", newOrientation)
|
|
|
|
remove("pref_rotation_type_key")
|
|
|
|
putInt("pref_default_reading_mode_key", newReadingMode)
|
|
|
|
remove("pref_default_viewer_key")
|
|
|
|
}
|
|
|
|
}
|
2021-05-22 11:52:28 -04:00
|
|
|
if (oldVersion < 61) {
|
|
|
|
// Handle removed every 1 or 2 hour library updates
|
2022-09-19 23:55:07 -04:00
|
|
|
val updateInterval = libraryPreferences.libraryUpdateInterval().get()
|
2021-05-22 11:52:28 -04:00
|
|
|
if (updateInterval == 1 || updateInterval == 2) {
|
2022-09-19 23:55:07 -04:00
|
|
|
libraryPreferences.libraryUpdateInterval().set(3)
|
2021-05-22 11:52:28 -04:00
|
|
|
LibraryUpdateJob.setupTask(context, 3)
|
|
|
|
}
|
|
|
|
}
|
2021-06-26 13:30:16 -04:00
|
|
|
if (oldVersion < 64) {
|
2022-09-19 23:55:07 -04:00
|
|
|
val oldSortingMode = prefs.getInt(libraryPreferences.librarySortingMode().key(), 0)
|
2022-08-29 13:10:30 -04:00
|
|
|
val oldSortingDirection = prefs.getBoolean("library_sorting_ascending", true)
|
2021-06-26 13:30:16 -04:00
|
|
|
|
|
|
|
val newSortingMode = when (oldSortingMode) {
|
2022-08-29 13:10:30 -04:00
|
|
|
0 -> "ALPHABETICAL"
|
|
|
|
1 -> "LAST_READ"
|
|
|
|
2 -> "LAST_CHECKED"
|
|
|
|
3 -> "UNREAD"
|
|
|
|
4 -> "TOTAL_CHAPTERS"
|
|
|
|
6 -> "LATEST_CHAPTER"
|
|
|
|
8 -> "DATE_FETCHED"
|
|
|
|
7 -> "DATE_ADDED"
|
|
|
|
else -> "ALPHABETICAL"
|
2021-06-26 13:30:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
val newSortingDirection = when (oldSortingDirection) {
|
2022-08-29 13:10:30 -04:00
|
|
|
true -> "ASCENDING"
|
|
|
|
else -> "DESCENDING"
|
2021-06-26 13:30:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
prefs.edit(commit = true) {
|
2022-09-19 23:55:07 -04:00
|
|
|
remove(libraryPreferences.librarySortingMode().key())
|
2022-08-29 13:10:30 -04:00
|
|
|
remove("library_sorting_ascending")
|
2021-06-26 13:30:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
prefs.edit {
|
2022-09-19 23:55:07 -04:00
|
|
|
putString(libraryPreferences.librarySortingMode().key(), newSortingMode)
|
2022-08-29 13:10:30 -04:00
|
|
|
putString("library_sorting_ascending", newSortingDirection)
|
2021-06-26 13:30:16 -04:00
|
|
|
}
|
|
|
|
}
|
2021-10-12 18:31:27 -04:00
|
|
|
if (oldVersion < 70) {
|
2022-09-18 10:36:41 -04:00
|
|
|
if (sourcePreferences.enabledLanguages().isSet()) {
|
|
|
|
sourcePreferences.enabledLanguages() += "all"
|
2021-10-12 18:31:27 -04:00
|
|
|
}
|
|
|
|
}
|
2021-10-18 09:54:09 -04:00
|
|
|
if (oldVersion < 71) {
|
|
|
|
// Handle removed every 3, 4, 6, and 8 hour library updates
|
2022-09-19 23:55:07 -04:00
|
|
|
val updateInterval = libraryPreferences.libraryUpdateInterval().get()
|
2021-10-18 09:54:09 -04:00
|
|
|
if (updateInterval in listOf(3, 4, 6, 8)) {
|
2022-09-19 23:55:07 -04:00
|
|
|
libraryPreferences.libraryUpdateInterval().set(12)
|
2021-10-18 09:54:09 -04:00
|
|
|
LibraryUpdateJob.setupTask(context, 12)
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 09:57:37 -05:00
|
|
|
if (oldVersion < 72) {
|
|
|
|
val oldUpdateOngoingOnly = prefs.getBoolean("pref_update_only_non_completed_key", true)
|
|
|
|
if (!oldUpdateOngoingOnly) {
|
2022-09-19 23:55:07 -04:00
|
|
|
libraryPreferences.libraryUpdateMangaRestriction() -= MANGA_NON_COMPLETED
|
2021-12-17 09:57:37 -05:00
|
|
|
}
|
|
|
|
}
|
2022-02-05 18:51:08 -05:00
|
|
|
if (oldVersion < 75) {
|
|
|
|
val oldSecureScreen = prefs.getBoolean("secure_screen", false)
|
|
|
|
if (oldSecureScreen) {
|
2022-09-18 13:07:48 -04:00
|
|
|
securityPreferences.secureScreen().set(SecurityPreferences.SecureScreenMode.ALWAYS)
|
2022-02-05 18:51:08 -05:00
|
|
|
}
|
2022-09-25 10:07:06 -04:00
|
|
|
if (DeviceUtil.isMiui && basePreferences.extensionInstaller().get() == PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER) {
|
|
|
|
basePreferences.extensionInstaller().set(PreferenceValues.ExtensionInstaller.LEGACY)
|
2022-02-05 23:02:13 -05:00
|
|
|
}
|
2022-02-05 18:51:08 -05:00
|
|
|
}
|
2022-03-06 08:36:47 -05:00
|
|
|
if (oldVersion < 76) {
|
|
|
|
BackupCreatorJob.setupTask(context)
|
|
|
|
}
|
2022-04-08 16:44:13 -04:00
|
|
|
if (oldVersion < 77) {
|
|
|
|
val oldReaderTap = prefs.getBoolean("reader_tap", false)
|
|
|
|
if (!oldReaderTap) {
|
2022-09-20 08:36:57 -04:00
|
|
|
readerPreferences.navigationModePager().set(5)
|
|
|
|
readerPreferences.navigationModeWebtoon().set(5)
|
2022-04-08 16:44:13 -04:00
|
|
|
}
|
|
|
|
}
|
2022-05-07 23:48:53 -04:00
|
|
|
if (oldVersion < 81) {
|
|
|
|
// Handle renamed enum values
|
2022-08-29 13:10:30 -04:00
|
|
|
prefs.edit {
|
2022-09-19 23:55:07 -04:00
|
|
|
val newSortingMode = when (val oldSortingMode = prefs.getString(libraryPreferences.librarySortingMode().key(), "ALPHABETICAL")) {
|
2022-08-29 13:10:30 -04:00
|
|
|
"LAST_CHECKED" -> "LAST_MANGA_UPDATE"
|
|
|
|
"UNREAD" -> "UNREAD_COUNT"
|
|
|
|
"DATE_FETCHED" -> "CHAPTER_FETCH_DATE"
|
|
|
|
else -> oldSortingMode
|
|
|
|
}
|
2022-09-19 23:55:07 -04:00
|
|
|
putString(libraryPreferences.librarySortingMode().key(), newSortingMode)
|
2022-08-29 13:10:30 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (oldVersion < 82) {
|
|
|
|
prefs.edit {
|
2022-09-19 23:55:07 -04:00
|
|
|
val sort = prefs.getString(libraryPreferences.librarySortingMode().key(), null) ?: return@edit
|
2022-08-29 13:10:30 -04:00
|
|
|
val direction = prefs.getString("library_sorting_ascending", "ASCENDING")!!
|
2022-09-19 23:55:07 -04:00
|
|
|
putString(libraryPreferences.librarySortingMode().key(), "$sort,$direction")
|
2022-08-29 13:10:30 -04:00
|
|
|
remove("library_sorting_ascending")
|
2022-05-07 23:48:53 -04:00
|
|
|
}
|
|
|
|
}
|
2022-09-15 22:53:46 -04:00
|
|
|
if (oldVersion < 84) {
|
2022-09-22 08:57:42 -04:00
|
|
|
if (backupPreferences.numberOfBackups().get() == 1) {
|
|
|
|
backupPreferences.numberOfBackups().set(2)
|
2022-09-15 22:53:46 -04:00
|
|
|
}
|
2022-09-22 08:57:42 -04:00
|
|
|
if (backupPreferences.backupInterval().get() == 0) {
|
|
|
|
backupPreferences.backupInterval().set(12)
|
2022-09-15 22:53:46 -04:00
|
|
|
BackupCreatorJob.setupTask(context)
|
|
|
|
}
|
|
|
|
}
|
2022-09-24 10:14:16 -04:00
|
|
|
if (oldVersion < 85) {
|
|
|
|
val preferences = listOf(
|
|
|
|
libraryPreferences.filterChapterByRead(),
|
|
|
|
libraryPreferences.filterChapterByDownloaded(),
|
|
|
|
libraryPreferences.filterChapterByBookmarked(),
|
|
|
|
libraryPreferences.sortChapterBySourceOrNumber(),
|
|
|
|
libraryPreferences.displayChapterByNameOrNumber(),
|
|
|
|
libraryPreferences.sortChapterByAscendingOrDescending(),
|
|
|
|
)
|
|
|
|
|
|
|
|
prefs.edit {
|
|
|
|
preferences.forEach { preference ->
|
|
|
|
val key = preference.key()
|
|
|
|
val value = prefs.getInt(key, Int.MIN_VALUE)
|
|
|
|
if (value == Int.MIN_VALUE) return@forEach
|
|
|
|
remove(key)
|
|
|
|
putLong(key, value.toLong())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-09-25 10:07:06 -04:00
|
|
|
if (oldVersion < 86) {
|
|
|
|
if (uiPreferences.themeMode().isSet()) {
|
|
|
|
prefs.edit {
|
|
|
|
val themeMode = prefs.getString(uiPreferences.themeMode().key(), null) ?: return@edit
|
|
|
|
putString(uiPreferences.themeMode().key(), themeMode.uppercase())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-07-04 14:36:56 -04:00
|
|
|
return true
|
2017-05-21 07:42:06 -04:00
|
|
|
}
|
2020-12-12 11:26:42 -05:00
|
|
|
|
2017-05-21 07:42:06 -04:00
|
|
|
return false
|
|
|
|
}
|
2020-02-26 18:03:34 -05:00
|
|
|
}
|