|
7 | 7 | package com.datadog.reactnative.sessionreplay.mappers
|
8 | 8 |
|
9 | 9 | import ReactViewBackgroundDrawableUtils
|
10 |
| -import com.datadog.android.api.InternalLogger |
11 |
| -import com.datadog.android.sessionreplay.model.MobileSegment |
12 |
| -import com.datadog.android.sessionreplay.recorder.MappingContext |
13 |
| -import com.datadog.android.sessionreplay.recorder.mapper.BaseWireframeMapper |
14 | 10 | import com.datadog.android.sessionreplay.recorder.mapper.TraverseAllChildrenMapper
|
15 |
| -import com.datadog.android.sessionreplay.utils.AsyncJobStatusCallback |
16 |
| -import com.datadog.android.sessionreplay.utils.DefaultColorStringFormatter |
17 |
| -import com.datadog.android.sessionreplay.utils.DefaultViewBoundsResolver |
18 |
| -import com.datadog.android.sessionreplay.utils.DefaultViewBoundsResolver.resolveViewGlobalBounds |
19 |
| -import com.datadog.android.sessionreplay.utils.DefaultViewIdentifierResolver |
20 |
| -import com.datadog.android.sessionreplay.utils.DrawableToColorMapper |
21 | 11 | import com.datadog.reactnative.sessionreplay.utils.DrawableUtils
|
22 | 12 | import com.facebook.react.views.view.ReactViewGroup
|
23 | 13 |
|
24 | 14 | internal class ReactViewGroupMapper(
|
25 | 15 | private val drawableUtils: DrawableUtils =
|
26 | 16 | ReactViewBackgroundDrawableUtils()
|
27 |
| -) : |
28 |
| - BaseWireframeMapper<ReactViewGroup>( |
29 |
| - viewIdentifierResolver = DefaultViewIdentifierResolver, |
30 |
| - colorStringFormatter = DefaultColorStringFormatter, |
31 |
| - viewBoundsResolver = DefaultViewBoundsResolver, |
32 |
| - drawableToColorMapper = DrawableToColorMapper.getDefault() |
33 |
| - ), |
34 |
| - TraverseAllChildrenMapper<ReactViewGroup> { |
35 |
| - |
36 |
| - override fun map( |
37 |
| - view: ReactViewGroup, |
38 |
| - mappingContext: MappingContext, |
39 |
| - asyncJobStatusCallback: AsyncJobStatusCallback, |
40 |
| - internalLogger: InternalLogger |
41 |
| - ): List<MobileSegment.Wireframe> { |
42 |
| - val pixelDensity = mappingContext.systemInformation.screenDensity |
43 |
| - val viewGlobalBounds = resolveViewGlobalBounds(view, pixelDensity) |
44 |
| - val backgroundDrawable = drawableUtils.getReactBackgroundFromDrawable(view.background) |
45 |
| - |
46 |
| - // view.alpha is the value of the opacity prop on the js side |
47 |
| - val opacity = view.alpha |
48 |
| - |
49 |
| - val (shapeStyle, border) = |
50 |
| - if (backgroundDrawable != null) { |
51 |
| - drawableUtils |
52 |
| - .resolveShapeAndBorder(backgroundDrawable, opacity, pixelDensity) |
53 |
| - } else { |
54 |
| - null to null |
55 |
| - } |
56 |
| - |
57 |
| - return listOf( |
58 |
| - MobileSegment.Wireframe.ShapeWireframe( |
59 |
| - resolveViewId(view), |
60 |
| - viewGlobalBounds.x, |
61 |
| - viewGlobalBounds.y, |
62 |
| - viewGlobalBounds.width, |
63 |
| - viewGlobalBounds.height, |
64 |
| - shapeStyle = shapeStyle, |
65 |
| - border = border |
66 |
| - ) |
67 |
| - ) |
68 |
| - } |
69 |
| -} |
| 17 | +) : DefaultMapper<ReactViewGroup>(drawableUtils), TraverseAllChildrenMapper<ReactViewGroup> |
0 commit comments