From 98b94d62cfb99f71d0651a9ec9a79df409148b33 Mon Sep 17 00:00:00 2001 From: Luke De Feo Date: Wed, 3 May 2023 07:51:29 -0700 Subject: [PATCH] Add bloks integration infra + Layout result wrapper Summary: This adds the base infra for the UIDebugger bloks integration as well as an implementation for the Layout result wrapper for bloks. When theUIDebugger is connected we wrap the original layout result with a debug varient that delegates all methods to the original layout result but also provides access to the bloks model. This allows the UIDebugger to inspect the Layout result and bloks model together Reviewed By: pasqualeanatriello Differential Revision: D43444444 fbshipit-source-id: ac531a0c7491c05db1d6f7671e3ab09c73c213b9 --- .../flipper/plugins/uidebugger/UIDebuggerFlipperPlugin.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/UIDebuggerFlipperPlugin.kt b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/UIDebuggerFlipperPlugin.kt index 791f3fed5..94d3fcb19 100644 --- a/android/src/main/java/com/facebook/flipper/plugins/uidebugger/UIDebuggerFlipperPlugin.kt +++ b/android/src/main/java/com/facebook/flipper/plugins/uidebugger/UIDebuggerFlipperPlugin.kt @@ -31,6 +31,8 @@ class UIDebuggerFlipperPlugin(val context: UIDContext) : FlipperPlugin { @Throws(Exception::class) override fun onConnect(connection: FlipperConnection) { + isConnected = true + Log.i(LogTag, "Connected") this.context.connectionRef.connection = connection this.context.bitmapPool.makeReady() @@ -54,6 +56,7 @@ class UIDebuggerFlipperPlugin(val context: UIDContext) : FlipperPlugin { @Throws(Exception::class) override fun onDisconnect() { + isConnected = false this.context.connectionRef.connection = null Log.i(LogTag, "Disconnected") @@ -66,4 +69,9 @@ class UIDebuggerFlipperPlugin(val context: UIDContext) : FlipperPlugin { override fun runInBackground(): Boolean { return false } + + companion object { + var isConnected: Boolean = false + private set + } }