Send warning when bloks tree not prepared
Summary: Give the user something actionable when tree is not ready due to flipper connected check failing Reviewed By: lblasa Differential Revision: D49455254 fbshipit-source-id: 8869cacde5b65260f4615f5ba2ba34f967d7d27f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a033f96725
commit
c3ad4f7180
@@ -27,6 +27,7 @@ class DescriptorRegister {
|
|||||||
fun withDefaults(): DescriptorRegister {
|
fun withDefaults(): DescriptorRegister {
|
||||||
val mapping = DescriptorRegister()
|
val mapping = DescriptorRegister()
|
||||||
mapping.register(Any::class.java, ObjectDescriptor)
|
mapping.register(Any::class.java, ObjectDescriptor)
|
||||||
|
mapping.register(WarningMessage::class.java, WarningMessageDescriptor)
|
||||||
mapping.register(ApplicationRef::class.java, ApplicationRefDescriptor)
|
mapping.register(ApplicationRef::class.java, ApplicationRefDescriptor)
|
||||||
mapping.register(Activity::class.java, ActivityDescriptor)
|
mapping.register(Activity::class.java, ActivityDescriptor)
|
||||||
mapping.register(Window::class.java, WindowDescriptor)
|
mapping.register(Window::class.java, WindowDescriptor)
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.flipper.plugins.uidebugger.descriptors
|
||||||
|
|
||||||
|
import com.facebook.flipper.plugins.uidebugger.model.Bounds
|
||||||
|
import com.facebook.flipper.plugins.uidebugger.model.InspectableObject
|
||||||
|
import com.facebook.flipper.plugins.uidebugger.model.MetadataId
|
||||||
|
import com.facebook.flipper.plugins.uidebugger.util.Immediate
|
||||||
|
import com.facebook.flipper.plugins.uidebugger.util.MaybeDeferred
|
||||||
|
import com.facebook.flipper.plugins.uidebugger.util.objectIdentity
|
||||||
|
|
||||||
|
data class WarningMessage(val message: String, val parentBounds: Bounds)
|
||||||
|
|
||||||
|
object WarningMessageDescriptor : NodeDescriptor<WarningMessage> {
|
||||||
|
override fun getId(node: WarningMessage): Id = node.message.objectIdentity()
|
||||||
|
|
||||||
|
override fun getBounds(node: WarningMessage): Bounds = node.parentBounds.copy(x = 0, y = 0)
|
||||||
|
|
||||||
|
override fun getName(node: WarningMessage): String = node.message
|
||||||
|
|
||||||
|
override fun getQualifiedName(node: WarningMessage): String = ""
|
||||||
|
|
||||||
|
override fun getChildren(node: WarningMessage): List<Any> = listOf()
|
||||||
|
|
||||||
|
override fun getActiveChild(node: WarningMessage): Any? = null
|
||||||
|
|
||||||
|
override fun getAttributes(
|
||||||
|
node: WarningMessage
|
||||||
|
): MaybeDeferred<Map<MetadataId, InspectableObject>> = Immediate(mapOf())
|
||||||
|
|
||||||
|
override fun getTags(node: WarningMessage): Set<String> = setOf("Warning")
|
||||||
|
}
|
||||||
@@ -16,6 +16,8 @@ data class Bounds(val x: Int, val y: Int, val width: Int, val height: Int) {
|
|||||||
fun fromRect(rect: Rect): Bounds {
|
fun fromRect(rect: Rect): Bounds {
|
||||||
return Bounds(rect.left, rect.top, rect.width(), rect.height())
|
return Bounds(rect.left, rect.top, rect.width(), rect.height())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun zero() = Bounds(0, 0, 0, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user