2019-08-05 03:27:59 +02:00
|
|
|
package exh.debug
|
|
|
|
|
|
2023-02-26 22:47:29 +01:00
|
|
|
import eu.kanade.core.preference.PreferenceMutableState
|
2022-05-09 03:09:02 +02:00
|
|
|
import kotlinx.coroutines.CoroutineScope
|
2023-01-28 04:31:12 +01:00
|
|
|
import tachiyomi.core.preference.PreferenceStore
|
2019-08-05 03:27:59 +02:00
|
|
|
import uy.kohesive.injekt.injectLazy
|
2020-11-11 23:30:38 +01:00
|
|
|
import java.util.Locale
|
2019-08-05 03:27:59 +02:00
|
|
|
|
|
|
|
|
enum class DebugToggles(val default: Boolean) {
|
2019-08-13 06:04:02 +02:00
|
|
|
// Redirect to master version of gallery when encountering a gallery that has a parent/child that is already in the library
|
2019-08-05 03:27:59 +02:00
|
|
|
ENABLE_EXH_ROOT_REDIRECT(true),
|
2020-12-12 18:36:29 +01:00
|
|
|
|
2019-08-13 06:04:02 +02:00
|
|
|
// Enable debug overlay (only available in debug builds)
|
2019-08-05 03:27:59 +02:00
|
|
|
ENABLE_DEBUG_OVERLAY(true),
|
2020-12-12 18:36:29 +01:00
|
|
|
|
2019-08-13 06:04:02 +02:00
|
|
|
// Convert non-root galleries into root galleries when loading them
|
2019-08-05 04:55:38 +02:00
|
|
|
PULL_TO_ROOT_WHEN_LOADING_EXH_MANGA_DETAILS(true),
|
2020-12-12 18:36:29 +01:00
|
|
|
|
2019-08-13 06:04:02 +02:00
|
|
|
// Do not update the same gallery too often
|
|
|
|
|
RESTRICT_EXH_GALLERY_UPDATE_CHECK_FREQUENCY(true),
|
2020-12-12 18:36:29 +01:00
|
|
|
|
2019-08-13 06:04:02 +02:00
|
|
|
// Pretend that all galleries only have a single version
|
2022-09-12 01:43:45 +02:00
|
|
|
INCLUDE_ONLY_ROOT_WHEN_LOADING_EXH_VERSIONS(false),
|
|
|
|
|
;
|
2019-08-05 03:27:59 +02:00
|
|
|
|
2022-05-09 03:09:02 +02:00
|
|
|
private val prefKey = "eh_debug_toggle_${name.lowercase(Locale.US)}"
|
2019-08-05 03:27:59 +02:00
|
|
|
|
|
|
|
|
var enabled: Boolean
|
2022-09-17 17:48:24 +02:00
|
|
|
get() = preferenceStore.getBoolean(prefKey, default).get()
|
2019-08-05 03:27:59 +02:00
|
|
|
set(value) {
|
2022-09-17 17:48:24 +02:00
|
|
|
preferenceStore.getBoolean(prefKey).set(value)
|
2019-08-05 03:27:59 +02:00
|
|
|
}
|
|
|
|
|
|
2022-09-17 17:48:24 +02:00
|
|
|
fun asPref(scope: CoroutineScope) = PreferenceMutableState(preferenceStore.getBoolean(prefKey, default), scope)
|
2022-05-09 03:09:02 +02:00
|
|
|
|
2019-08-05 03:27:59 +02:00
|
|
|
companion object {
|
2022-09-17 17:48:24 +02:00
|
|
|
private val preferenceStore: PreferenceStore by injectLazy()
|
2019-08-05 03:27:59 +02:00
|
|
|
}
|
2020-04-04 22:30:05 +02:00
|
|
|
}
|