in facebook-core/src/main/java/com/facebook/appevents/codeless/CodelessMatcher.kt [433:468]
fun getParameters(mapping: EventBinding?, rootView: View, hostView: View): Bundle {
val params = Bundle()
if (null == mapping) {
return params
}
val parameters = mapping.viewParameters
if (null != parameters) {
for (component in parameters) {
if (component.value != null && component.value.isNotEmpty()) {
params.putString(component.name, component.value)
} else if (component.path.size > 0) {
var matchedViews: List<MatchedView>
val pathType = component.pathType
matchedViews =
if (pathType == Constants.PATH_TYPE_RELATIVE) {
ViewMatcher.findViewByPath(
mapping, hostView, component.path, 0, -1, hostView.javaClass.simpleName)
} else {
ViewMatcher.findViewByPath(
mapping, rootView, component.path, 0, -1, rootView.javaClass.simpleName)
}
for (view in matchedViews) {
if (view.getView() == null) {
continue
}
val text = ViewHierarchy.getTextOfView(view.getView())
if (text.isNotEmpty()) {
params.putString(component.name, text)
break
}
}
}
}
}
return params
}