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 @@ -11,7 +11,7 @@ import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow

internal class DebugPanelInstance constructor(
internal class DebugPanelInstance(
application: Application,
plugins: List<Plugin> = emptyList()
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.redmadrobot.debug.core.DebugPanel
import java.lang.ref.WeakReference

internal class DebugPanelBroadcastReceiver(
private val activity: Activity
) : BroadcastReceiver() {
internal class DebugPanelBroadcastReceiver(activity: Activity) : BroadcastReceiver() {
private val activityReference = WeakReference(activity)

companion object {
const val ACTION_OPEN_DEBUG_PANEL = "com.redmadrobot.debug.core.ACTION_OPEN_DEBUG_PANEL"
}

override fun onReceive(context: Context, intent: Intent) {
if (intent.action == ACTION_OPEN_DEBUG_PANEL) {
DebugPanel.showPanel(activity)
activityReference.get()?.let { DebugPanel.showPanel(it) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ import com.redmadrobot.debug_sample.network.ApiFactory
import com.redmadrobot.debugpanel.databinding.ActivityMainBinding
import com.redmadrobot.flipper.config.FlipperValue
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import okhttp3.ResponseBody
Expand Down Expand Up @@ -146,8 +143,7 @@ class MainActivity : AppCompatActivity() {
.onEach { changedToggles ->
onFlipperTogglesChanged(changedToggles)
}
.flowOn(Dispatchers.Main)
.launchIn(GlobalScope)
.launchIn(lifecycleScope)
}

private fun onFlipperTogglesChanged(changedToggles: Map<String, FlipperValue>) {
Expand Down
Loading