Split the rest of the preferences in PreferencesHelper (#8074)
* Split the reset of the preferences in PreferencesHelper * Capitalize ThemeMode (cherry picked from commit 29fa93e829ca7f9c3a28c58f3de146bc2bd15aad) # Conflicts: # app/build.gradle.kts # app/src/main/java/eu/kanade/domain/manga/model/Manga.kt # app/src/main/java/eu/kanade/tachiyomi/App.kt # app/src/main/java/eu/kanade/tachiyomi/AppModule.kt # app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt # app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceValues.kt # app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt # app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt # app/src/main/java/eu/kanade/tachiyomi/ui/base/delegate/SecureActivityDelegate.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt # app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcesPresenter.kt # app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt # app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySettingsSheet.kt # app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt # app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsAdvancedController.kt
This commit is contained in:
parent
0d0513cff7
commit
1f4bfc4764
@ -28,7 +28,7 @@ android {
|
||||
applicationId = "eu.kanade.tachiyomi.sy"
|
||||
minSdk = AndroidConfig.minSdk
|
||||
targetSdk = AndroidConfig.targetSdk
|
||||
versionCode = 41
|
||||
versionCode = 42
|
||||
versionName = "1.8.5"
|
||||
|
||||
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
|
||||
|
@ -1,69 +1,15 @@
|
||||
package eu.kanade.tachiyomi.data.preference
|
||||
package eu.kanade.domain
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||
import eu.kanade.tachiyomi.core.preference.getEnum
|
||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
|
||||
|
||||
class PreferencesHelper(
|
||||
val context: Context,
|
||||
class UnsortedPreferences(
|
||||
private val preferenceStore: PreferenceStore,
|
||||
) {
|
||||
|
||||
fun confirmExit() = preferenceStore.getBoolean("pref_confirm_exit", false)
|
||||
|
||||
fun sideNavIconAlignment() = preferenceStore.getInt("pref_side_nav_icon_alignment", 0)
|
||||
|
||||
fun themeMode() = preferenceStore.getEnum(
|
||||
"pref_theme_mode_key",
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Values.ThemeMode.system } else { Values.ThemeMode.light },
|
||||
)
|
||||
|
||||
fun appTheme() = preferenceStore.getEnum(
|
||||
"pref_app_theme",
|
||||
if (DeviceUtil.isDynamicColorAvailable) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT },
|
||||
)
|
||||
|
||||
fun themeDarkAmoled() = preferenceStore.getBoolean("pref_theme_dark_amoled_key", false)
|
||||
|
||||
fun lastVersionCode() = preferenceStore.getInt("last_version_code", 0)
|
||||
|
||||
fun relativeTime() = preferenceStore.getInt("relative_time", 7)
|
||||
|
||||
fun dateFormat(format: String = preferenceStore.getString(Keys.dateFormat, "").get()): DateFormat = when (format) {
|
||||
"" -> DateFormat.getDateInstance(DateFormat.SHORT)
|
||||
else -> SimpleDateFormat(format, Locale.getDefault())
|
||||
}
|
||||
|
||||
fun downloadedOnly() = preferenceStore.getBoolean("pref_downloaded_only", false)
|
||||
|
||||
fun automaticExtUpdates() = preferenceStore.getBoolean("automatic_ext_updates", true)
|
||||
|
||||
fun lastAppCheck() = preferenceStore.getLong("last_app_check", 0)
|
||||
fun lastExtCheck() = preferenceStore.getLong("last_ext_check", 0)
|
||||
// SY -->
|
||||
|
||||
fun migrateFlags() = preferenceStore.getInt("migrate_flags", Int.MAX_VALUE)
|
||||
|
||||
fun incognitoMode() = preferenceStore.getBoolean("incognito_mode", false)
|
||||
|
||||
fun tabletUiMode() = preferenceStore.getEnum("tablet_ui_mode", Values.TabletUiMode.AUTOMATIC)
|
||||
|
||||
fun extensionInstaller() = preferenceStore.getEnum(
|
||||
"extension_installer",
|
||||
if (DeviceUtil.isMiui) Values.ExtensionInstaller.LEGACY else Values.ExtensionInstaller.PACKAGEINSTALLER,
|
||||
)
|
||||
|
||||
fun autoClearChapterCache() = preferenceStore.getBoolean("auto_clear_chapter_cache", false)
|
||||
|
||||
// SY -->
|
||||
|
||||
fun defaultMangaOrder() = preferenceStore.getString("default_manga_order", "")
|
||||
|
||||
fun migrationSources() = preferenceStore.getString("migrate_sources", "")
|
||||
@ -111,12 +57,8 @@ class PreferencesHelper(
|
||||
|
||||
fun exhShowSettingsUploadWarning() = preferenceStore.getBoolean("eh_showSettingsUploadWarning2", true)
|
||||
|
||||
fun expandFilters() = preferenceStore.getBoolean("eh_expand_filters", false)
|
||||
|
||||
fun autoSolveCaptcha() = preferenceStore.getBoolean("eh_autosolve_captchas", false)
|
||||
|
||||
fun ehLastVersionCode() = preferenceStore.getInt("eh_last_version_code", 0)
|
||||
|
||||
fun logLevel() = preferenceStore.getInt("eh_log_level", 0)
|
||||
|
||||
fun exhAutoUpdateFrequency() = preferenceStore.getInt("eh_auto_update_frequency", 1)
|
||||
@ -137,18 +79,10 @@ class PreferencesHelper(
|
||||
"false,false,false,false,false,false,false,false,false,false",
|
||||
)
|
||||
|
||||
fun feedTabInFront() = preferenceStore.getBoolean("latest_tab_position", false)
|
||||
|
||||
fun sourceSorting() = preferenceStore.getInt("sources_sort", 0)
|
||||
|
||||
fun recommendsInOverflow() = preferenceStore.getBoolean("recommends_in_overflow", false)
|
||||
|
||||
fun mergeInOverflow() = preferenceStore.getBoolean("merge_in_overflow", false)
|
||||
|
||||
fun enhancedEHentaiView() = preferenceStore.getBoolean("enhanced_e_hentai_view", true)
|
||||
|
||||
fun useNewSourceNavigation() = preferenceStore.getBoolean("use_new_source_navigation", true)
|
||||
|
||||
fun preferredMangaDexId() = preferenceStore.getString("preferred_mangaDex_id", "0")
|
||||
|
||||
fun mangadexSyncToLibraryIndexes() = preferenceStore.getStringSet("pref_mangadex_sync_to_library_indexes", emptySet())
|
||||
@ -156,10 +90,4 @@ class PreferencesHelper(
|
||||
fun allowLocalSourceHiddenFolders() = preferenceStore.getBoolean("allow_local_source_hidden_folders", false)
|
||||
|
||||
fun extensionRepos() = preferenceStore.getStringSet("extension_repos", emptySet())
|
||||
|
||||
fun bottomBarLabels() = preferenceStore.getBoolean("pref_show_bottom_bar_labels", true)
|
||||
|
||||
fun showNavUpdates() = preferenceStore.getBoolean("pref_show_updates_button", true)
|
||||
|
||||
fun showNavHistory() = preferenceStore.getBoolean("pref_show_history_button", true)
|
||||
}
|
26
app/src/main/java/eu/kanade/domain/base/BasePreferences.kt
Normal file
26
app/src/main/java/eu/kanade/domain/base/BasePreferences.kt
Normal file
@ -0,0 +1,26 @@
|
||||
package eu.kanade.domain.base
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||
import eu.kanade.tachiyomi.core.preference.getEnum
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
|
||||
class BasePreferences(
|
||||
val context: Context,
|
||||
private val preferenceStore: PreferenceStore,
|
||||
) {
|
||||
|
||||
fun confirmExit() = preferenceStore.getBoolean("pref_confirm_exit", false)
|
||||
|
||||
fun downloadedOnly() = preferenceStore.getBoolean("pref_downloaded_only", false)
|
||||
|
||||
fun incognitoMode() = preferenceStore.getBoolean("incognito_mode", false)
|
||||
|
||||
fun automaticExtUpdates() = preferenceStore.getBoolean("automatic_ext_updates", true)
|
||||
|
||||
fun extensionInstaller() = preferenceStore.getEnum(
|
||||
"extension_installer",
|
||||
if (DeviceUtil.isMiui) PreferenceValues.ExtensionInstaller.LEGACY else PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER,
|
||||
)
|
||||
}
|
@ -110,6 +110,8 @@ class LibraryPreferences(
|
||||
sortChapterByAscendingOrDescending().set(if (manga.sortDescending()) Manga.CHAPTER_SORT_DESC else Manga.CHAPTER_SORT_ASC)
|
||||
}
|
||||
|
||||
fun autoClearChapterCache() = preferenceStore.getBoolean("auto_clear_chapter_cache", false)
|
||||
|
||||
// endregion
|
||||
|
||||
// SY -->
|
||||
|
@ -2,10 +2,10 @@ package eu.kanade.domain.manga.model
|
||||
|
||||
import eu.kanade.data.listOfStringsAdapter
|
||||
import eu.kanade.data.listOfStringsAndAdapter
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||
import eu.kanade.tachiyomi.data.database.models.MangaImpl
|
||||
import eu.kanade.tachiyomi.data.library.CustomMangaManager
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.LocalSource
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
|
||||
@ -112,7 +112,7 @@ data class Manga(
|
||||
}
|
||||
|
||||
fun forceDownloaded(): Boolean {
|
||||
return favorite && Injekt.get<PreferencesHelper>().downloadedOnly().get()
|
||||
return favorite && Injekt.get<BasePreferences>().downloadedOnly().get()
|
||||
}
|
||||
|
||||
fun sortDescending(): Boolean {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package eu.kanade.domain.source.interactor
|
||||
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.tachiyomi.util.preference.plusAssign
|
||||
|
||||
class CreateSourceRepo(private val preferences: PreferencesHelper) {
|
||||
class CreateSourceRepo(private val preferences: UnsortedPreferences) {
|
||||
|
||||
fun await(name: String): Result {
|
||||
// Do not allow duplicate repos.
|
||||
|
@ -1,8 +1,8 @@
|
||||
package eu.kanade.domain.source.interactor
|
||||
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
|
||||
class DeleteSourceRepos(private val preferences: PreferencesHelper) {
|
||||
class DeleteSourceRepos(private val preferences: UnsortedPreferences) {
|
||||
|
||||
fun await(repos: List<String>) {
|
||||
preferences.extensionRepos().set(
|
||||
|
@ -1,12 +1,12 @@
|
||||
package eu.kanade.domain.source.interactor
|
||||
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.ui.browse.source.SourcesController
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
class GetShowLatest(
|
||||
private val preferences: PreferencesHelper,
|
||||
private val preferences: UiPreferences,
|
||||
) {
|
||||
|
||||
fun subscribe(mode: SourcesController.Mode): Flow<Boolean> {
|
||||
|
@ -1,10 +1,10 @@
|
||||
package eu.kanade.domain.source.interactor
|
||||
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
class GetSourceRepos(private val preferences: PreferencesHelper) {
|
||||
class GetSourceRepos(private val preferences: UnsortedPreferences) {
|
||||
|
||||
fun subscribe(): Flow<List<String>> {
|
||||
return preferences.extensionRepos().changes().map { it.sortedWith(String.CASE_INSENSITIVE_ORDER) }
|
||||
|
65
app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt
Normal file
65
app/src/main/java/eu/kanade/domain/ui/UiPreferences.kt
Normal file
@ -0,0 +1,65 @@
|
||||
package eu.kanade.domain.ui
|
||||
|
||||
import android.os.Build
|
||||
import eu.kanade.domain.ui.model.AppTheme
|
||||
import eu.kanade.domain.ui.model.TabletUiMode
|
||||
import eu.kanade.domain.ui.model.ThemeMode
|
||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||
import eu.kanade.tachiyomi.core.preference.getEnum
|
||||
import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
|
||||
import java.text.DateFormat
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
|
||||
class UiPreferences(
|
||||
private val preferenceStore: PreferenceStore,
|
||||
) {
|
||||
|
||||
fun sideNavIconAlignment() = preferenceStore.getInt("pref_side_nav_icon_alignment", 0)
|
||||
|
||||
fun themeMode() = preferenceStore.getEnum(
|
||||
"pref_theme_mode_key",
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { ThemeMode.SYSTEM } else { ThemeMode.LIGHT },
|
||||
)
|
||||
|
||||
fun appTheme() = preferenceStore.getEnum(
|
||||
"pref_app_theme",
|
||||
if (DeviceUtil.isDynamicColorAvailable) { AppTheme.MONET } else { AppTheme.DEFAULT },
|
||||
)
|
||||
|
||||
fun themeDarkAmoled() = preferenceStore.getBoolean("pref_theme_dark_amoled_key", false)
|
||||
|
||||
fun relativeTime() = preferenceStore.getInt("relative_time", 7)
|
||||
|
||||
fun dateFormat() = preferenceStore.getString("app_date_format", "")
|
||||
|
||||
fun tabletUiMode() = preferenceStore.getEnum("tablet_ui_mode", TabletUiMode.AUTOMATIC)
|
||||
|
||||
// SY -->
|
||||
|
||||
fun expandFilters() = preferenceStore.getBoolean("eh_expand_filters", false)
|
||||
|
||||
fun feedTabInFront() = preferenceStore.getBoolean("latest_tab_position", false)
|
||||
|
||||
fun recommendsInOverflow() = preferenceStore.getBoolean("recommends_in_overflow", false)
|
||||
|
||||
fun mergeInOverflow() = preferenceStore.getBoolean("merge_in_overflow", false)
|
||||
|
||||
fun useNewSourceNavigation() = preferenceStore.getBoolean("use_new_source_navigation", true)
|
||||
|
||||
fun bottomBarLabels() = preferenceStore.getBoolean("pref_show_bottom_bar_labels", true)
|
||||
|
||||
fun showNavUpdates() = preferenceStore.getBoolean("pref_show_updates_button", true)
|
||||
|
||||
fun showNavHistory() = preferenceStore.getBoolean("pref_show_history_button", true)
|
||||
|
||||
// SY <--
|
||||
|
||||
companion object {
|
||||
fun dateFormat(format: String): DateFormat = when (format) {
|
||||
"" -> DateFormat.getDateInstance(DateFormat.SHORT)
|
||||
else -> SimpleDateFormat(format, Locale.getDefault())
|
||||
}
|
||||
}
|
||||
}
|
26
app/src/main/java/eu/kanade/domain/ui/model/AppTheme.kt
Normal file
26
app/src/main/java/eu/kanade/domain/ui/model/AppTheme.kt
Normal file
@ -0,0 +1,26 @@
|
||||
package eu.kanade.domain.ui.model
|
||||
|
||||
import eu.kanade.tachiyomi.R
|
||||
|
||||
enum class AppTheme(val titleResId: Int?) {
|
||||
DEFAULT(R.string.label_default),
|
||||
MONET(R.string.theme_monet),
|
||||
GREEN_APPLE(R.string.theme_greenapple),
|
||||
LAVENDER(R.string.theme_lavender),
|
||||
MIDNIGHT_DUSK(R.string.theme_midnightdusk),
|
||||
STRAWBERRY_DAIQUIRI(R.string.theme_strawberrydaiquiri),
|
||||
TAKO(R.string.theme_tako),
|
||||
TEALTURQUOISE(R.string.theme_tealturquoise),
|
||||
TIDAL_WAVE(R.string.theme_tidalwave),
|
||||
YINYANG(R.string.theme_yinyang),
|
||||
YOTSUBA(R.string.theme_yotsuba),
|
||||
|
||||
// Deprecated
|
||||
DARK_BLUE(null),
|
||||
HOT_PINK(null),
|
||||
BLUE(null),
|
||||
|
||||
// SY -->
|
||||
PURE_RED(null),
|
||||
// SY <--
|
||||
}
|
10
app/src/main/java/eu/kanade/domain/ui/model/TabletUiMode.kt
Normal file
10
app/src/main/java/eu/kanade/domain/ui/model/TabletUiMode.kt
Normal file
@ -0,0 +1,10 @@
|
||||
package eu.kanade.domain.ui.model
|
||||
|
||||
import eu.kanade.tachiyomi.R
|
||||
|
||||
enum class TabletUiMode(val titleResId: Int) {
|
||||
AUTOMATIC(R.string.automatic_background),
|
||||
ALWAYS(R.string.lock_always),
|
||||
LANDSCAPE(R.string.landscape),
|
||||
NEVER(R.string.lock_never),
|
||||
}
|
7
app/src/main/java/eu/kanade/domain/ui/model/ThemeMode.kt
Normal file
7
app/src/main/java/eu/kanade/domain/ui/model/ThemeMode.kt
Normal file
@ -0,0 +1,7 @@
|
||||
package eu.kanade.domain.ui.model
|
||||
|
||||
enum class ThemeMode {
|
||||
LIGHT,
|
||||
DARK,
|
||||
SYSTEM,
|
||||
}
|
@ -15,6 +15,7 @@ import androidx.compose.ui.graphics.Brush
|
||||
import androidx.paging.compose.LazyPagingItems
|
||||
import androidx.paging.compose.items
|
||||
import eu.kanade.domain.history.model.HistoryWithRelations
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.presentation.components.RelativeDateHeader
|
||||
import eu.kanade.presentation.components.ScrollbarLazyColumn
|
||||
import eu.kanade.presentation.history.HistoryUiModel
|
||||
@ -22,7 +23,6 @@ import eu.kanade.presentation.util.bottomNavPaddingValues
|
||||
import eu.kanade.presentation.util.plus
|
||||
import eu.kanade.presentation.util.shimmerGradient
|
||||
import eu.kanade.presentation.util.topPaddingValues
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.text.DateFormat
|
||||
@ -34,10 +34,10 @@ fun HistoryContent(
|
||||
onClickCover: (HistoryWithRelations) -> Unit,
|
||||
onClickResume: (HistoryWithRelations) -> Unit,
|
||||
onClickDelete: (HistoryWithRelations) -> Unit,
|
||||
preferences: PreferencesHelper = Injekt.get(),
|
||||
preferences: UiPreferences = Injekt.get(),
|
||||
) {
|
||||
val relativeTime: Int = remember { preferences.relativeTime().get() }
|
||||
val dateFormat: DateFormat = remember { preferences.dateFormat() }
|
||||
val dateFormat: DateFormat = remember { UiPreferences.dateFormat(preferences.dateFormat().get()) }
|
||||
|
||||
ScrollbarLazyColumn(
|
||||
contentPadding = contentPadding + bottomNavPaddingValues + topPaddingValues,
|
||||
|
@ -42,6 +42,9 @@ import com.ms_square.debugoverlay.modules.FpsModule
|
||||
import eu.kanade.data.DatabaseHandler
|
||||
import eu.kanade.domain.DomainModule
|
||||
import eu.kanade.domain.SYDomainModule
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.domain.ui.model.ThemeMode
|
||||
import eu.kanade.tachiyomi.data.coil.DomainMangaKeyer
|
||||
import eu.kanade.tachiyomi.data.coil.MangaCoverFetcher
|
||||
import eu.kanade.tachiyomi.data.coil.MangaCoverKeyer
|
||||
@ -50,8 +53,6 @@ import eu.kanade.tachiyomi.data.coil.PagePreviewFetcher
|
||||
import eu.kanade.tachiyomi.data.coil.PagePreviewKeyer
|
||||
import eu.kanade.tachiyomi.data.coil.TachiyomiImageDecoder
|
||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.glance.UpdatesGridGlanceWidget
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.network.NetworkPreferences
|
||||
@ -88,7 +89,8 @@ import kotlin.time.Duration.Companion.days
|
||||
|
||||
class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val basePreferences: BasePreferences by injectLazy()
|
||||
private val uiPreferences: UiPreferences by injectLazy()
|
||||
private val networkPreferences: NetworkPreferences by injectLazy()
|
||||
|
||||
private val disableIncognitoReceiver = DisableIncognitoReceiver()
|
||||
@ -128,7 +130,7 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
ProcessLifecycleOwner.get().lifecycle.addObserver(this)
|
||||
|
||||
// Show notification to disable Incognito Mode when it's enabled
|
||||
preferences.incognitoMode().changes()
|
||||
basePreferences.incognitoMode().changes()
|
||||
.onEach { enabled ->
|
||||
val notificationManager = NotificationManagerCompat.from(this)
|
||||
if (enabled) {
|
||||
@ -155,13 +157,13 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
}
|
||||
.launchIn(ProcessLifecycleOwner.get().lifecycleScope)
|
||||
|
||||
preferences.themeMode()
|
||||
uiPreferences.themeMode()
|
||||
.asHotFlow {
|
||||
AppCompatDelegate.setDefaultNightMode(
|
||||
when (it) {
|
||||
PreferenceValues.ThemeMode.light -> AppCompatDelegate.MODE_NIGHT_NO
|
||||
PreferenceValues.ThemeMode.dark -> AppCompatDelegate.MODE_NIGHT_YES
|
||||
PreferenceValues.ThemeMode.system -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
ThemeMode.LIGHT -> AppCompatDelegate.MODE_NIGHT_NO
|
||||
ThemeMode.DARK -> AppCompatDelegate.MODE_NIGHT_YES
|
||||
ThemeMode.SYSTEM -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
|
||||
},
|
||||
)
|
||||
}.launchIn(ProcessLifecycleOwner.get().lifecycleScope)
|
||||
@ -346,7 +348,7 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
private var registered = false
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
preferences.incognitoMode().set(false)
|
||||
basePreferences.incognitoMode().set(false)
|
||||
}
|
||||
|
||||
fun register() {
|
||||
|
@ -16,11 +16,14 @@ import eu.kanade.data.dateAdapter
|
||||
import eu.kanade.data.listOfLongsAdapter
|
||||
import eu.kanade.data.listOfStringsAdapter
|
||||
import eu.kanade.data.listOfStringsAndAdapter
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.backup.service.BackupPreferences
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.download.service.DownloadPreferences
|
||||
import eu.kanade.domain.library.service.LibraryPreferences
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.domain.track.service.TrackPreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.core.preference.AndroidPreferenceStore
|
||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||
import eu.kanade.tachiyomi.core.provider.AndroidBackupFolderProvider
|
||||
@ -31,7 +34,6 @@ import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||
import eu.kanade.tachiyomi.data.cache.PagePreviewCache
|
||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.library.CustomMangaManager
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.saver.ImageSaver
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.data.track.job.DelayedTrackingStore
|
||||
@ -209,10 +211,10 @@ class PreferenceModule(val application: Application) : InjektModule {
|
||||
)
|
||||
}
|
||||
addSingletonFactory {
|
||||
PreferencesHelper(
|
||||
context = application,
|
||||
preferenceStore = get(),
|
||||
)
|
||||
UiPreferences(get())
|
||||
}
|
||||
addSingletonFactory {
|
||||
BasePreferences(application, get())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -226,6 +228,10 @@ class SYPreferenceModule(val application: Application) : InjektModule {
|
||||
preferenceStore = get(),
|
||||
)
|
||||
}
|
||||
|
||||
addSingletonFactory {
|
||||
UnsortedPreferences(get())
|
||||
}
|
||||
}
|
||||
}
|
||||
// SY <--
|
||||
|
@ -5,14 +5,16 @@ import android.os.Build
|
||||
import androidx.core.content.edit
|
||||
import androidx.preference.PreferenceManager
|
||||
import eu.kanade.domain.backup.service.BackupPreferences
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.library.service.LibraryPreferences
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
||||
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
||||
import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.data.updater.AppUpdateJob
|
||||
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
|
||||
@ -41,7 +43,9 @@ object Migrations {
|
||||
*/
|
||||
fun upgrade(
|
||||
context: Context,
|
||||
preferences: PreferencesHelper,
|
||||
preferenceStore: PreferenceStore,
|
||||
basePreferences: BasePreferences,
|
||||
uiPreferences: UiPreferences,
|
||||
networkPreferences: NetworkPreferences,
|
||||
sourcePreferences: SourcePreferences,
|
||||
securityPreferences: SecurityPreferences,
|
||||
@ -49,9 +53,10 @@ object Migrations {
|
||||
readerPreferences: ReaderPreferences,
|
||||
backupPreferences: BackupPreferences,
|
||||
): Boolean {
|
||||
val oldVersion = preferences.lastVersionCode().get()
|
||||
val lastVersionCode = preferenceStore.getInt("last_version_code", 0)
|
||||
val oldVersion = lastVersionCode.get()
|
||||
if (oldVersion < BuildConfig.VERSION_CODE) {
|
||||
preferences.lastVersionCode().set(BuildConfig.VERSION_CODE)
|
||||
lastVersionCode.set(BuildConfig.VERSION_CODE)
|
||||
|
||||
// Always set up background tasks to ensure they're running
|
||||
if (BuildConfig.INCLUDE_UPDATER) {
|
||||
@ -266,8 +271,8 @@ object Migrations {
|
||||
if (oldSecureScreen) {
|
||||
securityPreferences.secureScreen().set(SecurityPreferences.SecureScreenMode.ALWAYS)
|
||||
}
|
||||
if (DeviceUtil.isMiui && preferences.extensionInstaller().get() == PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER) {
|
||||
preferences.extensionInstaller().set(PreferenceValues.ExtensionInstaller.LEGACY)
|
||||
if (DeviceUtil.isMiui && basePreferences.extensionInstaller().get() == PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER) {
|
||||
basePreferences.extensionInstaller().set(PreferenceValues.ExtensionInstaller.LEGACY)
|
||||
}
|
||||
}
|
||||
if (oldVersion < 76) {
|
||||
@ -329,6 +334,14 @@ object Migrations {
|
||||
}
|
||||
}
|
||||
}
|
||||
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())
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ import android.os.IBinder
|
||||
import android.os.PowerManager
|
||||
import androidx.core.content.ContextCompat
|
||||
import eu.kanade.data.chapter.NoChaptersException
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.category.interactor.GetCategories
|
||||
import eu.kanade.domain.category.model.Category
|
||||
import eu.kanade.domain.chapter.interactor.GetChapterByMangaId
|
||||
@ -44,7 +45,6 @@ import eu.kanade.tachiyomi.data.notification.Notifications
|
||||
import eu.kanade.tachiyomi.data.preference.MANGA_HAS_UNREAD
|
||||
import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED
|
||||
import eu.kanade.tachiyomi.data.preference.MANGA_NON_READ
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.EnhancedTrackService
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.data.track.TrackService
|
||||
@ -702,7 +702,7 @@ class LibraryUpdateService(
|
||||
* filter all follows from Mangadex and only add reading or rereading manga to library
|
||||
*/
|
||||
private suspend fun syncFollows() {
|
||||
val preferences = Injekt.get<PreferencesHelper>()
|
||||
val preferences = Injekt.get<UnsortedPreferences>()
|
||||
var count = 0
|
||||
val mangaDex = MdUtil.getEnabledMangaDex(preferences, sourceManager = sourceManager) ?: return
|
||||
val syncFollowStatusInts = preferences.mangadexSyncToLibraryIndexes().get().map { it.toInt() }
|
||||
|
@ -1,9 +0,0 @@
|
||||
package eu.kanade.tachiyomi.data.preference
|
||||
|
||||
/**
|
||||
* This class stores the keys for the preferences in the application.
|
||||
*/
|
||||
object PreferenceKeys {
|
||||
|
||||
const val dateFormat = "app_date_format"
|
||||
}
|
@ -16,42 +16,6 @@ const val MANGA_NON_READ = "manga_started"
|
||||
*/
|
||||
object PreferenceValues {
|
||||
|
||||
/* ktlint-disable experimental:enum-entry-name-case */
|
||||
|
||||
// Keys are lowercase to match legacy string values
|
||||
/* ktlint-disable enum-entry-name-case */
|
||||
enum class ThemeMode {
|
||||
light,
|
||||
dark,
|
||||
system,
|
||||
}
|
||||
/* ktlint-enable enum-entry-name-case */
|
||||
|
||||
/* ktlint-enable experimental:enum-entry-name-case */
|
||||
|
||||
enum class AppTheme(val titleResId: Int?) {
|
||||
DEFAULT(R.string.label_default),
|
||||
MONET(R.string.theme_monet),
|
||||
GREEN_APPLE(R.string.theme_greenapple),
|
||||
LAVENDER(R.string.theme_lavender),
|
||||
MIDNIGHT_DUSK(R.string.theme_midnightdusk),
|
||||
STRAWBERRY_DAIQUIRI(R.string.theme_strawberrydaiquiri),
|
||||
TAKO(R.string.theme_tako),
|
||||
TEALTURQUOISE(R.string.theme_tealturquoise),
|
||||
TIDAL_WAVE(R.string.theme_tidalwave),
|
||||
YINYANG(R.string.theme_yinyang),
|
||||
YOTSUBA(R.string.theme_yotsuba),
|
||||
|
||||
// Deprecated
|
||||
DARK_BLUE(null),
|
||||
HOT_PINK(null),
|
||||
BLUE(null),
|
||||
|
||||
// SY -->
|
||||
PURE_RED(null),
|
||||
// SY <--
|
||||
}
|
||||
|
||||
enum class TappingInvertMode(val shouldInvertHorizontal: Boolean = false, val shouldInvertVertical: Boolean = false) {
|
||||
NONE,
|
||||
HORIZONTAL(shouldInvertHorizontal = true),
|
||||
@ -66,13 +30,6 @@ object PreferenceValues {
|
||||
LOWEST(47),
|
||||
}
|
||||
|
||||
enum class TabletUiMode(val titleResId: Int) {
|
||||
AUTOMATIC(R.string.automatic_background),
|
||||
ALWAYS(R.string.lock_always),
|
||||
LANDSCAPE(R.string.landscape),
|
||||
NEVER(R.string.lock_never),
|
||||
}
|
||||
|
||||
enum class ExtensionInstaller(val titleResId: Int) {
|
||||
LEGACY(R.string.ext_installer_legacy),
|
||||
PACKAGEINSTALLER(R.string.ext_installer_packageinstaller),
|
||||
|
@ -4,9 +4,9 @@ import androidx.annotation.CallSuper
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.StringRes
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.track.service.TrackPreferences
|
||||
import eu.kanade.tachiyomi.data.database.models.Track
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import okhttp3.OkHttpClient
|
||||
@ -14,7 +14,7 @@ import uy.kohesive.injekt.injectLazy
|
||||
|
||||
abstract class TrackService(val id: Long) {
|
||||
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
val preferences: BasePreferences by injectLazy()
|
||||
val trackPreferences: TrackPreferences by injectLazy()
|
||||
val networkService: NetworkHelper by injectLazy()
|
||||
|
||||
|
@ -2,7 +2,8 @@ package eu.kanade.tachiyomi.data.updater
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.core.preference.Preference
|
||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.network.await
|
||||
@ -17,11 +18,14 @@ import java.util.concurrent.TimeUnit
|
||||
class AppUpdateChecker {
|
||||
|
||||
private val networkService: NetworkHelper by injectLazy()
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferenceStore: PreferenceStore by injectLazy()
|
||||
private val lastAppCheck: Preference<Long> by lazy {
|
||||
preferenceStore.getLong("last_app_check", 0)
|
||||
}
|
||||
|
||||
suspend fun checkForUpdate(context: Context, isUserPrompt: Boolean = false): AppUpdateResult {
|
||||
// Limit checks to once a day at most
|
||||
if (isUserPrompt.not() && Date().time < preferences.lastAppCheck().get() + TimeUnit.DAYS.toMillis(1)) {
|
||||
if (isUserPrompt.not() && Date().time < lastAppCheck.get() + TimeUnit.DAYS.toMillis(1)) {
|
||||
return AppUpdateResult.NoNewUpdate
|
||||
}
|
||||
|
||||
@ -31,7 +35,7 @@ class AppUpdateChecker {
|
||||
.await()
|
||||
.parseAs<GithubRelease>()
|
||||
.let {
|
||||
preferences.lastAppCheck().set(Date().time)
|
||||
lastAppCheck.set(Date().time)
|
||||
|
||||
// Check if latest version is different from current version
|
||||
if (/* SY --> */ isNewVersionSY(it.version) /* SY <-- */) {
|
||||
|
@ -10,10 +10,10 @@ import androidx.work.NetworkType
|
||||
import androidx.work.PeriodicWorkRequestBuilder
|
||||
import androidx.work.WorkManager
|
||||
import androidx.work.WorkerParameters
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
||||
import eu.kanade.tachiyomi.data.notification.Notifications
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi
|
||||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import eu.kanade.tachiyomi.util.system.notification
|
||||
@ -68,7 +68,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
|
||||
private const val TAG = "ExtensionUpdate"
|
||||
|
||||
fun setupTask(context: Context, forceAutoUpdateJob: Boolean? = null) {
|
||||
val preferences = Injekt.get<PreferencesHelper>()
|
||||
val preferences = Injekt.get<BasePreferences>()
|
||||
val autoUpdateJob = forceAutoUpdateJob ?: preferences.automaticExtUpdates().get()
|
||||
if (autoUpdateJob) {
|
||||
val constraints = Constraints.Builder()
|
||||
|
@ -1,8 +1,10 @@
|
||||
package eu.kanade.tachiyomi.extension.api
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.core.preference.Preference
|
||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||
import eu.kanade.tachiyomi.extension.ExtensionManager
|
||||
import eu.kanade.tachiyomi.extension.model.AvailableSources
|
||||
import eu.kanade.tachiyomi.extension.model.Extension
|
||||
@ -24,11 +26,15 @@ import java.util.concurrent.TimeUnit
|
||||
internal class ExtensionGithubApi {
|
||||
|
||||
private val networkService: NetworkHelper by injectLazy()
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferenceStore: PreferenceStore by injectLazy()
|
||||
private val lastExtCheck: Preference<Long> by lazy {
|
||||
preferenceStore.getLong("last_ext_check", 0)
|
||||
}
|
||||
private val extensionManager: ExtensionManager by injectLazy()
|
||||
|
||||
// SY -->
|
||||
private val sourcePreferences: SourcePreferences by injectLazy()
|
||||
private val unsortedPreferences: UnsortedPreferences by injectLazy()
|
||||
// SY <--
|
||||
|
||||
private var requiresFallbackSource = false
|
||||
@ -57,7 +63,7 @@ internal class ExtensionGithubApi {
|
||||
|
||||
val extensions = response
|
||||
.parseAs<List<ExtensionJsonObject>>()
|
||||
.toExtensions() /* SY --> */ + preferences.extensionRepos()
|
||||
.toExtensions() /* SY --> */ + unsortedPreferences.extensionRepos()
|
||||
.get()
|
||||
.flatMap { repoPath ->
|
||||
val url = if (requiresFallbackSource) {
|
||||
@ -85,14 +91,14 @@ internal class ExtensionGithubApi {
|
||||
|
||||
suspend fun checkForUpdates(context: Context, fromAvailableExtensionList: Boolean = false): List<Extension.Installed>? {
|
||||
// Limit checks to once a day at most
|
||||
if (fromAvailableExtensionList.not() && Date().time < preferences.lastExtCheck().get() + TimeUnit.DAYS.toMillis(1)) {
|
||||
if (fromAvailableExtensionList.not() && Date().time < lastExtCheck.get() + TimeUnit.DAYS.toMillis(1)) {
|
||||
return null
|
||||
}
|
||||
|
||||
val extensions = if (fromAvailableExtensionList) {
|
||||
extensionManager.availableExtensions
|
||||
} else {
|
||||
findExtensions().also { preferences.lastExtCheck().set(Date().time) }
|
||||
findExtensions().also { lastExtCheck.set(Date().time) }
|
||||
}
|
||||
|
||||
// SY -->
|
||||
|
@ -11,8 +11,8 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.getSystemService
|
||||
import androidx.core.net.toUri
|
||||
import com.jakewharton.rxrelay.PublishRelay
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.extension.installer.Installer
|
||||
import eu.kanade.tachiyomi.extension.model.Extension
|
||||
import eu.kanade.tachiyomi.extension.model.InstallStep
|
||||
@ -54,7 +54,7 @@ internal class ExtensionInstaller(private val context: Context) {
|
||||
*/
|
||||
private val downloadsRelay = PublishRelay.create<Pair<Long, InstallStep>>()
|
||||
|
||||
private val installerPref = Injekt.get<PreferencesHelper>().extensionInstaller()
|
||||
private val extensionInstaller = Injekt.get<BasePreferences>().extensionInstaller()
|
||||
|
||||
/**
|
||||
* Adds the given extension to the downloads queue and returns an observable containing its
|
||||
@ -133,7 +133,7 @@ internal class ExtensionInstaller(private val context: Context) {
|
||||
* @param uri The uri of the extension to install.
|
||||
*/
|
||||
fun installApk(downloadId: Long, uri: Uri) {
|
||||
when (val installer = installerPref.get()) {
|
||||
when (val installer = extensionInstaller.get()) {
|
||||
PreferenceValues.ExtensionInstaller.LEGACY -> {
|
||||
val intent = Intent(context, ExtensionInstallActivity::class.java)
|
||||
.setDataAndType(uri, APK_MIME)
|
||||
|
@ -3,9 +3,9 @@ package eu.kanade.tachiyomi.source
|
||||
import android.content.Context
|
||||
import com.github.junrar.Archive
|
||||
import com.hippo.unifile.UniFile
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.manga.model.ComicInfo
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.model.Filter
|
||||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||
@ -43,7 +43,7 @@ class LocalSource(
|
||||
private val xml: XML by injectLazy()
|
||||
|
||||
// SY -->
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferences: UnsortedPreferences by injectLazy()
|
||||
// SY <--
|
||||
|
||||
override val name: String = context.getString(R.string.local_source)
|
||||
|
@ -1,11 +1,11 @@
|
||||
package eu.kanade.tachiyomi.source
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.source.model.SourceData
|
||||
import eu.kanade.domain.source.repository.SourceDataRepository
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.extension.ExtensionManager
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
@ -72,7 +72,7 @@ class SourceManager(
|
||||
val onlineSources: Flow<List<HttpSource>> = catalogueSources.map { sources -> sources.filterIsInstance<HttpSource>() }
|
||||
|
||||
// SY -->
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferences: UnsortedPreferences by injectLazy()
|
||||
// SY <--
|
||||
|
||||
init {
|
||||
|
@ -5,9 +5,9 @@ import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.net.Uri
|
||||
import androidx.core.net.toUri
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.database.models.MangaImpl
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||
import eu.kanade.tachiyomi.network.await
|
||||
@ -117,7 +117,7 @@ class EHentai(
|
||||
override val lang = "all"
|
||||
override val supportsLatest = true
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferences: UnsortedPreferences by injectLazy()
|
||||
private val updateHelper: EHentaiUpdateHelper by injectLazy()
|
||||
|
||||
/**
|
||||
|
@ -3,7 +3,7 @@ package eu.kanade.tachiyomi.ui.base.activity
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegate
|
||||
import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegateImpl
|
||||
import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate
|
||||
@ -16,7 +16,7 @@ open class BaseActivity :
|
||||
SecureActivityDelegate by SecureActivityDelegateImpl(),
|
||||
ThemingDelegate by ThemingDelegateImpl() {
|
||||
|
||||
protected val preferences: PreferencesHelper by injectLazy()
|
||||
protected val preferences: BasePreferences by injectLazy()
|
||||
|
||||
override fun attachBaseContext(newBase: Context) {
|
||||
super.attachBaseContext(newBase.prepareTabletUiContext())
|
||||
|
@ -2,7 +2,7 @@ package eu.kanade.tachiyomi.ui.base.activity
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegate
|
||||
import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegateImpl
|
||||
import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate
|
||||
@ -17,7 +17,7 @@ open class BaseRxActivity<P : BasePresenter<*>> :
|
||||
SecureActivityDelegate by SecureActivityDelegateImpl(),
|
||||
ThemingDelegate by ThemingDelegateImpl() {
|
||||
|
||||
protected val preferences: PreferencesHelper by injectLazy()
|
||||
protected val preferences: BasePreferences by injectLazy()
|
||||
|
||||
override fun attachBaseContext(newBase: Context) {
|
||||
super.attachBaseContext(newBase.prepareTabletUiContext())
|
||||
|
@ -5,8 +5,8 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.DefaultLifecycleObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegate.Companion.LOCK_ALL_DAYS
|
||||
import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegate.Companion.LOCK_FRIDAY
|
||||
import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegate.Companion.LOCK_MONDAY
|
||||
@ -93,7 +93,7 @@ class SecureActivityDelegateImpl : SecureActivityDelegate, DefaultLifecycleObser
|
||||
|
||||
private lateinit var activity: AppCompatActivity
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferences: BasePreferences by injectLazy()
|
||||
private val securityPreferences: SecurityPreferences by injectLazy()
|
||||
|
||||
override fun registerSecureActivity(activity: AppCompatActivity) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package eu.kanade.tachiyomi.ui.base.delegate
|
||||
|
||||
import android.app.Activity
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.domain.ui.model.AppTheme
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
@ -11,37 +11,37 @@ interface ThemingDelegate {
|
||||
fun applyAppTheme(activity: Activity)
|
||||
|
||||
companion object {
|
||||
fun getThemeResIds(appTheme: PreferenceValues.AppTheme, isAmoled: Boolean): List<Int> {
|
||||
fun getThemeResIds(appTheme: AppTheme, isAmoled: Boolean): List<Int> {
|
||||
val resIds = mutableListOf<Int>()
|
||||
when (appTheme) {
|
||||
PreferenceValues.AppTheme.MONET -> {
|
||||
AppTheme.MONET -> {
|
||||
resIds += R.style.Theme_Tachiyomi_Monet
|
||||
}
|
||||
PreferenceValues.AppTheme.GREEN_APPLE -> {
|
||||
AppTheme.GREEN_APPLE -> {
|
||||
resIds += R.style.Theme_Tachiyomi_GreenApple
|
||||
}
|
||||
PreferenceValues.AppTheme.LAVENDER -> {
|
||||
AppTheme.LAVENDER -> {
|
||||
resIds += R.style.Theme_Tachiyomi_Lavender
|
||||
}
|
||||
PreferenceValues.AppTheme.MIDNIGHT_DUSK -> {
|
||||
AppTheme.MIDNIGHT_DUSK -> {
|
||||
resIds += R.style.Theme_Tachiyomi_MidnightDusk
|
||||
}
|
||||
PreferenceValues.AppTheme.STRAWBERRY_DAIQUIRI -> {
|
||||
AppTheme.STRAWBERRY_DAIQUIRI -> {
|
||||
resIds += R.style.Theme_Tachiyomi_StrawberryDaiquiri
|
||||
}
|
||||
PreferenceValues.AppTheme.TAKO -> {
|
||||
AppTheme.TAKO -> {
|
||||
resIds += R.style.Theme_Tachiyomi_Tako
|
||||
}
|
||||
PreferenceValues.AppTheme.TEALTURQUOISE -> {
|
||||
AppTheme.TEALTURQUOISE -> {
|
||||
resIds += R.style.Theme_Tachiyomi_TealTurquoise
|
||||
}
|
||||
PreferenceValues.AppTheme.YINYANG -> {
|
||||
AppTheme.YINYANG -> {
|
||||
resIds += R.style.Theme_Tachiyomi_YinYang
|
||||
}
|
||||
PreferenceValues.AppTheme.YOTSUBA -> {
|
||||
AppTheme.YOTSUBA -> {
|
||||
resIds += R.style.Theme_Tachiyomi_Yotsuba
|
||||
}
|
||||
PreferenceValues.AppTheme.TIDAL_WAVE -> {
|
||||
AppTheme.TIDAL_WAVE -> {
|
||||
resIds += R.style.Theme_Tachiyomi_TidalWave
|
||||
}
|
||||
else -> {
|
||||
@ -60,8 +60,8 @@ interface ThemingDelegate {
|
||||
|
||||
class ThemingDelegateImpl : ThemingDelegate {
|
||||
override fun applyAppTheme(activity: Activity) {
|
||||
val preferences = Injekt.get<PreferencesHelper>()
|
||||
ThemingDelegate.getThemeResIds(preferences.appTheme().get(), preferences.themeDarkAmoled().get())
|
||||
val uiPreferences = Injekt.get<UiPreferences>()
|
||||
ThemingDelegate.getThemeResIds(uiPreferences.appTheme().get(), uiPreferences.themeDarkAmoled().get())
|
||||
.forEach { activity.setTheme(it) }
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,8 @@ package eu.kanade.tachiyomi.ui.browse
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.compose.runtime.getValue
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionsPresenter
|
||||
import eu.kanade.tachiyomi.ui.browse.feed.FeedPresenter
|
||||
@ -13,14 +14,17 @@ import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
class BrowsePresenter(
|
||||
preferences: PreferencesHelper = Injekt.get(),
|
||||
preferences: BasePreferences = Injekt.get(),
|
||||
// SY -->
|
||||
uiPreferences: UiPreferences = Injekt.get(),
|
||||
// SY <--
|
||||
) : BasePresenter<BrowseController>() {
|
||||
|
||||
val isDownloadOnly: Boolean by preferences.downloadedOnly().asState()
|
||||
val isIncognitoMode: Boolean by preferences.incognitoMode().asState()
|
||||
|
||||
// SY -->
|
||||
val feedTabInFront = preferences.feedTabInFront().get()
|
||||
val feedTabInFront = uiPreferences.feedTabInFront().get()
|
||||
// SY <--
|
||||
|
||||
// SY -->
|
||||
|
@ -20,7 +20,6 @@ import eu.kanade.presentation.browse.FeedState
|
||||
import eu.kanade.presentation.browse.FeedStateImpl
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainManga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
@ -55,16 +54,11 @@ import eu.kanade.domain.manga.model.Manga as DomainManga
|
||||
|
||||
/**
|
||||
* Presenter of [feedTab]
|
||||
* Function calls should be done from here. UI calls should be done from the controller.
|
||||
*
|
||||
* @param sourceManager manages the different sources.
|
||||
* @param preferences manages the preference calls.
|
||||
*/
|
||||
open class FeedPresenter(
|
||||
private val presenterScope: CoroutineScope,
|
||||
private val state: FeedStateImpl = FeedState() as FeedStateImpl,
|
||||
val sourceManager: SourceManager = Injekt.get(),
|
||||
val preferences: PreferencesHelper = Injekt.get(),
|
||||
val sourcePreferences: SourcePreferences = Injekt.get(),
|
||||
private val getManga: GetManga = Injekt.get(),
|
||||
private val insertManga: InsertManga = Injekt.get(),
|
||||
|
@ -11,9 +11,9 @@ import android.widget.RadioGroup
|
||||
import android.widget.Toast
|
||||
import androidx.core.view.isVisible
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.core.preference.Preference
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.MigrationBottomSheetBinding
|
||||
import eu.kanade.tachiyomi.ui.browse.migration.MigrationFlags
|
||||
import eu.kanade.tachiyomi.util.system.toInt
|
||||
@ -22,7 +22,7 @@ import eu.kanade.tachiyomi.widget.sheet.BaseBottomSheetDialog
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class MigrationBottomSheetDialog(private val activity: Activity, private val listener: StartMigrationListener) : BaseBottomSheetDialog(activity) {
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferences: UnsortedPreferences by injectLazy()
|
||||
|
||||
lateinit var binding: MigrationBottomSheetBinding
|
||||
|
||||
|
@ -3,7 +3,6 @@ package eu.kanade.tachiyomi.ui.browse.migration.advanced.design
|
||||
import android.os.Bundle
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
@ -14,7 +13,6 @@ class MigrationSourceAdapter(
|
||||
controllerPre,
|
||||
true,
|
||||
) {
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
val sourceManager: SourceManager by injectLazy()
|
||||
|
||||
// SY _->
|
||||
|
@ -39,13 +39,13 @@ import androidx.core.view.updatePadding
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.bluelinelabs.conductor.Router
|
||||
import eu.davidea.flexibleadapter.FlexibleAdapter
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.presentation.components.AppBar
|
||||
import eu.kanade.presentation.components.DropdownMenu
|
||||
import eu.kanade.presentation.components.ExtendedFloatingActionButton
|
||||
import eu.kanade.presentation.components.Scaffold
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.PreMigrationListBinding
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
@ -69,7 +69,7 @@ class PreMigrationController(bundle: Bundle? = null) :
|
||||
)
|
||||
|
||||
private val sourceManager: SourceManager by injectLazy()
|
||||
private val prefs: PreferencesHelper by injectLazy()
|
||||
private val prefs: UnsortedPreferences by injectLazy()
|
||||
private val sourcePreferences: SourcePreferences by injectLazy()
|
||||
|
||||
private var adapter: MigrationSourceAdapter? = null
|
||||
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.browse.migration.advanced.process
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.category.interactor.GetCategories
|
||||
import eu.kanade.domain.category.interactor.SetMangaCategories
|
||||
import eu.kanade.domain.chapter.interactor.GetChapterByMangaId
|
||||
@ -26,7 +27,6 @@ import eu.kanade.domain.track.interactor.InsertTrack
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainManga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
@ -60,7 +60,7 @@ import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
class MigrationListPresenter(
|
||||
private val config: MigrationProcedureConfig,
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val preferences: UnsortedPreferences = Injekt.get(),
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get(),
|
||||
private val getManga: GetManga = Injekt.get(),
|
||||
|
@ -3,8 +3,8 @@ package eu.kanade.tachiyomi.ui.browse.migration.manga
|
||||
import android.os.Bundle
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.core.os.bundleOf
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.presentation.browse.MigrateMangaScreen
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.base.controller.FullComposeController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.pushController
|
||||
import eu.kanade.tachiyomi.ui.browse.migration.advanced.design.PreMigrationController
|
||||
@ -40,7 +40,7 @@ class MigrationMangaController : FullComposeController<MigrateMangaPresenter> {
|
||||
presenter = presenter,
|
||||
onClickItem = {
|
||||
PreMigrationController.navigateToMigration(
|
||||
Injekt.get<PreferencesHelper>().skipPreMigration().get(),
|
||||
Injekt.get<UnsortedPreferences>().skipPreMigration().get(),
|
||||
router,
|
||||
listOf(it.id),
|
||||
)
|
||||
|
@ -6,12 +6,12 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.bluelinelabs.conductor.Router
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.manga.interactor.GetFavorites
|
||||
import eu.kanade.presentation.browse.MigrateSourceScreen
|
||||
import eu.kanade.presentation.components.AppBar
|
||||
import eu.kanade.presentation.components.TabContent
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.base.controller.pushController
|
||||
import eu.kanade.tachiyomi.ui.browse.migration.advanced.design.PreMigrationController
|
||||
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrationMangaController
|
||||
@ -59,7 +59,7 @@ fun migrateSourcesTab(
|
||||
withUIContext {
|
||||
if (router != null) {
|
||||
PreMigrationController.navigateToMigration(
|
||||
Injekt.get<PreferencesHelper>().skipPreMigration().get(),
|
||||
Injekt.get<UnsortedPreferences>().skipPreMigration().get(),
|
||||
router,
|
||||
sourceMangas,
|
||||
)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package eu.kanade.tachiyomi.ui.browse.source
|
||||
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.source.interactor.GetEnabledSources
|
||||
import eu.kanade.domain.source.interactor.GetShowLatest
|
||||
import eu.kanade.domain.source.interactor.GetSourceCategories
|
||||
@ -10,10 +11,10 @@ import eu.kanade.domain.source.interactor.ToggleSourcePin
|
||||
import eu.kanade.domain.source.model.Pin
|
||||
import eu.kanade.domain.source.model.Source
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.presentation.browse.SourceUiModel
|
||||
import eu.kanade.presentation.browse.SourcesState
|
||||
import eu.kanade.presentation.browse.SourcesStateImpl
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@ -32,12 +33,13 @@ import java.util.TreeMap
|
||||
class SourcesPresenter(
|
||||
private val presenterScope: CoroutineScope,
|
||||
private val state: SourcesStateImpl = SourcesState() as SourcesStateImpl,
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val preferences: BasePreferences = Injekt.get(),
|
||||
private val sourcePreferences: SourcePreferences = Injekt.get(),
|
||||
private val getEnabledSources: GetEnabledSources = Injekt.get(),
|
||||
private val toggleSource: ToggleSource = Injekt.get(),
|
||||
private val toggleSourcePin: ToggleSourcePin = Injekt.get(),
|
||||
// SY -->
|
||||
private val uiPreferences: UiPreferences = Injekt.get(),
|
||||
private val getSourceCategories: GetSourceCategories = Injekt.get(),
|
||||
private val getShowLatest: GetShowLatest = Injekt.get(),
|
||||
private val toggleExcludeFromDataSaver: ToggleExcludeFromDataSaver = Injekt.get(),
|
||||
@ -50,7 +52,7 @@ class SourcesPresenter(
|
||||
private val _events = Channel<Event>(Int.MAX_VALUE)
|
||||
val events = _events.receiveAsFlow()
|
||||
|
||||
val useNewSourceNavigation = preferences.useNewSourceNavigation().get()
|
||||
val useNewSourceNavigation = uiPreferences.useNewSourceNavigation().get()
|
||||
|
||||
fun onCreate() {
|
||||
// SY -->
|
||||
|
@ -19,6 +19,8 @@ import androidx.paging.map
|
||||
import eu.davidea.flexibleadapter.items.IFlexible
|
||||
import eu.kanade.core.prefs.CheckboxState
|
||||
import eu.kanade.core.prefs.mapAsCheckboxState
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.category.interactor.GetCategories
|
||||
import eu.kanade.domain.category.interactor.SetMangaCategories
|
||||
import eu.kanade.domain.chapter.interactor.GetChapterByMangaId
|
||||
@ -45,7 +47,6 @@ import eu.kanade.presentation.browse.BrowseSourceStateImpl
|
||||
import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainManga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.EnhancedTrackService
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.data.track.TrackService
|
||||
@ -112,8 +113,8 @@ open class BrowseSourcePresenter(
|
||||
// SY <--
|
||||
private val state: BrowseSourceStateImpl = BrowseSourceState(searchQuery) as BrowseSourceStateImpl,
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val sourcePreferences: SourcePreferences = Injekt.get(),
|
||||
preferences: BasePreferences = Injekt.get(),
|
||||
sourcePreferences: SourcePreferences = Injekt.get(),
|
||||
private val libraryPreferences: LibraryPreferences = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get(),
|
||||
private val getRemoteManga: GetRemoteManga = Injekt.get(),
|
||||
@ -129,6 +130,7 @@ open class BrowseSourcePresenter(
|
||||
private val syncChaptersWithTrackServiceTwoWay: SyncChaptersWithTrackServiceTwoWay = Injekt.get(),
|
||||
|
||||
// SY -->
|
||||
unsortedPreferences: UnsortedPreferences = Injekt.get(),
|
||||
private val getFlatMetadataById: GetFlatMetadataById = Injekt.get(),
|
||||
private val deleteSavedSearchById: DeleteSavedSearchById = Injekt.get(),
|
||||
private val insertSavedSearch: InsertSavedSearch = Injekt.get(),
|
||||
@ -144,7 +146,7 @@ open class BrowseSourcePresenter(
|
||||
val isIncognitoMode: Boolean by preferences.incognitoMode().asState()
|
||||
|
||||
// SY -->
|
||||
val ehentaiBrowseDisplayMode by preferences.enhancedEHentaiView().asState()
|
||||
val ehentaiBrowseDisplayMode by unsortedPreferences.enhancedEHentaiView().asState()
|
||||
// SY <--
|
||||
|
||||
@Composable
|
||||
|
@ -5,6 +5,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.produceState
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.manga.interactor.GetManga
|
||||
import eu.kanade.domain.manga.interactor.InsertManga
|
||||
import eu.kanade.domain.manga.interactor.UpdateManga
|
||||
@ -21,7 +22,6 @@ import eu.kanade.presentation.browse.SourceFeedStateImpl
|
||||
import eu.kanade.presentation.browse.SourceFeedUI
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainManga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.model.FilterList
|
||||
import eu.kanade.tachiyomi.source.model.MangasPage
|
||||
@ -59,7 +59,7 @@ import eu.kanade.domain.manga.model.Manga as DomainManga
|
||||
open class SourceFeedPresenter(
|
||||
private val state: SourceFeedStateImpl = SourceFeedState() as SourceFeedStateImpl,
|
||||
val source: CatalogueSource,
|
||||
val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val preferences: BasePreferences = Injekt.get(),
|
||||
private val getManga: GetManga = Injekt.get(),
|
||||
private val insertManga: InsertManga = Injekt.get(),
|
||||
private val updateManga: UpdateManga = Injekt.get(),
|
||||
|
@ -9,8 +9,8 @@ import eu.davidea.flexibleadapter.items.AbstractExpandableHeaderItem
|
||||
import eu.davidea.flexibleadapter.items.IFlexible
|
||||
import eu.davidea.flexibleadapter.items.ISectionable
|
||||
import eu.davidea.viewholders.ExpandableViewHolder
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.model.Filter
|
||||
import eu.kanade.tachiyomi.util.view.setVectorCompat
|
||||
import uy.kohesive.injekt.Injekt
|
||||
@ -20,7 +20,7 @@ class GroupItem(val filter: Filter.Group<*>) : AbstractExpandableHeaderItem<Grou
|
||||
|
||||
init {
|
||||
// --> EH
|
||||
isExpanded = Injekt.get<PreferencesHelper>().expandFilters().get()
|
||||
isExpanded = Injekt.get<UiPreferences>().expandFilters().get()
|
||||
// <-- EH
|
||||
}
|
||||
|
||||
|
@ -10,10 +10,10 @@ import androidx.appcompat.widget.SearchView
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import dev.chrisbanes.insetter.applyInsetter
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.manga.model.Manga
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.GlobalSearchControllerBinding
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.ui.base.controller.SearchableNucleusController
|
||||
@ -35,7 +35,7 @@ open class GlobalSearchController(
|
||||
GlobalSearchCardAdapter.OnMangaClickListener,
|
||||
GlobalSearchAdapter.OnTitleClickListener {
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferences: BasePreferences by injectLazy()
|
||||
private val sourcePreferences: SourcePreferences by injectLazy()
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
package eu.kanade.tachiyomi.ui.browse.source.globalsearch
|
||||
|
||||
import android.os.Bundle
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.manga.interactor.GetManga
|
||||
import eu.kanade.domain.manga.interactor.InsertManga
|
||||
import eu.kanade.domain.manga.interactor.UpdateManga
|
||||
@ -9,7 +10,6 @@ import eu.kanade.domain.manga.model.toMangaUpdate
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainManga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.extension.ExtensionManager
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
@ -36,7 +36,7 @@ open class GlobalSearchPresenter(
|
||||
private val initialExtensionFilter: String? = null,
|
||||
private val sourcesToUse: List<CatalogueSource>? = null,
|
||||
val sourceManager: SourceManager = Injekt.get(),
|
||||
val preferences: PreferencesHelper = Injekt.get(),
|
||||
val preferences: BasePreferences = Injekt.get(),
|
||||
val sourcePreferences: SourcePreferences = Injekt.get(),
|
||||
private val getManga: GetManga = Injekt.get(),
|
||||
private val insertManga: InsertManga = Injekt.get(),
|
||||
|
@ -12,6 +12,7 @@ import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
import com.bluelinelabs.conductor.ControllerChangeType
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.core.prefs.CheckboxState
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.library.model.LibraryGroup
|
||||
import eu.kanade.domain.manga.model.Manga
|
||||
import eu.kanade.domain.manga.model.isLocal
|
||||
@ -22,7 +23,6 @@ import eu.kanade.presentation.library.LibraryScreen
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainManga
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateService
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.base.controller.FullComposeController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.RootController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.pushController
|
||||
@ -120,7 +120,7 @@ class LibraryController(
|
||||
presenter.clearSelection()
|
||||
if (selectedMangaIds.isNotEmpty()) {
|
||||
PreMigrationController.navigateToMigration(
|
||||
Injekt.get<PreferencesHelper>().skipPreMigration().get(),
|
||||
Injekt.get<UnsortedPreferences>().skipPreMigration().get(),
|
||||
router,
|
||||
selectedMangaIds,
|
||||
)
|
||||
@ -134,7 +134,7 @@ class LibraryController(
|
||||
},
|
||||
onClickSyncExh = {
|
||||
// TODO
|
||||
if (Injekt.get<PreferencesHelper>().exhShowSyncIntro().get()) {
|
||||
if (Injekt.get<UnsortedPreferences>().exhShowSyncIntro().get()) {
|
||||
activity?.let { FavoritesIntroDialog().show(it) }
|
||||
} else {
|
||||
MaterialAlertDialogBuilder(activity!!)
|
||||
|
@ -18,6 +18,8 @@ import eu.kanade.core.prefs.PreferenceMutableState
|
||||
import eu.kanade.core.util.asFlow
|
||||
import eu.kanade.core.util.asObservable
|
||||
import eu.kanade.data.DatabaseHandler
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.category.interactor.GetCategories
|
||||
import eu.kanade.domain.category.interactor.SetMangaCategories
|
||||
import eu.kanade.domain.category.model.Category
|
||||
@ -54,7 +56,6 @@ import eu.kanade.tachiyomi.data.database.models.LibraryManga
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainManga
|
||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.library.CustomMangaManager
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.data.track.TrackStatus
|
||||
import eu.kanade.tachiyomi.source.LocalSource
|
||||
@ -131,13 +132,14 @@ class LibraryPresenter(
|
||||
private val setReadStatus: SetReadStatus = Injekt.get(),
|
||||
private val updateManga: UpdateManga = Injekt.get(),
|
||||
private val setMangaCategories: SetMangaCategories = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val preferences: BasePreferences = Injekt.get(),
|
||||
private val libraryPreferences: LibraryPreferences = Injekt.get(),
|
||||
private val coverCache: CoverCache = Injekt.get(),
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
private val trackManager: TrackManager = Injekt.get(),
|
||||
// SY -->
|
||||
private val unsortedPreferences: UnsortedPreferences = Injekt.get(),
|
||||
private val sourcePreferences: SourcePreferences = Injekt.get(),
|
||||
private val searchEngine: SearchEngine = SearchEngine(),
|
||||
private val customMangaManager: CustomMangaManager = Injekt.get(),
|
||||
@ -205,9 +207,9 @@ class LibraryPresenter(
|
||||
|
||||
// SY -->
|
||||
combine(
|
||||
preferences.isHentaiEnabled().changes(),
|
||||
unsortedPreferences.isHentaiEnabled().changes(),
|
||||
sourcePreferences.disabledSources().changes(),
|
||||
preferences.enableExhentai().changes(),
|
||||
unsortedPreferences.enableExhentai().changes(),
|
||||
) { isHentaiEnabled, disabledSources, enableExhentai ->
|
||||
state.showSyncExh = isHentaiEnabled && (EH_SOURCE_ID.toString() !in disabledSources || enableExhentai)
|
||||
}.flowOn(Dispatchers.IO).launchIn(presenterScope)
|
||||
@ -806,7 +808,7 @@ class LibraryPresenter(
|
||||
|
||||
fun syncMangaToDex(mangaList: List<DbManga>) {
|
||||
launchIO {
|
||||
MdUtil.getEnabledMangaDex(preferences, sourcePreferences, sourceManager)?.let { mdex ->
|
||||
MdUtil.getEnabledMangaDex(unsortedPreferences, sourcePreferences, sourceManager)?.let { mdex ->
|
||||
mangaList.forEach {
|
||||
mdex.updateFollowStatus(MdUtil.getMangaId(it.url), FollowStatus.READING)
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import com.bluelinelabs.conductor.Router
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.category.interactor.GetCategories
|
||||
import eu.kanade.domain.category.interactor.SetDisplayModeForCategory
|
||||
import eu.kanade.domain.category.interactor.SetSortModeForCategory
|
||||
@ -15,7 +16,6 @@ import eu.kanade.domain.library.model.display
|
||||
import eu.kanade.domain.library.model.sort
|
||||
import eu.kanade.domain.library.service.LibraryPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.data.track.TrackService
|
||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||
@ -563,7 +563,7 @@ class LibrarySettingsSheet(
|
||||
open inner class Settings(context: Context, attrs: AttributeSet?) :
|
||||
ExtendedNavigationView(context, attrs) {
|
||||
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
val preferences: BasePreferences by injectLazy()
|
||||
val libraryPreferences: LibraryPreferences by injectLazy()
|
||||
lateinit var adapter: Adapter
|
||||
|
||||
|
@ -33,8 +33,10 @@ import com.bluelinelabs.conductor.RouterTransaction
|
||||
import com.google.android.material.navigation.NavigationBarView
|
||||
import com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback
|
||||
import dev.chrisbanes.insetter.applyInsetter
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.library.service.LibraryPreferences
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.cache.ChapterCache
|
||||
@ -90,6 +92,11 @@ class MainActivity : BaseActivity() {
|
||||
|
||||
private val sourcePreferences: SourcePreferences by injectLazy()
|
||||
private val libraryPreferences: LibraryPreferences by injectLazy()
|
||||
private val uiPreferences: UiPreferences by injectLazy()
|
||||
|
||||
// SY -->
|
||||
private val unsortedPreferences: UnsortedPreferences by injectLazy()
|
||||
// SY <--
|
||||
|
||||
lateinit var binding: MainActivityBinding
|
||||
|
||||
@ -142,7 +149,9 @@ class MainActivity : BaseActivity() {
|
||||
val didMigration = if (savedInstanceState == null) {
|
||||
EXHMigrations.upgrade(
|
||||
context = applicationContext,
|
||||
preferences = preferences,
|
||||
basePreferences = preferences,
|
||||
uiPreferences = uiPreferences,
|
||||
preferenceStore = Injekt.get(),
|
||||
networkPreferences = Injekt.get(),
|
||||
sourcePreferences = sourcePreferences,
|
||||
securityPreferences = Injekt.get(),
|
||||
@ -181,7 +190,7 @@ class MainActivity : BaseActivity() {
|
||||
setSplashScreenExitAnimation(splashScreen)
|
||||
|
||||
if (binding.sideNav != null) {
|
||||
preferences.sideNavIconAlignment()
|
||||
uiPreferences.sideNavIconAlignment()
|
||||
.asHotFlow {
|
||||
binding.sideNav?.menuGravity = when (it) {
|
||||
1 -> Gravity.CENTER
|
||||
@ -285,8 +294,8 @@ class MainActivity : BaseActivity() {
|
||||
// SY -->
|
||||
initWhenIdle {
|
||||
// Upload settings
|
||||
if (preferences.enableExhentai().get() &&
|
||||
preferences.exhShowSettingsUploadWarning().get()
|
||||
if (unsortedPreferences.enableExhentai().get() &&
|
||||
unsortedPreferences.exhShowSettingsUploadWarning().get()
|
||||
) {
|
||||
WarnConfigureDialogController.uploadSettings(router)
|
||||
}
|
||||
@ -302,7 +311,7 @@ class MainActivity : BaseActivity() {
|
||||
}
|
||||
}
|
||||
// SY -->
|
||||
if (!preferences.isHentaiEnabled().get()) {
|
||||
if (!unsortedPreferences.isHentaiEnabled().get()) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += EH_SOURCE_ID
|
||||
BlacklistedSources.HIDDEN_SOURCES += EXH_SOURCE_ID
|
||||
}
|
||||
@ -337,7 +346,7 @@ class MainActivity : BaseActivity() {
|
||||
.launchIn(lifecycleScope)
|
||||
|
||||
// SY -->
|
||||
preferences.bottomBarLabels()
|
||||
uiPreferences.bottomBarLabels()
|
||||
.asHotFlow { setNavLabelVisibility() }
|
||||
.launchIn(lifecycleScope)
|
||||
// SY <--
|
||||
@ -564,7 +573,7 @@ class MainActivity : BaseActivity() {
|
||||
lifecycleScope.launchUI { resetExitConfirmation() }
|
||||
} else if (backstackSize == 1 || !router.handleBack()) {
|
||||
// Regular back (i.e. closing the app)
|
||||
if (preferences.autoClearChapterCache().get()) {
|
||||
if (libraryPreferences.autoClearChapterCache().get()) {
|
||||
chapterCache.clear()
|
||||
}
|
||||
super.onBackPressed()
|
||||
@ -709,8 +718,8 @@ class MainActivity : BaseActivity() {
|
||||
|
||||
// SY -->
|
||||
private fun updateNavMenu(menu: Menu) {
|
||||
menu.findItem(R.id.nav_updates).isVisible = preferences.showNavUpdates().get()
|
||||
menu.findItem(R.id.nav_history).isVisible = preferences.showNavHistory().get()
|
||||
menu.findItem(R.id.nav_updates).isVisible = uiPreferences.showNavUpdates().get()
|
||||
menu.findItem(R.id.nav_history).isVisible = uiPreferences.showNavHistory().get()
|
||||
}
|
||||
// SY <--
|
||||
|
||||
@ -719,7 +728,7 @@ class MainActivity : BaseActivity() {
|
||||
|
||||
// SY -->
|
||||
private fun setNavLabelVisibility() {
|
||||
if (preferences.bottomBarLabels().get()) {
|
||||
if (uiPreferences.bottomBarLabels().get()) {
|
||||
nav.labelVisibilityMode = NavigationBarView.LABEL_VISIBILITY_LABELED
|
||||
} else {
|
||||
nav.labelVisibilityMode = NavigationBarView.LABEL_VISIBILITY_SELECTED
|
||||
|
@ -19,6 +19,7 @@ import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
import com.bluelinelabs.conductor.ControllerChangeType
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.data.chapter.NoChaptersException
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.manga.model.toDbManga
|
||||
import eu.kanade.presentation.components.ChangeCategoryDialog
|
||||
import eu.kanade.presentation.components.ChapterDownloadAction
|
||||
@ -32,7 +33,6 @@ import eu.kanade.presentation.util.calculateWindowWidthSizeClass
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.download.DownloadService
|
||||
import eu.kanade.tachiyomi.data.download.model.Download
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||
import eu.kanade.tachiyomi.network.HttpException
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
@ -523,7 +523,7 @@ class MangaController : FullComposeController<MangaPresenter> {
|
||||
val manga = presenter.manga ?: return
|
||||
// SY -->
|
||||
PreMigrationController.navigateToMigration(
|
||||
Injekt.get<PreferencesHelper>().skipPreMigration().get(),
|
||||
Injekt.get<UnsortedPreferences>().skipPreMigration().get(),
|
||||
router,
|
||||
listOf(manga.id),
|
||||
)
|
||||
|
@ -6,6 +6,7 @@ import android.os.Bundle
|
||||
import androidx.compose.runtime.Immutable
|
||||
import eu.kanade.core.prefs.CheckboxState
|
||||
import eu.kanade.core.prefs.mapAsCheckboxState
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.category.interactor.GetCategories
|
||||
import eu.kanade.domain.category.interactor.SetMangaCategories
|
||||
import eu.kanade.domain.category.model.Category
|
||||
@ -45,13 +46,13 @@ import eu.kanade.domain.track.interactor.GetTracks
|
||||
import eu.kanade.domain.track.interactor.InsertTrack
|
||||
import eu.kanade.domain.track.model.toDbTrack
|
||||
import eu.kanade.domain.track.model.toDomainTrack
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.Track
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainManga
|
||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.download.model.Download
|
||||
import eu.kanade.tachiyomi.data.library.CustomMangaManager
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.EnhancedTrackService
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.data.track.TrackService
|
||||
@ -127,7 +128,8 @@ class MangaPresenter(
|
||||
val mangaId: Long,
|
||||
val isFromSource: Boolean,
|
||||
val smartSearched: Boolean,
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val basePreferences: BasePreferences = Injekt.get(),
|
||||
private val uiPreferences: UiPreferences = Injekt.get(),
|
||||
private val downloadPreferences: DownloadPreferences = Injekt.get(),
|
||||
private val libraryPreferences: LibraryPreferences = Injekt.get(),
|
||||
private val trackManager: TrackManager = Injekt.get(),
|
||||
@ -267,8 +269,8 @@ class MangaPresenter(
|
||||
isDownloadedOnlyMode = downloadedOnlyMode,
|
||||
dialog = null,
|
||||
// SY -->
|
||||
showRecommendationsInOverflow = preferences.recommendsInOverflow().get(),
|
||||
showMergeInOverflow = preferences.mergeInOverflow().get(),
|
||||
showRecommendationsInOverflow = uiPreferences.recommendsInOverflow().get(),
|
||||
showMergeInOverflow = uiPreferences.mergeInOverflow().get(),
|
||||
showMergeWithAnother = smartSearched,
|
||||
mergedData = null,
|
||||
meta = null,
|
||||
@ -355,11 +357,11 @@ class MangaPresenter(
|
||||
context = view?.activity ?: Injekt.get<Application>(),
|
||||
manga = manga,
|
||||
// SY -->
|
||||
dateRelativeTime = if (manga.isEhBasedManga()) 0 else preferences.relativeTime().get(),
|
||||
dateRelativeTime = if (manga.isEhBasedManga()) 0 else uiPreferences.relativeTime().get(),
|
||||
dateFormat = if (manga.isEhBasedManga()) {
|
||||
MetadataUtil.EX_DATE_FORMAT
|
||||
} else {
|
||||
preferences.dateFormat()
|
||||
UiPreferences.dateFormat(uiPreferences.dateFormat().get())
|
||||
},
|
||||
mergedData = mergedData,
|
||||
alwaysShowReadingProgress = readerPreferences.preserveReadingPosition().get() && manga.isEhBasedManga(),
|
||||
@ -390,11 +392,11 @@ class MangaPresenter(
|
||||
}
|
||||
}
|
||||
|
||||
preferences.incognitoMode()
|
||||
basePreferences.incognitoMode()
|
||||
.asHotFlow { incognitoMode = it }
|
||||
.launchIn(presenterScope)
|
||||
|
||||
preferences.downloadedOnly()
|
||||
basePreferences.downloadedOnly()
|
||||
.asHotFlow { downloadedOnlyMode = it }
|
||||
.launchIn(presenterScope)
|
||||
}
|
||||
|
@ -3,8 +3,8 @@ package eu.kanade.tachiyomi.ui.manga.track
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.TrackItemBinding
|
||||
import eu.kanade.tachiyomi.util.view.popupMenu
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
@ -12,10 +12,10 @@ import java.text.DateFormat
|
||||
|
||||
class TrackHolder(private val binding: TrackItemBinding, adapter: TrackAdapter) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferences: UiPreferences by injectLazy()
|
||||
|
||||
private val dateFormat: DateFormat by lazy {
|
||||
preferences.dateFormat()
|
||||
UiPreferences.dateFormat(preferences.dateFormat().get())
|
||||
}
|
||||
|
||||
private val listener = adapter.rowClickListener
|
||||
|
@ -1,10 +1,10 @@
|
||||
package eu.kanade.tachiyomi.ui.more
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.presentation.more.about.AboutScreen
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.updater.AppUpdateChecker
|
||||
import eu.kanade.tachiyomi.data.updater.AppUpdateResult
|
||||
import eu.kanade.tachiyomi.ui.base.controller.BasicFullComposeController
|
||||
@ -24,7 +24,7 @@ import java.util.TimeZone
|
||||
|
||||
class AboutController : BasicFullComposeController() {
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferences: UiPreferences by injectLazy()
|
||||
private val updateChecker by lazy { AppUpdateChecker() }
|
||||
|
||||
@Composable
|
||||
@ -84,7 +84,7 @@ class AboutController : BasicFullComposeController() {
|
||||
)
|
||||
outputDf.timeZone = TimeZone.getDefault()
|
||||
|
||||
buildTime!!.toDateTimestampString(preferences.dateFormat())
|
||||
buildTime!!.toDateTimestampString(UiPreferences.dateFormat(preferences.dateFormat().get()))
|
||||
} catch (e: Exception) {
|
||||
BuildConfig.BUILD_TIME
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
package eu.kanade.tachiyomi.ui.more
|
||||
|
||||
import android.os.Bundle
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.download.DownloadService
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
@ -18,15 +19,18 @@ import uy.kohesive.injekt.api.get
|
||||
|
||||
class MorePresenter(
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
preferences: PreferencesHelper = Injekt.get(),
|
||||
preferences: BasePreferences = Injekt.get(),
|
||||
// SY -->
|
||||
uiPreferences: UiPreferences = Injekt.get(),
|
||||
// SY <--
|
||||
) : BasePresenter<MoreController>() {
|
||||
|
||||
val downloadedOnly = preferences.downloadedOnly().asState()
|
||||
val incognitoMode = preferences.incognitoMode().asState()
|
||||
|
||||
// SY -->
|
||||
val showNavUpdates = preferences.showNavUpdates().asState()
|
||||
val showNavHistory = preferences.showNavHistory().asState()
|
||||
val showNavUpdates = uiPreferences.showNavUpdates().asState()
|
||||
val showNavHistory = uiPreferences.showNavHistory().asState()
|
||||
// SY <--
|
||||
|
||||
private var _state: MutableStateFlow<DownloadQueueState> = MutableStateFlow(DownloadQueueState.Stopped)
|
||||
|
@ -6,6 +6,7 @@ import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import androidx.annotation.ColorInt
|
||||
import com.jakewharton.rxrelay.BehaviorRelay
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.chapter.interactor.GetChapterByMangaId
|
||||
import eu.kanade.domain.chapter.interactor.UpdateChapter
|
||||
import eu.kanade.domain.chapter.model.ChapterUpdate
|
||||
@ -24,12 +25,12 @@ import eu.kanade.domain.track.interactor.GetTracks
|
||||
import eu.kanade.domain.track.interactor.InsertTrack
|
||||
import eu.kanade.domain.track.model.toDbTrack
|
||||
import eu.kanade.domain.track.service.TrackPreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainChapter
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainManga
|
||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.download.model.Download
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.saver.Image
|
||||
import eu.kanade.tachiyomi.data.saver.ImageSaver
|
||||
import eu.kanade.tachiyomi.data.saver.Location
|
||||
@ -100,7 +101,7 @@ import eu.kanade.tachiyomi.data.database.models.Chapter as DbChapter
|
||||
class ReaderPresenter(
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
preferences: BasePreferences = Injekt.get(),
|
||||
private val downloadPreferences: DownloadPreferences = Injekt.get(),
|
||||
private val readerPreferences: ReaderPreferences = Injekt.get(),
|
||||
private val trackPreferences: TrackPreferences = Injekt.get(),
|
||||
@ -113,6 +114,7 @@ class ReaderPresenter(
|
||||
private val updateChapter: UpdateChapter = Injekt.get(),
|
||||
private val setMangaViewerFlags: SetMangaViewerFlags = Injekt.get(),
|
||||
// SY -->
|
||||
private val uiPreferences: UiPreferences = Injekt.get(),
|
||||
private val getFlatMetadataById: GetFlatMetadataById = Injekt.get(),
|
||||
private val getMergedManga: GetMergedManga = Injekt.get(),
|
||||
private val getMergedReferencesById: GetMergedReferencesById = Injekt.get(),
|
||||
@ -379,7 +381,7 @@ class ReaderPresenter(
|
||||
manga!!.toDomainManga()!!,
|
||||
it.chapter.id == currentChapter?.chapter?.id,
|
||||
context,
|
||||
preferences.dateFormat(),
|
||||
UiPreferences.dateFormat(uiPreferences.dateFormat().get()),
|
||||
decimalFormat,
|
||||
)
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import androidx.paging.compose.LazyPagingItems
|
||||
import androidx.paging.compose.collectAsLazyPagingItems
|
||||
import androidx.paging.insertSeparators
|
||||
import androidx.paging.map
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.chapter.model.Chapter
|
||||
import eu.kanade.domain.history.interactor.DeleteHistoryTable
|
||||
import eu.kanade.domain.history.interactor.GetHistory
|
||||
@ -22,7 +23,6 @@ import eu.kanade.domain.history.interactor.RemoveHistoryByMangaId
|
||||
import eu.kanade.domain.history.model.HistoryWithRelations
|
||||
import eu.kanade.presentation.history.HistoryUiModel
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||
import eu.kanade.tachiyomi.util.lang.toDateKey
|
||||
@ -46,7 +46,7 @@ class HistoryPresenter(
|
||||
private val deleteHistoryTable: DeleteHistoryTable = Injekt.get(),
|
||||
private val removeHistoryById: RemoveHistoryById = Injekt.get(),
|
||||
private val removeHistoryByMangaId: RemoveHistoryByMangaId = Injekt.get(),
|
||||
preferences: PreferencesHelper = Injekt.get(),
|
||||
preferences: BasePreferences = Injekt.get(),
|
||||
) : BasePresenter<HistoryController>(), HistoryState by state {
|
||||
|
||||
private val _events: Channel<Event> = Channel(Int.MAX_VALUE)
|
||||
|
@ -4,6 +4,7 @@ import android.os.Bundle
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.chapter.interactor.GetChapter
|
||||
import eu.kanade.domain.chapter.interactor.SetReadStatus
|
||||
import eu.kanade.domain.chapter.interactor.UpdateChapter
|
||||
@ -11,6 +12,7 @@ import eu.kanade.domain.chapter.model.ChapterUpdate
|
||||
import eu.kanade.domain.chapter.model.toDbChapter
|
||||
import eu.kanade.domain.library.service.LibraryPreferences
|
||||
import eu.kanade.domain.manga.interactor.GetManga
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.domain.updates.interactor.GetUpdates
|
||||
import eu.kanade.domain.updates.model.UpdatesWithRelations
|
||||
import eu.kanade.presentation.components.ChapterDownloadAction
|
||||
@ -19,7 +21,6 @@ import eu.kanade.presentation.updates.UpdatesStateImpl
|
||||
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||
import eu.kanade.tachiyomi.data.download.DownloadService
|
||||
import eu.kanade.tachiyomi.data.download.model.Download
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import eu.kanade.tachiyomi.util.lang.launchIO
|
||||
@ -32,6 +33,7 @@ import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.catch
|
||||
import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.receiveAsFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import logcat.LogPriority
|
||||
@ -50,17 +52,18 @@ class UpdatesPresenter(
|
||||
private val sourceManager: SourceManager = Injekt.get(),
|
||||
private val downloadManager: DownloadManager = Injekt.get(),
|
||||
private val getChapter: GetChapter = Injekt.get(),
|
||||
preferences: PreferencesHelper = Injekt.get(),
|
||||
basePreferences: BasePreferences = Injekt.get(),
|
||||
uiPreferences: UiPreferences = Injekt.get(),
|
||||
libraryPreferences: LibraryPreferences = Injekt.get(),
|
||||
) : BasePresenter<UpdatesController>(), UpdatesState by state {
|
||||
|
||||
val isDownloadOnly: Boolean by preferences.downloadedOnly().asState()
|
||||
val isIncognitoMode: Boolean by preferences.incognitoMode().asState()
|
||||
val isDownloadOnly: Boolean by basePreferences.downloadedOnly().asState()
|
||||
val isIncognitoMode: Boolean by basePreferences.incognitoMode().asState()
|
||||
|
||||
val lastUpdated by libraryPreferences.libraryUpdateLastTimestamp().asState()
|
||||
|
||||
val relativeTime: Int by preferences.relativeTime().asState()
|
||||
val dateFormat: DateFormat by mutableStateOf(preferences.dateFormat())
|
||||
val relativeTime: Int by uiPreferences.relativeTime().asState()
|
||||
val dateFormat: DateFormat by mutableStateOf(UiPreferences.dateFormat(uiPreferences.dateFormat().get()))
|
||||
|
||||
private val _events: Channel<Event> = Channel(Int.MAX_VALUE)
|
||||
val events: Flow<Event> = _events.receiveAsFlow()
|
||||
|
@ -14,11 +14,15 @@ import androidx.core.net.toUri
|
||||
import androidx.core.text.HtmlCompat
|
||||
import androidx.preference.PreferenceScreen
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.chapter.interactor.GetChapterByMangaId
|
||||
import eu.kanade.domain.chapter.model.toDbChapter
|
||||
import eu.kanade.domain.library.service.LibraryPreferences
|
||||
import eu.kanade.domain.manga.interactor.GetAllManga
|
||||
import eu.kanade.domain.manga.repository.MangaRepository
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.domain.ui.model.TabletUiMode
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.cache.ChapterCache
|
||||
import eu.kanade.tachiyomi.data.cache.PagePreviewCache
|
||||
@ -92,8 +96,11 @@ class SettingsAdvancedController(
|
||||
private val chapterCache: ChapterCache by injectLazy()
|
||||
private val trackManager: TrackManager by injectLazy()
|
||||
private val networkPreferences: NetworkPreferences by injectLazy()
|
||||
private val libraryPreferences: LibraryPreferences by injectLazy()
|
||||
private val uiPreferences: UiPreferences by injectLazy()
|
||||
private val sourcePreferences: SourcePreferences by injectLazy()
|
||||
private val delegateSourcePreferences: DelegateSourcePreferences by injectLazy()
|
||||
private val unsortedPreferences: UnsortedPreferences by injectLazy()
|
||||
private val getAllManga: GetAllManga by injectLazy()
|
||||
private val getChapterByMangaId: GetChapterByMangaId by injectLazy()
|
||||
private val pagePreviewCache: PagePreviewCache by injectLazy()
|
||||
@ -183,7 +190,7 @@ class SettingsAdvancedController(
|
||||
}
|
||||
// SY <--
|
||||
switchPreference {
|
||||
bindTo(preferences.autoClearChapterCache())
|
||||
bindTo(libraryPreferences.autoClearChapterCache())
|
||||
titleRes = R.string.pref_auto_clear_chapter_cache
|
||||
}
|
||||
preference {
|
||||
@ -354,11 +361,11 @@ class SettingsAdvancedController(
|
||||
titleRes = R.string.pref_category_display
|
||||
|
||||
listPreference {
|
||||
bindTo(preferences.tabletUiMode())
|
||||
bindTo(uiPreferences.tabletUiMode())
|
||||
titleRes = R.string.pref_tablet_ui_mode
|
||||
summary = "%s"
|
||||
entriesRes = PreferenceValues.TabletUiMode.values().map { it.titleResId }.toTypedArray()
|
||||
entryValues = PreferenceValues.TabletUiMode.values().map { it.name }.toTypedArray()
|
||||
entriesRes = TabletUiMode.values().map { it.titleResId }.toTypedArray()
|
||||
entryValues = TabletUiMode.values().map { it.name }.toTypedArray()
|
||||
|
||||
onChange {
|
||||
activity?.toast(R.string.requires_app_restart)
|
||||
@ -454,12 +461,12 @@ class SettingsAdvancedController(
|
||||
isPersistent = false
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.isHentaiEnabled())
|
||||
bindTo(unsortedPreferences.isHentaiEnabled())
|
||||
titleRes = R.string.toggle_hentai_features
|
||||
summaryRes = R.string.toggle_hentai_features_summary
|
||||
|
||||
onChange {
|
||||
if (preferences.isHentaiEnabled().get()) {
|
||||
if (unsortedPreferences.isHentaiEnabled().get()) {
|
||||
BlacklistedSources.HIDDEN_SOURCES += EH_SOURCE_ID
|
||||
BlacklistedSources.HIDDEN_SOURCES += EXH_SOURCE_ID
|
||||
} else {
|
||||
@ -477,7 +484,7 @@ class SettingsAdvancedController(
|
||||
}
|
||||
|
||||
intListPreference {
|
||||
bindTo(preferences.logLevel())
|
||||
bindTo(unsortedPreferences.logLevel())
|
||||
titleRes = R.string.log_level
|
||||
|
||||
entries = EHLogLevel.values().map {
|
||||
|
@ -5,9 +5,11 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.domain.ui.model.AppTheme
|
||||
import eu.kanade.domain.ui.model.ThemeMode
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.util.preference.bindTo
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
import eu.kanade.tachiyomi.util.preference.entriesRes
|
||||
import eu.kanade.tachiyomi.util.preference.initThenAdd
|
||||
import eu.kanade.tachiyomi.util.preference.intListPreference
|
||||
@ -20,13 +22,13 @@ import eu.kanade.tachiyomi.util.system.DeviceUtil
|
||||
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
|
||||
import eu.kanade.tachiyomi.util.system.isTablet
|
||||
import eu.kanade.tachiyomi.widget.preference.ThemesPreference
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.Date
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
|
||||
|
||||
class SettingsAppearanceController : SettingsController() {
|
||||
|
||||
private var themesPreference: ThemesPreference? = null
|
||||
private val uiPreferences: UiPreferences by injectLazy()
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
||||
titleRes = R.string.pref_category_appearance
|
||||
@ -35,7 +37,7 @@ class SettingsAppearanceController : SettingsController() {
|
||||
titleRes = R.string.pref_category_theme
|
||||
|
||||
listPreference {
|
||||
bindTo(preferences.themeMode())
|
||||
bindTo(uiPreferences.themeMode())
|
||||
titleRes = R.string.pref_theme_mode
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
@ -45,9 +47,9 @@ class SettingsAppearanceController : SettingsController() {
|
||||
R.string.theme_dark,
|
||||
)
|
||||
entryValues = arrayOf(
|
||||
Values.ThemeMode.system.name,
|
||||
Values.ThemeMode.light.name,
|
||||
Values.ThemeMode.dark.name,
|
||||
ThemeMode.SYSTEM.name,
|
||||
ThemeMode.LIGHT.name,
|
||||
ThemeMode.DARK.name,
|
||||
)
|
||||
} else {
|
||||
entriesRes = arrayOf(
|
||||
@ -55,19 +57,19 @@ class SettingsAppearanceController : SettingsController() {
|
||||
R.string.theme_dark,
|
||||
)
|
||||
entryValues = arrayOf(
|
||||
Values.ThemeMode.light.name,
|
||||
Values.ThemeMode.dark.name,
|
||||
ThemeMode.LIGHT.name,
|
||||
ThemeMode.DARK.name,
|
||||
)
|
||||
}
|
||||
|
||||
summary = "%s"
|
||||
}
|
||||
themesPreference = initThenAdd(ThemesPreference(context)) {
|
||||
bindTo(preferences.appTheme())
|
||||
bindTo(uiPreferences.appTheme())
|
||||
titleRes = R.string.pref_app_theme
|
||||
|
||||
val appThemes = Values.AppTheme.values().filter {
|
||||
val monetFilter = if (it == Values.AppTheme.MONET) {
|
||||
val appThemes = AppTheme.values().filter {
|
||||
val monetFilter = if (it == AppTheme.MONET) {
|
||||
DeviceUtil.isDynamicColorAvailable
|
||||
} else {
|
||||
true
|
||||
@ -82,10 +84,10 @@ class SettingsAppearanceController : SettingsController() {
|
||||
}
|
||||
}
|
||||
switchPreference {
|
||||
bindTo(preferences.themeDarkAmoled())
|
||||
bindTo(uiPreferences.themeDarkAmoled())
|
||||
titleRes = R.string.pref_dark_theme_pure_black
|
||||
|
||||
visibleIf(preferences.themeMode()) { it != Values.ThemeMode.light }
|
||||
visibleIf(uiPreferences.themeMode()) { it != ThemeMode.LIGHT }
|
||||
|
||||
onChange {
|
||||
activity?.let { ActivityCompat.recreate(it) }
|
||||
@ -99,7 +101,7 @@ class SettingsAppearanceController : SettingsController() {
|
||||
titleRes = R.string.pref_category_navigation
|
||||
|
||||
intListPreference {
|
||||
bindTo(preferences.sideNavIconAlignment())
|
||||
bindTo(uiPreferences.sideNavIconAlignment())
|
||||
titleRes = R.string.pref_side_nav_icon_alignment
|
||||
entriesRes = arrayOf(
|
||||
R.string.alignment_top,
|
||||
@ -116,7 +118,7 @@ class SettingsAppearanceController : SettingsController() {
|
||||
titleRes = R.string.pref_category_timestamps
|
||||
|
||||
intListPreference {
|
||||
bindTo(preferences.relativeTime())
|
||||
bindTo(uiPreferences.relativeTime())
|
||||
titleRes = R.string.pref_relative_format
|
||||
val values = arrayOf("0", "2", "7")
|
||||
entryValues = values
|
||||
@ -131,13 +133,13 @@ class SettingsAppearanceController : SettingsController() {
|
||||
}
|
||||
|
||||
listPreference {
|
||||
key = Keys.dateFormat
|
||||
bindTo(uiPreferences.dateFormat())
|
||||
titleRes = R.string.pref_date_format
|
||||
entryValues = arrayOf("", "MM/dd/yy", "dd/MM/yy", "yyyy-MM-dd", "dd MMM yyyy", "MMM dd, yyyy")
|
||||
|
||||
val now = Date().time
|
||||
entries = entryValues.map { value ->
|
||||
val formattedDate = preferences.dateFormat(value.toString()).format(now)
|
||||
val formattedDate = UiPreferences.dateFormat(value.toString()).format(now)
|
||||
if (value == "") {
|
||||
"${context.getString(R.string.label_default)} ($formattedDate)"
|
||||
} else {
|
||||
@ -145,7 +147,6 @@ class SettingsAppearanceController : SettingsController() {
|
||||
}
|
||||
}.toTypedArray()
|
||||
|
||||
defaultValue = ""
|
||||
summary = "%s"
|
||||
}
|
||||
}
|
||||
@ -154,15 +155,15 @@ class SettingsAppearanceController : SettingsController() {
|
||||
titleRes = R.string.pref_category_navbar
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.showNavUpdates())
|
||||
bindTo(uiPreferences.showNavUpdates())
|
||||
titleRes = R.string.pref_hide_updates_button
|
||||
}
|
||||
switchPreference {
|
||||
bindTo(preferences.showNavHistory())
|
||||
bindTo(uiPreferences.showNavHistory())
|
||||
titleRes = R.string.pref_hide_history_button
|
||||
}
|
||||
switchPreference {
|
||||
bindTo(preferences.bottomBarLabels())
|
||||
bindTo(uiPreferences.bottomBarLabels())
|
||||
titleRes = R.string.pref_show_bottom_bar_labels
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,9 @@ package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
|
||||
import eu.kanade.tachiyomi.ui.base.controller.pushController
|
||||
@ -25,6 +27,11 @@ class SettingsBrowseController : SettingsController() {
|
||||
|
||||
private val sourcePreferences: SourcePreferences by injectLazy()
|
||||
|
||||
// SY -->
|
||||
private val uiPreferences: UiPreferences by injectLazy()
|
||||
private val unsortedPreferences: UnsortedPreferences by injectLazy()
|
||||
// SY <--
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
||||
titleRes = R.string.browse
|
||||
|
||||
@ -49,12 +56,12 @@ class SettingsBrowseController : SettingsController() {
|
||||
summaryRes = R.string.pref_source_source_filtering_summery
|
||||
}
|
||||
switchPreference {
|
||||
bindTo(preferences.useNewSourceNavigation())
|
||||
bindTo(uiPreferences.useNewSourceNavigation())
|
||||
titleRes = R.string.pref_source_navigation
|
||||
summaryRes = R.string.pref_source_navigation_summery
|
||||
}
|
||||
switchPreference {
|
||||
bindTo(preferences.allowLocalSourceHiddenFolders())
|
||||
bindTo(unsortedPreferences.allowLocalSourceHiddenFolders())
|
||||
titleRes = R.string.pref_local_source_hidden_folders
|
||||
summaryRes = R.string.pref_local_source_hidden_folders_summery
|
||||
}
|
||||
@ -64,7 +71,7 @@ class SettingsBrowseController : SettingsController() {
|
||||
titleRes = R.string.feed
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.feedTabInFront())
|
||||
bindTo(uiPreferences.feedTabInFront())
|
||||
titleRes = R.string.pref_feed_position
|
||||
summaryRes = R.string.pref_feed_position_summery
|
||||
}
|
||||
@ -99,7 +106,7 @@ class SettingsBrowseController : SettingsController() {
|
||||
key = "pref_edit_extension_repos"
|
||||
titleRes = R.string.action_edit_repos
|
||||
|
||||
val catCount = preferences.extensionRepos().get().count()
|
||||
val catCount = unsortedPreferences.extensionRepos().get().count()
|
||||
summary = context.resources.getQuantityString(R.plurals.num_repos, catCount, catCount)
|
||||
|
||||
onClick {
|
||||
|
@ -19,8 +19,8 @@ import androidx.preference.PreferenceScreen
|
||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
import com.bluelinelabs.conductor.ControllerChangeType
|
||||
import dev.chrisbanes.insetter.applyInsetter
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.util.preference.asHotFlow
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@ -33,7 +33,7 @@ import uy.kohesive.injekt.api.get
|
||||
abstract class SettingsController : PreferenceController() {
|
||||
|
||||
var preferenceKey: String? = null
|
||||
val preferences: PreferencesHelper = Injekt.get()
|
||||
val preferences: BasePreferences = Injekt.get()
|
||||
val viewScope: CoroutineScope = MainScope()
|
||||
private var themedContext: Context? = null
|
||||
|
||||
|
@ -13,6 +13,7 @@ import androidx.core.content.getSystemService
|
||||
import androidx.core.widget.doAfterTextChanged
|
||||
import androidx.preference.PreferenceScreen
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.manga.interactor.DeleteFavoriteEntries
|
||||
import eu.kanade.domain.manga.interactor.GetExhFavoriteMangaWithMetadata
|
||||
import eu.kanade.domain.manga.interactor.GetFlatMetadataById
|
||||
@ -69,6 +70,7 @@ import kotlin.time.Duration.Companion.seconds
|
||||
*/
|
||||
|
||||
class SettingsEhController : SettingsController() {
|
||||
val unsortedPreferences: UnsortedPreferences by injectLazy()
|
||||
private val getFlatMetadataById: GetFlatMetadataById by injectLazy()
|
||||
private val deleteFavoriteEntries: DeleteFavoriteEntries by injectLazy()
|
||||
private val getExhFavoriteMangaWithMetadata: GetExhFavoriteMangaWithMetadata by injectLazy()
|
||||
@ -94,11 +96,11 @@ class SettingsEhController : SettingsController() {
|
||||
titleRes = R.string.ehentai_prefs_account_settings
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.enableExhentai())
|
||||
bindTo(unsortedPreferences.enableExhentai())
|
||||
titleRes = R.string.enable_exhentai
|
||||
summaryOff = context.getString(R.string.requires_login)
|
||||
isPersistent = false
|
||||
preferences.enableExhentai()
|
||||
unsortedPreferences.enableExhentai()
|
||||
.changes()
|
||||
.onEach {
|
||||
isChecked = it
|
||||
@ -108,7 +110,7 @@ class SettingsEhController : SettingsController() {
|
||||
onChange { newVal ->
|
||||
newVal as Boolean
|
||||
if (!newVal) {
|
||||
preferences.enableExhentai().set(false)
|
||||
unsortedPreferences.enableExhentai().set(false)
|
||||
true
|
||||
} else {
|
||||
startActivityForResult(EhLoginActivity.newIntent(activity!!), LOGIN_RESULT)
|
||||
@ -118,7 +120,7 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
intListPreference {
|
||||
bindTo(preferences.useHentaiAtHome())
|
||||
bindTo(unsortedPreferences.useHentaiAtHome())
|
||||
titleRes = R.string.use_hentai_at_home
|
||||
summaryRes = R.string.use_hentai_at_home_summary
|
||||
entriesRes = arrayOf(
|
||||
@ -127,31 +129,31 @@ class SettingsEhController : SettingsController() {
|
||||
)
|
||||
entryValues = arrayOf("0", "1")
|
||||
|
||||
onChange { preferences.useHentaiAtHome().reconfigure() }
|
||||
onChange { unsortedPreferences.useHentaiAtHome().reconfigure() }
|
||||
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
visibleIf(unsortedPreferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.useJapaneseTitle())
|
||||
bindTo(unsortedPreferences.useJapaneseTitle())
|
||||
titleRes = R.string.show_japanese_titles
|
||||
summaryOn = context.getString(R.string.show_japanese_titles_option_1)
|
||||
summaryOff = context.getString(R.string.show_japanese_titles_option_2)
|
||||
|
||||
onChange { preferences.useJapaneseTitle().reconfigure() }
|
||||
onChange { unsortedPreferences.useJapaneseTitle().reconfigure() }
|
||||
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
visibleIf(unsortedPreferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.exhUseOriginalImages())
|
||||
bindTo(unsortedPreferences.exhUseOriginalImages())
|
||||
titleRes = R.string.use_original_images
|
||||
summaryOn = context.getString(R.string.use_original_images_on)
|
||||
summaryOff = context.getString(R.string.use_original_images_off)
|
||||
|
||||
onChange { preferences.exhUseOriginalImages().reconfigure() }
|
||||
onChange { unsortedPreferences.exhUseOriginalImages().reconfigure() }
|
||||
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
visibleIf(unsortedPreferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
preference {
|
||||
@ -159,7 +161,7 @@ class SettingsEhController : SettingsController() {
|
||||
titleRes = R.string.watched_tags
|
||||
summaryRes = R.string.watched_tags_summary
|
||||
onClick {
|
||||
val intent = if (preferences.enableExhentai().get()) {
|
||||
val intent = if (unsortedPreferences.enableExhentai().get()) {
|
||||
WebViewActivity.newIntent(activity!!, url = "https://exhentai.org/mytags", title = context.getString(R.string.watched_tags_exh))
|
||||
} else {
|
||||
WebViewActivity.newIntent(activity!!, url = "https://e-hentai.org/mytags", title = context.getString(R.string.watched_tags_eh))
|
||||
@ -167,16 +169,16 @@ class SettingsEhController : SettingsController() {
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
visibleIf(unsortedPreferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
preference {
|
||||
bindTo(preferences.ehTagFilterValue())
|
||||
bindTo(unsortedPreferences.ehTagFilterValue())
|
||||
titleRes = R.string.tag_filtering_threshold
|
||||
summary = context.getString(R.string.tag_filtering_threshhold_summary, preferences.ehTagFilterValue().get())
|
||||
summary = context.getString(R.string.tag_filtering_threshhold_summary, unsortedPreferences.ehTagFilterValue().get())
|
||||
|
||||
onClick {
|
||||
var value: Int? = preferences.ehTagFilterValue().get()
|
||||
var value: Int? = unsortedPreferences.ehTagFilterValue().get()
|
||||
MaterialAlertDialogBuilder(activity!!)
|
||||
.setTitle(R.string.tag_filtering_threshold)
|
||||
.let { builder ->
|
||||
@ -201,24 +203,24 @@ class SettingsEhController : SettingsController() {
|
||||
builder.setView(binding.root)
|
||||
}
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
preferences.ehTagFilterValue().set(value ?: return@setPositiveButton)
|
||||
summary = context.getString(R.string.tag_filtering_threshhold_summary, preferences.ehTagFilterValue().get())
|
||||
preferences.ehTagFilterValue().reconfigure()
|
||||
unsortedPreferences.ehTagFilterValue().set(value ?: return@setPositiveButton)
|
||||
summary = context.getString(R.string.tag_filtering_threshhold_summary, unsortedPreferences.ehTagFilterValue().get())
|
||||
unsortedPreferences.ehTagFilterValue().reconfigure()
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
visibleIf(unsortedPreferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
preference {
|
||||
bindTo(preferences.ehTagWatchingValue())
|
||||
bindTo(unsortedPreferences.ehTagWatchingValue())
|
||||
titleRes = R.string.tag_watching_threshhold
|
||||
summary = context.getString(R.string.tag_watching_threshhold_summary, preferences.ehTagWatchingValue().get())
|
||||
summary = context.getString(R.string.tag_watching_threshhold_summary, unsortedPreferences.ehTagWatchingValue().get())
|
||||
|
||||
onClick {
|
||||
var value: Int? = preferences.ehTagWatchingValue().get()
|
||||
var value: Int? = unsortedPreferences.ehTagWatchingValue().get()
|
||||
MaterialAlertDialogBuilder(activity!!)
|
||||
.setTitle(R.string.tag_watching_threshhold)
|
||||
.let { builder ->
|
||||
@ -244,19 +246,19 @@ class SettingsEhController : SettingsController() {
|
||||
builder.setView(binding.root)
|
||||
}
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
preferences.ehTagWatchingValue().set(value ?: return@setPositiveButton)
|
||||
summary = context.getString(R.string.tag_watching_threshhold_summary, preferences.ehTagWatchingValue().get())
|
||||
preferences.ehTagWatchingValue().reconfigure()
|
||||
unsortedPreferences.ehTagWatchingValue().set(value ?: return@setPositiveButton)
|
||||
summary = context.getString(R.string.tag_watching_threshhold_summary, unsortedPreferences.ehTagWatchingValue().get())
|
||||
unsortedPreferences.ehTagWatchingValue().reconfigure()
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
visibleIf(unsortedPreferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
preference {
|
||||
bindTo(preferences.exhSettingsLanguages())
|
||||
bindTo(unsortedPreferences.exhSettingsLanguages())
|
||||
titleRes = R.string.language_filtering
|
||||
summaryRes = R.string.language_filtering_summary
|
||||
|
||||
@ -266,11 +268,11 @@ class SettingsEhController : SettingsController() {
|
||||
dialog.showDialog(router)
|
||||
}
|
||||
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
visibleIf(unsortedPreferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
preference {
|
||||
bindTo(preferences.exhEnabledCategories())
|
||||
bindTo(unsortedPreferences.exhEnabledCategories())
|
||||
titleRes = R.string.frong_page_categories
|
||||
summaryRes = R.string.fromt_page_categories_summary
|
||||
|
||||
@ -280,19 +282,19 @@ class SettingsEhController : SettingsController() {
|
||||
dialog.showDialog(router)
|
||||
}
|
||||
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
visibleIf(unsortedPreferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.exhWatchedListDefaultState())
|
||||
bindTo(unsortedPreferences.exhWatchedListDefaultState())
|
||||
titleRes = R.string.watched_list_default
|
||||
summaryRes = R.string.watched_list_state_summary
|
||||
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
visibleIf(unsortedPreferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
listPreference {
|
||||
bindTo(preferences.imageQuality())
|
||||
bindTo(unsortedPreferences.imageQuality())
|
||||
summaryRes = R.string.eh_image_quality_summary
|
||||
titleRes = R.string.eh_image_quality
|
||||
entriesRes = arrayOf(
|
||||
@ -312,13 +314,13 @@ class SettingsEhController : SettingsController() {
|
||||
"low",
|
||||
)
|
||||
|
||||
onChange { preferences.imageQuality().reconfigure() }
|
||||
onChange { unsortedPreferences.imageQuality().reconfigure() }
|
||||
|
||||
visibleIf(preferences.enableExhentai()) { it }
|
||||
visibleIf(unsortedPreferences.enableExhentai()) { it }
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.enhancedEHentaiView())
|
||||
bindTo(unsortedPreferences.enhancedEHentaiView())
|
||||
titleRes = R.string.pref_enhanced_e_hentai_view
|
||||
summaryRes = R.string.pref_enhanced_e_hentai_view_summary
|
||||
}
|
||||
@ -328,7 +330,7 @@ class SettingsEhController : SettingsController() {
|
||||
titleRes = R.string.favorites_sync
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.exhReadOnlySync())
|
||||
bindTo(unsortedPreferences.exhReadOnlySync())
|
||||
titleRes = R.string.disable_favorites_uploading
|
||||
summaryRes = R.string.disable_favorites_uploading_summary
|
||||
}
|
||||
@ -346,7 +348,7 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.exhLenientSync())
|
||||
bindTo(unsortedPreferences.exhLenientSync())
|
||||
titleRes = R.string.ignore_sync_errors
|
||||
summaryRes = R.string.ignore_sync_errors_summary
|
||||
}
|
||||
@ -381,7 +383,7 @@ class SettingsEhController : SettingsController() {
|
||||
titleRes = R.string.gallery_update_checker
|
||||
|
||||
intListPreference {
|
||||
bindTo(preferences.exhAutoUpdateFrequency())
|
||||
bindTo(unsortedPreferences.exhAutoUpdateFrequency())
|
||||
titleRes = R.string.time_between_batches
|
||||
entriesRes = arrayOf(
|
||||
R.string.time_between_batches_never,
|
||||
@ -395,7 +397,7 @@ class SettingsEhController : SettingsController() {
|
||||
)
|
||||
entryValues = arrayOf("0", "1", "2", "3", "6", "12", "24", "48")
|
||||
|
||||
preferences.exhAutoUpdateFrequency().changes()
|
||||
unsortedPreferences.exhAutoUpdateFrequency().changes()
|
||||
.onEach { newVal ->
|
||||
summary = if (newVal == 0) {
|
||||
context.getString(R.string.time_between_batches_summary_1, context.getString(R.string.app_name))
|
||||
@ -413,13 +415,13 @@ class SettingsEhController : SettingsController() {
|
||||
}
|
||||
|
||||
multiSelectListPreference {
|
||||
bindTo(preferences.exhAutoUpdateRequirements())
|
||||
bindTo(unsortedPreferences.exhAutoUpdateRequirements())
|
||||
titleRes = R.string.auto_update_restrictions
|
||||
entriesRes = arrayOf(R.string.connected_to_wifi, R.string.charging)
|
||||
entryValues = arrayOf(DEVICE_ONLY_ON_WIFI, DEVICE_CHARGING)
|
||||
|
||||
fun updateSummary() {
|
||||
val restrictions = preferences.exhAutoUpdateRequirements().get()
|
||||
val restrictions = unsortedPreferences.exhAutoUpdateRequirements().get()
|
||||
.sorted()
|
||||
.map {
|
||||
when (it) {
|
||||
@ -437,7 +439,7 @@ class SettingsEhController : SettingsController() {
|
||||
summary = context.getString(R.string.restrictions, restrictionsText)
|
||||
}
|
||||
|
||||
visibleIf(preferences.exhAutoUpdateFrequency()) { it > 0 }
|
||||
visibleIf(unsortedPreferences.exhAutoUpdateFrequency()) { it > 0 }
|
||||
|
||||
onChange {
|
||||
// Post to event looper to allow the preference to be updated.
|
||||
@ -445,7 +447,7 @@ class SettingsEhController : SettingsController() {
|
||||
true
|
||||
}
|
||||
|
||||
preferences.exhAutoUpdateRequirements().changes()
|
||||
unsortedPreferences.exhAutoUpdateRequirements().changes()
|
||||
.onEach { updateSummary() }
|
||||
.launchIn(viewScope)
|
||||
}
|
||||
@ -464,7 +466,7 @@ class SettingsEhController : SettingsController() {
|
||||
viewScope.launch(Dispatchers.IO) {
|
||||
val updateInfo = try {
|
||||
val stats =
|
||||
preferences.exhAutoUpdateStats().get().nullIfBlank()?.let {
|
||||
unsortedPreferences.exhAutoUpdateStats().get().nullIfBlank()?.let {
|
||||
Json.decodeFromString<EHentaiUpdaterStats>(it)
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,9 @@ import android.provider.Settings
|
||||
import androidx.appcompat.app.AppCompatDelegate
|
||||
import androidx.core.os.LocaleListCompat
|
||||
import androidx.preference.PreferenceScreen
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.library.service.LibraryPreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.util.preference.bindTo
|
||||
import eu.kanade.tachiyomi.util.preference.listPreference
|
||||
@ -25,6 +27,11 @@ class SettingsGeneralController : SettingsController() {
|
||||
|
||||
private val libraryPreferences: LibraryPreferences by injectLazy()
|
||||
|
||||
// SY -->
|
||||
private val uiPreferences: UiPreferences by injectLazy()
|
||||
private val unsortedPreferences: UnsortedPreferences by injectLazy()
|
||||
// SY <--
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
||||
titleRes = R.string.pref_category_general
|
||||
|
||||
@ -95,24 +102,24 @@ class SettingsGeneralController : SettingsController() {
|
||||
titleRes = R.string.pref_category_fork
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.expandFilters())
|
||||
bindTo(uiPreferences.expandFilters())
|
||||
titleRes = R.string.toggle_expand_search_filters
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.autoSolveCaptcha())
|
||||
bindTo(unsortedPreferences.autoSolveCaptcha())
|
||||
titleRes = R.string.auto_solve_captchas
|
||||
summaryRes = R.string.auto_solve_captchas_summary
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.recommendsInOverflow())
|
||||
bindTo(uiPreferences.recommendsInOverflow())
|
||||
titleRes = R.string.put_recommends_in_overflow
|
||||
summaryRes = R.string.put_recommends_in_overflow_summary
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.mergeInOverflow())
|
||||
bindTo(uiPreferences.mergeInOverflow())
|
||||
titleRes = R.string.put_merge_in_overflow
|
||||
summaryRes = R.string.put_merge_in_overflow_summary
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.core.text.buildSpannedString
|
||||
import androidx.preference.PreferenceScreen
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.category.interactor.GetCategories
|
||||
import eu.kanade.domain.category.interactor.ResetCategoryFlags
|
||||
import eu.kanade.domain.category.model.Category
|
||||
@ -29,7 +30,6 @@ import eu.kanade.tachiyomi.ui.base.controller.pushController
|
||||
import eu.kanade.tachiyomi.ui.category.CategoryController
|
||||
import eu.kanade.tachiyomi.ui.category.genre.SortTagController
|
||||
import eu.kanade.tachiyomi.util.preference.bindTo
|
||||
import eu.kanade.tachiyomi.util.preference.defaultValue
|
||||
import eu.kanade.tachiyomi.util.preference.entriesRes
|
||||
import eu.kanade.tachiyomi.util.preference.intListPreference
|
||||
import eu.kanade.tachiyomi.util.preference.listPreference
|
||||
@ -58,6 +58,10 @@ class SettingsLibraryController : SettingsController() {
|
||||
private val resetCategoryFlags: ResetCategoryFlags by injectLazy()
|
||||
private val libraryPreferences: LibraryPreferences by injectLazy()
|
||||
|
||||
// SY -->
|
||||
private val unsortedPreferences: UnsortedPreferences by injectLazy()
|
||||
// SY <--
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
||||
titleRes = R.string.pref_category_library
|
||||
|
||||
@ -324,14 +328,14 @@ class SettingsLibraryController : SettingsController() {
|
||||
}
|
||||
}
|
||||
|
||||
if (preferences.skipPreMigration().get() || preferences.migrationSources().get()
|
||||
if (unsortedPreferences.skipPreMigration().get() || unsortedPreferences.migrationSources().get()
|
||||
.isNotEmpty()
|
||||
) {
|
||||
preferenceCategory {
|
||||
titleRes = R.string.migration
|
||||
|
||||
switchPreference {
|
||||
bindTo(preferences.skipPreMigration())
|
||||
bindTo(unsortedPreferences.skipPreMigration())
|
||||
titleRes = R.string.skip_pre_migration
|
||||
summaryRes = R.string.pref_skip_pre_migration_summary
|
||||
}
|
||||
|
@ -13,11 +13,11 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.graphics.vector.rememberVectorPainter
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.presentation.more.settings.SettingsMainScreen
|
||||
import eu.kanade.presentation.more.settings.SettingsSection
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.base.controller.BasicFullComposeController
|
||||
import eu.kanade.tachiyomi.ui.base.controller.pushController
|
||||
import eu.kanade.tachiyomi.ui.setting.search.SettingsSearchController
|
||||
@ -26,7 +26,7 @@ import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class SettingsMainController : BasicFullComposeController() {
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferences: UnsortedPreferences by injectLazy()
|
||||
|
||||
// SY -->
|
||||
private val sourcePreferences: SourcePreferences by injectLazy()
|
||||
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.setting
|
||||
|
||||
import androidx.preference.PreferenceScreen
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateService
|
||||
@ -23,8 +24,9 @@ class SettingsMangaDexController :
|
||||
MangadexLoginDialog.Listener,
|
||||
MangadexLogoutDialog.Listener {
|
||||
|
||||
private val mdex by lazy { MdUtil.getEnabledMangaDex(preferences) }
|
||||
private val sourcePreferences: SourcePreferences by injectLazy()
|
||||
private val unsortedPreferences: UnsortedPreferences by injectLazy()
|
||||
private val mdex by lazy { MdUtil.getEnabledMangaDex(unsortedPreferences, sourcePreferences) }
|
||||
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = screen.apply {
|
||||
titleRes = R.string.mangadex_specific_settings
|
||||
@ -48,7 +50,7 @@ class SettingsMangaDexController :
|
||||
addPreference(sourcePreference)
|
||||
|
||||
listPreference {
|
||||
bindTo(preferences.preferredMangaDexId())
|
||||
bindTo(unsortedPreferences.preferredMangaDexId())
|
||||
titleRes = R.string.mangadex_preffered_source
|
||||
summaryRes = R.string.mangadex_preffered_source_summary
|
||||
val mangaDexs = MdUtil.getEnabledMangaDexs(sourcePreferences)
|
||||
@ -78,7 +80,7 @@ class SettingsMangaDexController :
|
||||
selection[which] = selected
|
||||
}
|
||||
.setPositiveButton(android.R.string.ok) { _, _ ->
|
||||
preferences.mangadexSyncToLibraryIndexes().set(
|
||||
unsortedPreferences.mangadexSyncToLibraryIndexes().set(
|
||||
items.filterIndexed { index, _ -> selection[index] }
|
||||
.mapIndexed { index, _ -> (index + 1).toString() }
|
||||
.toSet(),
|
||||
|
@ -7,8 +7,8 @@ import android.widget.ScrollView
|
||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
import com.bluelinelabs.conductor.ControllerChangeType
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.EhDialogCategoriesBinding
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsEhController
|
||||
@ -21,7 +21,7 @@ class FrontPageCategoriesDialog(
|
||||
var binding: EhDialogCategoriesBinding? = null
|
||||
private set
|
||||
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
val preferences: UnsortedPreferences by injectLazy()
|
||||
|
||||
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
||||
binding = EhDialogCategoriesBinding.inflate(LayoutInflater.from(activity!!))
|
||||
@ -80,7 +80,7 @@ class FrontPageCategoriesDialog(
|
||||
)
|
||||
}
|
||||
with(targetController as? SettingsEhController ?: return) {
|
||||
preferences.exhSettingsLanguages().reconfigure()
|
||||
unsortedPreferences.exhSettingsLanguages().reconfigure()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,8 @@ import android.widget.ScrollView
|
||||
import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
import com.bluelinelabs.conductor.ControllerChangeType
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.EhDialogLanguagesBinding
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsEhController
|
||||
@ -21,7 +21,7 @@ class LanguagesDialog(
|
||||
var binding: EhDialogLanguagesBinding? = null
|
||||
private set
|
||||
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
val preferences: UnsortedPreferences by injectLazy()
|
||||
|
||||
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
||||
binding = EhDialogLanguagesBinding.inflate(LayoutInflater.from(activity!!))
|
||||
@ -170,7 +170,7 @@ class LanguagesDialog(
|
||||
preferences.exhSettingsLanguages().set(languages)
|
||||
|
||||
with(targetController as? SettingsEhController ?: return) {
|
||||
preferences.exhSettingsLanguages().reconfigure()
|
||||
unsortedPreferences.exhSettingsLanguages().reconfigure()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@ import androidx.preference.PreferenceGroup
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.preference.forEach
|
||||
import androidx.preference.get
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsAdvancedController
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsAppearanceController
|
||||
import eu.kanade.tachiyomi.ui.setting.SettingsBackupController
|
||||
@ -52,7 +52,7 @@ object SettingsSearchHelper {
|
||||
SettingsSecurityController::class,
|
||||
SettingsTrackingController::class,
|
||||
)
|
||||
val preferences = Injekt.get<PreferencesHelper>()
|
||||
val preferences = Injekt.get<UnsortedPreferences>()
|
||||
val sourcePreferences = Injekt.get<SourcePreferences>()
|
||||
if (MdUtil.getEnabledMangaDexs(sourcePreferences).isNotEmpty()) {
|
||||
controllers += SettingsMangaDexController::class
|
||||
|
@ -1,7 +1,7 @@
|
||||
package eu.kanade.tachiyomi.ui.setting.search
|
||||
|
||||
import android.os.Bundle
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
@ -10,7 +10,7 @@ import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
||||
class SettingsSearchPresenter(
|
||||
private val preferences: PreferencesHelper = Injekt.get(),
|
||||
private val preferences: BasePreferences = Injekt.get(),
|
||||
) : BasePresenter<SettingsSearchController>() {
|
||||
|
||||
private val _state: MutableStateFlow<List<SettingsSearchHelper.SettingsSearchResult>> =
|
||||
|
@ -36,9 +36,9 @@ import androidx.core.graphics.green
|
||||
import androidx.core.graphics.red
|
||||
import androidx.core.net.toUri
|
||||
import com.hippo.unifile.UniFile
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.domain.ui.model.TabletUiMode
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate
|
||||
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
|
||||
import eu.kanade.tachiyomi.util.lang.truncateCenter
|
||||
@ -262,11 +262,11 @@ fun Context.isTablet(): Boolean {
|
||||
|
||||
fun Context.prepareTabletUiContext(): Context {
|
||||
val configuration = resources.configuration
|
||||
val expected = when (Injekt.get<PreferencesHelper>().tabletUiMode().get()) {
|
||||
PreferenceValues.TabletUiMode.AUTOMATIC -> isTablet()
|
||||
PreferenceValues.TabletUiMode.ALWAYS -> true
|
||||
PreferenceValues.TabletUiMode.LANDSCAPE -> configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||
PreferenceValues.TabletUiMode.NEVER -> false
|
||||
val expected = when (Injekt.get<UiPreferences>().tabletUiMode().get()) {
|
||||
TabletUiMode.AUTOMATIC -> isTablet()
|
||||
TabletUiMode.ALWAYS -> true
|
||||
TabletUiMode.LANDSCAPE -> configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
|
||||
TabletUiMode.NEVER -> false
|
||||
}
|
||||
if (configuration.smallestScreenWidthDp >= TABLET_UI_MIN_SCREEN_WIDTH_DP != expected) {
|
||||
val overrideConf = Configuration()
|
||||
@ -295,7 +295,7 @@ fun Context.isNightMode(): Boolean {
|
||||
* https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:appcompat/appcompat/src/main/java/androidx/appcompat/app/AppCompatDelegateImpl.java;l=348;drc=e28752c96fc3fb4d3354781469a1af3dbded4898
|
||||
*/
|
||||
fun Context.createReaderThemeContext(): Context {
|
||||
val preferences = Injekt.get<PreferencesHelper>()
|
||||
val preferences = Injekt.get<UiPreferences>()
|
||||
val readerPreferences = Injekt.get<ReaderPreferences>()
|
||||
val isDarkBackground = when (readerPreferences.readerTheme().get()) {
|
||||
1, 2 -> true // Black, Gray
|
||||
|
@ -5,8 +5,8 @@ import android.util.AttributeSet
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.appcompat.widget.SearchView
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.util.preference.asHotFlow
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@ -18,7 +18,7 @@ import uy.kohesive.injekt.api.get
|
||||
|
||||
/**
|
||||
* A custom [SearchView] that sets [EditorInfoCompat.IME_FLAG_NO_PERSONALIZED_LEARNING] to imeOptions
|
||||
* if [PreferencesHelper.incognitoMode] is true. Some IMEs may not respect this flag.
|
||||
* if [BasePreferences.incognitoMode] is true. Some IMEs may not respect this flag.
|
||||
*/
|
||||
class TachiyomiSearchView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
@ -31,7 +31,7 @@ class TachiyomiSearchView @JvmOverloads constructor(
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
scope = CoroutineScope(SupervisorJob() + Dispatchers.Main)
|
||||
Injekt.get<PreferencesHelper>().incognitoMode()
|
||||
Injekt.get<BasePreferences>().incognitoMode()
|
||||
.asHotFlow {
|
||||
imeOptions = if (it) {
|
||||
imeOptions or EditorInfoCompat.IME_FLAG_NO_PERSONALIZED_LEARNING
|
||||
|
@ -5,8 +5,8 @@ import android.util.AttributeSet
|
||||
import android.widget.EditText
|
||||
import androidx.core.view.inputmethod.EditorInfoCompat
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.util.preference.asHotFlow
|
||||
import eu.kanade.tachiyomi.widget.TachiyomiTextInputEditText.Companion.setIncognito
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
@ -19,7 +19,7 @@ import uy.kohesive.injekt.api.get
|
||||
|
||||
/**
|
||||
* A custom [TextInputEditText] that sets [EditorInfoCompat.IME_FLAG_NO_PERSONALIZED_LEARNING] to imeOptions
|
||||
* if [PreferencesHelper.incognitoMode] is true. Some IMEs may not respect this flag.
|
||||
* if [BasePreferences.incognitoMode] is true. Some IMEs may not respect this flag.
|
||||
*
|
||||
* @see setIncognito
|
||||
*/
|
||||
@ -46,10 +46,10 @@ class TachiyomiTextInputEditText @JvmOverloads constructor(
|
||||
companion object {
|
||||
/**
|
||||
* Sets Flow to this [EditText] that sets [EditorInfoCompat.IME_FLAG_NO_PERSONALIZED_LEARNING] to imeOptions
|
||||
* if [PreferencesHelper.incognitoMode] is true. Some IMEs may not respect this flag.
|
||||
* if [BasePreferences.incognitoMode] is true. Some IMEs may not respect this flag.
|
||||
*/
|
||||
fun EditText.setIncognito(viewScope: CoroutineScope) {
|
||||
Injekt.get<PreferencesHelper>().incognitoMode()
|
||||
Injekt.get<BasePreferences>().incognitoMode()
|
||||
.asHotFlow {
|
||||
imeOptions = if (it) {
|
||||
imeOptions or EditorInfoCompat.IME_FLAG_NO_PERSONALIZED_LEARNING
|
||||
|
@ -9,8 +9,8 @@ import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
import com.bluelinelabs.conductor.ControllerChangeType
|
||||
import com.dd.processbutton.iml.ActionProcessButton
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.PrefAccountLoginBinding
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
@ -23,7 +23,7 @@ abstract class LoginDialogPreference(
|
||||
var binding: PrefAccountLoginBinding? = null
|
||||
private set
|
||||
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
val preferences: BasePreferences by injectLazy()
|
||||
|
||||
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
||||
binding = PrefAccountLoginBinding.inflate(LayoutInflater.from(activity!!))
|
||||
|
@ -6,8 +6,8 @@ import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceViewHolder
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import eu.kanade.domain.ui.model.AppTheme
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.util.system.dpToPx
|
||||
|
||||
class ThemesPreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
||||
@ -19,7 +19,7 @@ class ThemesPreference @JvmOverloads constructor(context: Context, attrs: Attrib
|
||||
|
||||
var lastScrollPosition: Int? = null
|
||||
|
||||
var entries: List<PreferenceValues.AppTheme> = emptyList()
|
||||
var entries: List<AppTheme> = emptyList()
|
||||
set(value) {
|
||||
field = value
|
||||
adapter.setItems(value)
|
||||
|
@ -5,9 +5,9 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.view.ContextThemeWrapper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.domain.ui.model.AppTheme
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.PrefThemeItemBinding
|
||||
import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate
|
||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||
@ -16,9 +16,9 @@ import uy.kohesive.injekt.injectLazy
|
||||
class ThemesPreferenceAdapter(private val clickListener: OnItemClickListener) :
|
||||
RecyclerView.Adapter<ThemesPreferenceAdapter.ThemeViewHolder>() {
|
||||
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferences: UiPreferences by injectLazy()
|
||||
|
||||
private var themes = emptyList<PreferenceValues.AppTheme>()
|
||||
private var themes = emptyList<AppTheme>()
|
||||
|
||||
private lateinit var binding: PrefThemeItemBinding
|
||||
|
||||
@ -41,7 +41,7 @@ class ThemesPreferenceAdapter(private val clickListener: OnItemClickListener) :
|
||||
holder.bind(themes[position])
|
||||
}
|
||||
|
||||
fun setItems(themes: List<PreferenceValues.AppTheme>) {
|
||||
fun setItems(themes: List<AppTheme>) {
|
||||
this.themes = themes
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
@ -51,7 +51,7 @@ class ThemesPreferenceAdapter(private val clickListener: OnItemClickListener) :
|
||||
private val selectedColor = view.context.getResourceColor(R.attr.colorAccent)
|
||||
private val unselectedColor = view.context.getResourceColor(android.R.attr.divider)
|
||||
|
||||
fun bind(appTheme: PreferenceValues.AppTheme) {
|
||||
fun bind(appTheme: AppTheme) {
|
||||
binding.name.text = view.context.getString(appTheme.titleResId!!)
|
||||
|
||||
// For rounded corners
|
||||
|
@ -9,6 +9,7 @@ import eu.kanade.data.DatabaseHandler
|
||||
import eu.kanade.data.category.categoryMapper
|
||||
import eu.kanade.data.chapter.chapterMapper
|
||||
import eu.kanade.domain.backup.service.BackupPreferences
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.chapter.interactor.DeleteChapters
|
||||
import eu.kanade.domain.chapter.interactor.UpdateChapter
|
||||
import eu.kanade.domain.chapter.model.ChapterUpdate
|
||||
@ -21,14 +22,15 @@ import eu.kanade.domain.manga.model.MangaUpdate
|
||||
import eu.kanade.domain.source.interactor.InsertFeedSavedSearch
|
||||
import eu.kanade.domain.source.interactor.InsertSavedSearch
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
||||
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
|
||||
import eu.kanade.tachiyomi.data.preference.MANGA_NON_COMPLETED
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.data.updater.AppUpdateJob
|
||||
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
|
||||
@ -95,7 +97,9 @@ object EXHMigrations {
|
||||
*/
|
||||
fun upgrade(
|
||||
context: Context,
|
||||
preferences: PreferencesHelper,
|
||||
preferenceStore: PreferenceStore,
|
||||
basePreferences: BasePreferences,
|
||||
uiPreferences: UiPreferences,
|
||||
networkPreferences: NetworkPreferences,
|
||||
sourcePreferences: SourcePreferences,
|
||||
securityPreferences: SecurityPreferences,
|
||||
@ -103,10 +107,11 @@ object EXHMigrations {
|
||||
readerPreferences: ReaderPreferences,
|
||||
backupPreferences: BackupPreferences,
|
||||
): Boolean {
|
||||
val oldVersion = preferences.ehLastVersionCode().get()
|
||||
val lastVersionCode = preferenceStore.getInt("eh_last_version_code", 0)
|
||||
val oldVersion = lastVersionCode.get()
|
||||
try {
|
||||
if (oldVersion < BuildConfig.VERSION_CODE) {
|
||||
preferences.ehLastVersionCode().set(BuildConfig.VERSION_CODE)
|
||||
lastVersionCode.set(BuildConfig.VERSION_CODE)
|
||||
|
||||
if (BuildConfig.INCLUDE_UPDATER) {
|
||||
AppUpdateJob.setupTask(context)
|
||||
@ -363,8 +368,8 @@ object EXHMigrations {
|
||||
if (oldSecureScreen) {
|
||||
securityPreferences.secureScreen().set(SecurityPreferences.SecureScreenMode.ALWAYS)
|
||||
}
|
||||
if (DeviceUtil.isMiui && preferences.extensionInstaller().get() == PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER) {
|
||||
preferences.extensionInstaller().set(PreferenceValues.ExtensionInstaller.LEGACY)
|
||||
if (DeviceUtil.isMiui && basePreferences.extensionInstaller().get() == PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER) {
|
||||
basePreferences.extensionInstaller().set(PreferenceValues.ExtensionInstaller.LEGACY)
|
||||
}
|
||||
}
|
||||
if (oldVersion under 28) {
|
||||
@ -492,6 +497,14 @@ object EXHMigrations {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (oldVersion under 42) {
|
||||
if (uiPreferences.themeMode().isSet()) {
|
||||
prefs.edit {
|
||||
val themeMode = prefs.getString(uiPreferences.themeMode().key(), null) ?: return@edit
|
||||
putString(uiPreferences.themeMode().key(), themeMode.uppercase())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (oldVersion under 1) { } (1 is current release version)
|
||||
// do stuff here when releasing changed crap
|
||||
|
@ -4,6 +4,7 @@ import android.app.Application
|
||||
import androidx.work.WorkManager
|
||||
import eu.kanade.data.DatabaseHandler
|
||||
import eu.kanade.domain.backup.service.BackupPreferences
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.library.service.LibraryPreferences
|
||||
import eu.kanade.domain.manga.interactor.GetAllManga
|
||||
import eu.kanade.domain.manga.interactor.GetExhFavoriteMangaWithMetadata
|
||||
@ -13,8 +14,9 @@ import eu.kanade.domain.manga.interactor.GetSearchMetadata
|
||||
import eu.kanade.domain.manga.interactor.InsertFlatMetadata
|
||||
import eu.kanade.domain.manga.interactor.UpdateManga
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.domain.ui.UiPreferences
|
||||
import eu.kanade.tachiyomi.core.preference.PreferenceStore
|
||||
import eu.kanade.tachiyomi.core.security.SecurityPreferences
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.network.NetworkPreferences
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.online.all.NHentai
|
||||
@ -35,7 +37,9 @@ import java.util.UUID
|
||||
object DebugFunctions {
|
||||
val app: Application by injectLazy()
|
||||
val handler: DatabaseHandler by injectLazy()
|
||||
val prefs: PreferencesHelper by injectLazy()
|
||||
val prefsStore: PreferenceStore by injectLazy()
|
||||
val basePrefs: BasePreferences by injectLazy()
|
||||
val uiPrefs: UiPreferences by injectLazy()
|
||||
val networkPrefs: NetworkPreferences by injectLazy()
|
||||
val sourcePrefs: SourcePreferences by injectLazy()
|
||||
val securityPrefs: SecurityPreferences by injectLazy()
|
||||
@ -52,13 +56,15 @@ object DebugFunctions {
|
||||
val getAllManga: GetAllManga by injectLazy()
|
||||
|
||||
fun forceUpgradeMigration() {
|
||||
prefs.ehLastVersionCode().set(1)
|
||||
EXHMigrations.upgrade(app, prefs, networkPrefs, sourcePrefs, securityPrefs, libraryPrefs, readerPrefs, backupPrefs)
|
||||
val lastVersionCode = prefsStore.getInt("eh_last_version_code", 0)
|
||||
lastVersionCode.set(1)
|
||||
EXHMigrations.upgrade(app, prefsStore, basePrefs, uiPrefs, networkPrefs, sourcePrefs, securityPrefs, libraryPrefs, readerPrefs, backupPrefs)
|
||||
}
|
||||
|
||||
fun forceSetupJobs() {
|
||||
prefs.ehLastVersionCode().set(0)
|
||||
EXHMigrations.upgrade(app, prefs, networkPrefs, sourcePrefs, securityPrefs, libraryPrefs, readerPrefs, backupPrefs)
|
||||
val lastVersionCode = prefsStore.getInt("eh_last_version_code", 0)
|
||||
lastVersionCode.set(0)
|
||||
EXHMigrations.upgrade(app, prefsStore, basePrefs, uiPrefs, networkPrefs, sourcePrefs, securityPrefs, libraryPrefs, readerPrefs, backupPrefs)
|
||||
}
|
||||
|
||||
fun resetAgedFlagInEXHManga() {
|
||||
|
@ -11,6 +11,7 @@ import androidx.work.WorkManager
|
||||
import androidx.work.WorkerParameters
|
||||
import com.elvishew.xlog.Logger
|
||||
import com.elvishew.xlog.XLog
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.chapter.interactor.GetChapterByMangaId
|
||||
import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource
|
||||
import eu.kanade.domain.chapter.model.Chapter
|
||||
@ -22,7 +23,6 @@ import eu.kanade.domain.manga.model.Manga
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateNotifier
|
||||
import eu.kanade.tachiyomi.data.preference.DEVICE_CHARGING
|
||||
import eu.kanade.tachiyomi.data.preference.DEVICE_ONLY_ON_WIFI
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.online.all.EHentai
|
||||
import eu.kanade.tachiyomi.util.system.isConnectedToWifi
|
||||
@ -45,7 +45,7 @@ import kotlin.time.Duration.Companion.days
|
||||
|
||||
class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerParameters) :
|
||||
CoroutineWorker(context, workerParams) {
|
||||
private val prefs: PreferencesHelper by injectLazy()
|
||||
private val preferences: UnsortedPreferences by injectLazy()
|
||||
private val sourceManager: SourceManager by injectLazy()
|
||||
private val updateHelper: EHentaiUpdateHelper by injectLazy()
|
||||
private val logger: Logger = xLog()
|
||||
@ -60,7 +60,6 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
|
||||
|
||||
override suspend fun doWork(): Result {
|
||||
return try {
|
||||
val preferences = Injekt.get<PreferencesHelper>()
|
||||
if (requiresWifiConnection(preferences) && !context.isConnectedToWifi()) {
|
||||
Result.failure()
|
||||
} else {
|
||||
@ -179,7 +178,7 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
|
||||
updatedThisIteration++
|
||||
}
|
||||
} finally {
|
||||
prefs.exhAutoUpdateStats().set(
|
||||
preferences.exhAutoUpdateStats().set(
|
||||
Json.encodeToString(
|
||||
EHentaiUpdaterStats(
|
||||
startTime,
|
||||
@ -237,7 +236,7 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
|
||||
}
|
||||
|
||||
fun scheduleBackground(context: Context, prefInterval: Int? = null) {
|
||||
val preferences = Injekt.get<PreferencesHelper>()
|
||||
val preferences = Injekt.get<UnsortedPreferences>()
|
||||
val interval = prefInterval ?: preferences.exhAutoUpdateFrequency().get()
|
||||
if (interval > 0) {
|
||||
val restrictions = preferences.exhAutoUpdateRequirements().get()
|
||||
@ -270,7 +269,7 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
|
||||
}
|
||||
}
|
||||
|
||||
fun requiresWifiConnection(preferences: PreferencesHelper): Boolean {
|
||||
fun requiresWifiConnection(preferences: UnsortedPreferences): Boolean {
|
||||
val restrictions = preferences.exhAutoUpdateRequirements().get()
|
||||
return DEVICE_ONLY_ON_WIFI in restrictions
|
||||
}
|
||||
|
@ -3,12 +3,12 @@ package exh.favorites
|
||||
import android.content.Context
|
||||
import androidx.core.text.HtmlCompat
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class FavoritesIntroDialog {
|
||||
private val prefs: PreferencesHelper by injectLazy()
|
||||
private val prefs: UnsortedPreferences by injectLazy()
|
||||
|
||||
fun show(context: Context) = MaterialAlertDialogBuilder(context)
|
||||
.setTitle(R.string.favorites_sync_notes)
|
||||
|
@ -3,6 +3,7 @@ package exh.favorites
|
||||
import android.content.Context
|
||||
import android.net.wifi.WifiManager
|
||||
import android.os.PowerManager
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.category.interactor.CreateCategoryWithName
|
||||
import eu.kanade.domain.category.interactor.GetCategories
|
||||
import eu.kanade.domain.category.interactor.SetMangaCategories
|
||||
@ -15,7 +16,6 @@ import eu.kanade.domain.manga.interactor.UpdateManga
|
||||
import eu.kanade.domain.manga.model.Manga
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.toDomainManga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.network.POST
|
||||
import eu.kanade.tachiyomi.network.await
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
@ -56,7 +56,7 @@ class FavoritesSyncHelper(val context: Context) {
|
||||
private val createCategoryWithName: CreateCategoryWithName by injectLazy()
|
||||
private val updateCategory: UpdateCategory by injectLazy()
|
||||
|
||||
private val prefs: PreferencesHelper by injectLazy()
|
||||
private val prefs: UnsortedPreferences by injectLazy()
|
||||
|
||||
private val exh by lazy {
|
||||
Injekt.get<SourceManager>().get(EXH_SOURCE_ID) as? EHentai
|
||||
|
@ -1,8 +1,8 @@
|
||||
package exh.md.utils
|
||||
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.domain.source.service.SourcePreferences
|
||||
import eu.kanade.domain.track.service.TrackPreferences
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.mdlist.MdList
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
@ -339,7 +339,7 @@ class MdUtil {
|
||||
"Bearer " + (sessionToken(preferences, mdList) ?: throw NoSessionException()),
|
||||
).build()
|
||||
|
||||
fun getEnabledMangaDex(preferences: PreferencesHelper, sourcePreferences: SourcePreferences = Injekt.get(), sourceManager: SourceManager = Injekt.get()): MangaDex? {
|
||||
fun getEnabledMangaDex(preferences: UnsortedPreferences, sourcePreferences: SourcePreferences = Injekt.get(), sourceManager: SourceManager = Injekt.get()): MangaDex? {
|
||||
return getEnabledMangaDexs(sourcePreferences, sourceManager).let { mangadexs ->
|
||||
preferences.preferredMangaDexId().get().toLongOrNull()?.nullIfZero()
|
||||
?.let { preferredMangaDexId ->
|
||||
|
@ -1,6 +1,6 @@
|
||||
package exh.patch
|
||||
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
@ -20,7 +20,7 @@ fun OkHttpClient.Builder.injectPatches(sourceIdProducer: () -> Long): OkHttpClie
|
||||
|
||||
fun findAndApplyPatches(sourceId: Long): EHInterceptor {
|
||||
// TODO make it so captcha doesnt auto open in manga eden while applying universal interceptors
|
||||
return if (Injekt.get<PreferencesHelper>().autoSolveCaptcha().get()) {
|
||||
return if (Injekt.get<UnsortedPreferences>().autoSolveCaptcha().get()) {
|
||||
(EH_INTERCEPTORS[sourceId].orEmpty() + EH_INTERCEPTORS[EH_UNIVERSAL_INTERCEPTOR].orEmpty()).merge()
|
||||
} else {
|
||||
EH_INTERCEPTORS[sourceId].orEmpty().merge()
|
||||
|
@ -1,8 +1,8 @@
|
||||
package exh.uconfig
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.network.await
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.online.all.EHentai
|
||||
@ -18,7 +18,7 @@ import uy.kohesive.injekt.injectLazy
|
||||
import java.util.Locale
|
||||
|
||||
class EHConfigurator(val context: Context) {
|
||||
private val prefs: PreferencesHelper by injectLazy()
|
||||
private val prefs: UnsortedPreferences by injectLazy()
|
||||
private val sources: SourceManager by injectLazy()
|
||||
|
||||
private val configuratorClient = OkHttpClient.Builder()
|
||||
|
@ -1,12 +1,12 @@
|
||||
package exh.uconfig
|
||||
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import okhttp3.FormBody
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.Locale
|
||||
|
||||
class EhUConfigBuilder {
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
private val preferences: UnsortedPreferences by injectLazy()
|
||||
|
||||
fun build(hathPerks: EHHathPerksResponse): FormBody {
|
||||
val configItems = mutableListOf<ConfigItem>()
|
||||
|
@ -4,15 +4,15 @@ import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import com.bluelinelabs.conductor.Router
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.base.controller.DialogController
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class WarnConfigureDialogController : DialogController() {
|
||||
private val prefs: PreferencesHelper by injectLazy()
|
||||
private val prefs: UnsortedPreferences by injectLazy()
|
||||
override fun onCreateDialog(savedViewState: Bundle?): Dialog {
|
||||
return MaterialAlertDialogBuilder(activity!!)
|
||||
.setTitle(R.string.settings_profile_note)
|
||||
@ -27,7 +27,7 @@ class WarnConfigureDialogController : DialogController() {
|
||||
|
||||
companion object {
|
||||
fun uploadSettings(router: Router) {
|
||||
if (Injekt.get<PreferencesHelper>().exhShowSettingsUploadWarning().get()) {
|
||||
if (Injekt.get<UnsortedPreferences>().exhShowSettingsUploadWarning().get()) {
|
||||
WarnConfigureDialogController().showDialog(router)
|
||||
} else {
|
||||
ConfiguringDialogController().showDialog(router)
|
||||
|
@ -1,13 +1,13 @@
|
||||
package exh.ui.batchadd
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter
|
||||
import eu.kanade.tachiyomi.util.lang.withIOContext
|
||||
import exh.GalleryAddEvent
|
||||
import exh.GalleryAdder
|
||||
import exh.log.xLogE
|
||||
import exh.ui.base.CoroutinePresenter
|
||||
import exh.util.trimOrNull
|
||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@ -17,8 +17,8 @@ import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
class BatchAddPresenter : CoroutinePresenter<BatchAddController>() {
|
||||
private val preferences: PreferencesHelper by injectLazy()
|
||||
class BatchAddPresenter : BasePresenter<BatchAddController>() {
|
||||
private val preferences: UnsortedPreferences by injectLazy()
|
||||
|
||||
private val galleryAdder by lazy { GalleryAdder() }
|
||||
|
||||
|
@ -12,8 +12,8 @@ import android.webkit.WebChromeClient
|
||||
import android.webkit.WebView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.EhActivityCaptchaBinding
|
||||
import eu.kanade.tachiyomi.network.NetworkHelper
|
||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||
@ -48,7 +48,7 @@ import java.util.UUID
|
||||
|
||||
class BrowserActionActivity : AppCompatActivity() {
|
||||
private val sourceManager: SourceManager by injectLazy()
|
||||
private val preferencesHelper: PreferencesHelper by injectLazy()
|
||||
private val preferencesHelper: UnsortedPreferences by injectLazy()
|
||||
private val networkHelper: NetworkHelper by injectLazy()
|
||||
|
||||
val httpClient = networkHelper.client
|
||||
|
@ -8,9 +8,9 @@ import android.webkit.CookieManager
|
||||
import android.webkit.WebView
|
||||
import android.widget.Toast
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.presentation.webview.EhLoginWebViewScreen
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.ui.base.activity.BaseActivity
|
||||
import eu.kanade.tachiyomi.util.system.WebViewUtil
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
@ -25,7 +25,7 @@ import java.util.Locale
|
||||
* LoginController
|
||||
*/
|
||||
class EhLoginActivity : BaseActivity() {
|
||||
private val preferenceManager: PreferencesHelper by injectLazy()
|
||||
private val preferenceManager: UnsortedPreferences by injectLazy()
|
||||
|
||||
private var igneous: String? = null
|
||||
|
||||
|
@ -9,8 +9,8 @@ import com.bluelinelabs.conductor.ControllerChangeHandler
|
||||
import com.bluelinelabs.conductor.ControllerChangeType
|
||||
import com.dd.processbutton.iml.ActionProcessButton
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import eu.kanade.domain.UnsortedPreferences
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.databinding.PrefSiteLoginTwoFactorAuthBinding
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
@ -34,7 +34,7 @@ class MangadexLoginDialog(bundle: Bundle? = null) : DialogController(bundle) {
|
||||
|
||||
val source = Injekt.get<SourceManager>().get(args.getLong("key", 0))?.getMainSource() as LoginSource
|
||||
|
||||
val preferences: PreferencesHelper by injectLazy()
|
||||
val preferences: UnsortedPreferences by injectLazy()
|
||||
|
||||
val scope = CoroutineScope(Job() + Dispatchers.Main)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user