Replace DebugOverlay library with a custom composable
This commit is contained in:
@@ -8,7 +8,6 @@ import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.os.Looper
|
||||
@@ -36,8 +35,6 @@ import com.elvishew.xlog.printer.file.clean.FileLastModifiedCleanStrategy
|
||||
import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator
|
||||
import com.google.firebase.analytics.ktx.analytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.ms_square.debugoverlay.DebugOverlay
|
||||
import com.ms_square.debugoverlay.modules.FpsModule
|
||||
import eu.kanade.data.DatabaseHandler
|
||||
import eu.kanade.domain.DomainModule
|
||||
import eu.kanade.domain.SYDomainModule
|
||||
@@ -63,14 +60,11 @@ import eu.kanade.tachiyomi.util.system.animatorDurationScale
|
||||
import eu.kanade.tachiyomi.util.system.isPreviewBuildType
|
||||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import eu.kanade.tachiyomi.util.system.notification
|
||||
import exh.debug.DebugToggles
|
||||
import exh.log.CrashlyticsPrinter
|
||||
import exh.log.EHDebugModeOverlay
|
||||
import exh.log.EHLogLevel
|
||||
import exh.log.EnhancedFilePrinter
|
||||
import exh.log.XLogLogcatLogger
|
||||
import exh.log.xLogD
|
||||
import exh.log.xLogE
|
||||
import exh.syDebugVersion
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
@@ -126,9 +120,6 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
// SY <--
|
||||
|
||||
setupNotificationChannels()
|
||||
if ((BuildConfig.DEBUG || BuildConfig.BUILD_TYPE == "releaseTest") && DebugToggles.ENABLE_DEBUG_OVERLAY.enabled) {
|
||||
setupDebugOverlay()
|
||||
}
|
||||
|
||||
ProcessLifecycleOwner.get().lifecycle.addObserver(this)
|
||||
|
||||
@@ -327,22 +318,6 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
|
||||
)
|
||||
}
|
||||
|
||||
// EXH
|
||||
private fun setupDebugOverlay() {
|
||||
try {
|
||||
DebugOverlay.Builder(this)
|
||||
.modules(FpsModule(), EHDebugModeOverlay(this))
|
||||
.bgColor(Color.parseColor("#7F000000"))
|
||||
.notification(false)
|
||||
.allowSystemLayer(false)
|
||||
.build()
|
||||
.install()
|
||||
} catch (e: IllegalStateException) {
|
||||
// Crashes if app is in background
|
||||
xLogE("Failed to initialize debug overlay, app in background?", e)
|
||||
}
|
||||
}
|
||||
|
||||
private inner class DisableIncognitoReceiver : BroadcastReceiver() {
|
||||
private var registered = false
|
||||
|
||||
|
||||
@@ -65,7 +65,9 @@ import eu.kanade.tachiyomi.util.system.toast
|
||||
import eu.kanade.tachiyomi.util.view.setComposeContent
|
||||
import eu.kanade.tachiyomi.util.view.setNavigationBarTransparentCompat
|
||||
import exh.EXHMigrations
|
||||
import exh.debug.DebugToggles
|
||||
import exh.eh.EHentaiUpdateWorker
|
||||
import exh.log.DebugModeOverlay
|
||||
import exh.source.BlacklistedSources
|
||||
import exh.source.EH_SOURCE_ID
|
||||
import exh.source.EXH_SOURCE_ID
|
||||
@@ -162,6 +164,9 @@ class MainActivity : BaseActivity() {
|
||||
return
|
||||
}
|
||||
|
||||
@Suppress("KotlinConstantConditions")
|
||||
val hasDebugOverlay = (BuildConfig.DEBUG || BuildConfig.BUILD_TYPE == "releaseTest")
|
||||
|
||||
// Draw edge-to-edge
|
||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||
|
||||
@@ -206,6 +211,15 @@ class MainActivity : BaseActivity() {
|
||||
CheckForUpdate()
|
||||
}
|
||||
|
||||
if (hasDebugOverlay) {
|
||||
val isDebugOverlayEnabled by remember {
|
||||
DebugToggles.ENABLE_DEBUG_OVERLAY.asPref(lifecycleScope)
|
||||
}
|
||||
if (isDebugOverlayEnabled) {
|
||||
DebugModeOverlay()
|
||||
}
|
||||
}
|
||||
|
||||
var showChangelog by remember { mutableStateOf(didMigration && !BuildConfig.DEBUG) }
|
||||
if (showChangelog) {
|
||||
// SY -->
|
||||
|
||||
Reference in New Issue
Block a user