Make metadata tags a map and rename to custom attributes
Summary: This will allow a lot more flexibility and will be essential for making bloks work Reviewed By: lblasa Differential Revision: D44871256 fbshipit-source-id: 59d9fdccea7b18406eac532080e80a69a251267b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
eee74044ff
commit
c2fc54057a
@@ -10,6 +10,7 @@ package com.facebook.flipper.plugins.uidebugger.descriptors
|
||||
import com.facebook.flipper.plugins.uidebugger.model.InspectableValue
|
||||
import com.facebook.flipper.plugins.uidebugger.model.Metadata
|
||||
import com.facebook.flipper.plugins.uidebugger.model.MetadataId
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
|
||||
/**
|
||||
* Registry of attribute metadata. There's two types of attributes:
|
||||
@@ -34,7 +35,8 @@ object MetadataRegister {
|
||||
namespace: String,
|
||||
name: String,
|
||||
mutable: Boolean = false,
|
||||
possibleValues: Set<InspectableValue>? = emptySet()
|
||||
possibleValues: Set<InspectableValue>? = null,
|
||||
customAttributes: Map<String, JsonPrimitive>? = null
|
||||
): MetadataId {
|
||||
val key = key(namespace, name)
|
||||
register[key]?.let { m ->
|
||||
@@ -43,7 +45,8 @@ object MetadataRegister {
|
||||
|
||||
synchronized(lock) {
|
||||
val identifier = ++generator
|
||||
val metadata = Metadata(identifier, type, namespace, name, mutable, possibleValues)
|
||||
val metadata =
|
||||
Metadata(identifier, type, namespace, name, mutable, possibleValues, customAttributes)
|
||||
|
||||
register[key] = metadata
|
||||
pendingKeys.add(key)
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
package com.facebook.flipper.plugins.uidebugger.model
|
||||
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
|
||||
typealias MetadataId = Int
|
||||
|
||||
/**
|
||||
@@ -22,5 +24,5 @@ data class Metadata(
|
||||
val name: String,
|
||||
val mutable: kotlin.Boolean,
|
||||
val possibleValues: Set<InspectableValue>? = emptySet(),
|
||||
val tags: List<String>? = emptyList()
|
||||
) {}
|
||||
val customAttributes: Map<String, JsonPrimitive>? = null
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user