Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ public object DebugPanel {
public fun initialize(
application: Application,
plugins: List<Plugin>,
config: DebugPanelConfig = DebugPanelConfig.defaultConfig
) {
createDebugPanelInstance(application, plugins)
ApplicationLifecycleHandler(application, config.shakerMode).start()
ApplicationLifecycleHandler(application).start()
}

public fun subscribeToEvents(lifecycleOwner: LifecycleOwner, onEvent: (DebugEvent) -> Unit) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,18 @@ import android.content.BroadcastReceiver
import android.content.IntentFilter
import androidx.activity.ComponentActivity
import androidx.core.content.ContextCompat
import com.redmadrobot.debug.core.inapp.shake.ShakeController
import timber.log.Timber

internal class ApplicationLifecycleHandler(
private val application: Application,
private val shakerMode: Boolean,
) {
// open Activity counter
private var openActivityCount = 0

private var shakeController: ShakeController? = null
private var debugPanelBroadcastReceiver: BroadcastReceiver? = null
private val debugPanelNotification = DebugPanelNotification(application.applicationContext)

fun start() {
if (shakerMode) {
shakeController = ShakeController(application.applicationContext)
}
registerActivityLifecycleCallback()
}

Expand All @@ -34,8 +28,6 @@ internal class ApplicationLifecycleHandler(
if (openActivityCount == 0) onAppResumed()
++openActivityCount

shakeController?.register(activity)

// register BroadcastReceiver for debug panel inner actions
debugPanelBroadcastReceiver = DebugPanelBroadcastReceiver(activity)
val filter = IntentFilter(DebugPanelBroadcastReceiver.ACTION_OPEN_DEBUG_PANEL)
Expand All @@ -61,7 +53,6 @@ internal class ApplicationLifecycleHandler(

private fun onAppPaused() {
debugPanelNotification.hide()
shakeController?.unregister()
}

private fun onAppResumed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ object DebugPanel {
fun initialize(
application: Application,
plugins: List<Any>,
config: DebugPanelConfig = DebugPanelConfig.defaultConfig
) = Unit

fun subscribeToEvents(lifecycleOwner: LifecycleOwner, onEvent: (DebugEvent) -> Unit) = Unit
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions sample/src/main/kotlin/com/redmadrobot/debug_sample/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.redmadrobot.debug_sample

import android.app.Application
import com.redmadrobot.debug.core.DebugPanel
import com.redmadrobot.debug.core.DebugPanelConfig
import com.redmadrobot.debug.plugin.aboutapp.AboutAppPlugin
import com.redmadrobot.debug.plugin.konfeature.KonfeatureDebugPanelInterceptor
import com.redmadrobot.debug.plugin.konfeature.KonfeaturePlugin
Expand All @@ -19,7 +18,6 @@ class App : Application() {

DebugPanel.initialize(
application = this,
config = DebugPanelConfig(shakerMode = false),
plugins = listOf(
ServersPlugin(
preInstalledServers = DebugServersProvider().provideData()
Expand Down
Loading