@datadog/mobile-react-native-session-replay 2.6.2 → 2.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DatadogSDKReactNativeSessionReplay.podspec +1 -1
- package/android/build.gradle +4 -2
- package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/DdSessionReplayImplementation.kt +6 -0
- package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/ReactNativeInternalCallback.kt +23 -0
- package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/ReactNativeSessionReplayExtensionSupport.kt +3 -0
- package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/DefaultMapper.kt +65 -0
- package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/ReactEditTextMapper.kt +4 -1
- package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/ReactTextMapper.kt +4 -1
- package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/ReactViewGroupMapper.kt +1 -53
- package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/ReactViewModalMapper.kt +16 -0
- package/android/src/rn69/kotlin/com.datadog.reactnative.sessionreplay/utils/ReactViewBackgroundDrawableUtils.kt +88 -0
- package/android/src/rnlegacy/kotlin/com.datadog.reactnative.sessionreplay/utils/ReactViewBackgroundDrawableUtils.kt +26 -1
- package/android/src/test/kotlin/com/datadog/reactnative/sessionreplay/ReactNativeSessionReplayExtensionSupportTest.kt +5 -1
- package/lib/commonjs/specs/NativeDdSessionReplay.js +1 -1
- package/lib/module/specs/NativeDdSessionReplay.js +1 -1
- package/package.json +2 -2
- package/src/specs/NativeDdSessionReplay.ts +1 -1
|
@@ -19,7 +19,7 @@ Pod::Spec.new do |s|
|
|
|
19
19
|
s.dependency "React-Core"
|
|
20
20
|
|
|
21
21
|
# /!\ Remember to keep the version in sync with DatadogSDKReactNative.podspec
|
|
22
|
-
s.dependency 'DatadogSessionReplay', '~> 2.
|
|
22
|
+
s.dependency 'DatadogSessionReplay', '~> 2.24.0'
|
|
23
23
|
s.dependency 'DatadogSDKReactNative'
|
|
24
24
|
|
|
25
25
|
s.test_spec 'Tests' do |test_spec|
|
package/android/build.gradle
CHANGED
|
@@ -139,6 +139,8 @@ android {
|
|
|
139
139
|
java.srcDirs += ['src/rn76/kotlin']
|
|
140
140
|
} else if (reactNativeMinorVersion >= 75) {
|
|
141
141
|
java.srcDirs += ['src/rn75/kotlin']
|
|
142
|
+
} else if (reactNativeMinorVersion >= 69) {
|
|
143
|
+
java.srcDirs += ['src/rn69/kotlin']
|
|
142
144
|
} else {
|
|
143
145
|
java.srcDirs += ['src/rnlegacy/kotlin']
|
|
144
146
|
}
|
|
@@ -197,8 +199,8 @@ dependencies {
|
|
|
197
199
|
api "com.facebook.react:react-android:$reactNativeVersion"
|
|
198
200
|
}
|
|
199
201
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
200
|
-
implementation "com.datadoghq:dd-sdk-android-session-replay:2.
|
|
201
|
-
implementation "com.datadoghq:dd-sdk-android-internal:2.
|
|
202
|
+
implementation "com.datadoghq:dd-sdk-android-session-replay:2.19.2"
|
|
203
|
+
implementation "com.datadoghq:dd-sdk-android-internal:2.19.2"
|
|
202
204
|
implementation project(path: ':datadog_mobile-react-native')
|
|
203
205
|
|
|
204
206
|
testImplementation "org.junit.platform:junit-platform-launcher:1.6.2"
|
|
@@ -9,6 +9,7 @@ package com.datadog.reactnative.sessionreplay
|
|
|
9
9
|
import android.annotation.SuppressLint
|
|
10
10
|
import com.datadog.android.api.feature.FeatureSdkCore
|
|
11
11
|
import com.datadog.android.sessionreplay.SessionReplayConfiguration
|
|
12
|
+
import com.datadog.android.sessionreplay._SessionReplayInternalProxy
|
|
12
13
|
import com.datadog.reactnative.DatadogSDKWrapperStorage
|
|
13
14
|
import com.datadog.reactnative.sessionreplay.utils.text.TextViewUtils
|
|
14
15
|
import com.facebook.react.bridge.Promise
|
|
@@ -42,12 +43,17 @@ class DdSessionReplayImplementation(
|
|
|
42
43
|
val sdkCore = DatadogSDKWrapperStorage.getSdkCore() as FeatureSdkCore
|
|
43
44
|
val logger = sdkCore.internalLogger
|
|
44
45
|
val textViewUtils = TextViewUtils.create(reactContext, logger)
|
|
46
|
+
val internalCallback = ReactNativeInternalCallback(reactContext)
|
|
45
47
|
val configuration = SessionReplayConfiguration.Builder(replaySampleRate.toFloat())
|
|
46
48
|
.startRecordingImmediately(startRecordingImmediately)
|
|
47
49
|
.setImagePrivacy(privacySettings.imagePrivacyLevel)
|
|
48
50
|
.setTouchPrivacy(privacySettings.touchPrivacyLevel)
|
|
49
51
|
.setTextAndInputPrivacy(privacySettings.textAndInputPrivacyLevel)
|
|
50
52
|
.addExtensionSupport(ReactNativeSessionReplayExtensionSupport(textViewUtils))
|
|
53
|
+
.let {
|
|
54
|
+
_SessionReplayInternalProxy(it).setInternalCallback(internalCallback)
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
|
|
52
58
|
if (customEndpoint != "") {
|
|
53
59
|
configuration.useCustomEndpoint(customEndpoint)
|
package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/ReactNativeInternalCallback.kt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
package com.datadog.reactnative.sessionreplay
|
|
8
|
+
|
|
9
|
+
import android.app.Activity
|
|
10
|
+
import com.datadog.android.sessionreplay.SessionReplayInternalCallback
|
|
11
|
+
import com.facebook.react.bridge.ReactContext
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Responsible for defining the internal callback implementation for react-native that will allow
|
|
15
|
+
* overriding specific parts of the session replay android sdk.
|
|
16
|
+
*/
|
|
17
|
+
class ReactNativeInternalCallback(
|
|
18
|
+
private val reactContext: ReactContext,
|
|
19
|
+
) : SessionReplayInternalCallback {
|
|
20
|
+
override fun getCurrentActivity(): Activity? {
|
|
21
|
+
return reactContext.currentActivity
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -14,8 +14,10 @@ import com.datadog.reactnative.sessionreplay.mappers.ReactEditTextMapper
|
|
|
14
14
|
import com.datadog.reactnative.sessionreplay.mappers.ReactNativeImageViewMapper
|
|
15
15
|
import com.datadog.reactnative.sessionreplay.mappers.ReactTextMapper
|
|
16
16
|
import com.datadog.reactnative.sessionreplay.mappers.ReactViewGroupMapper
|
|
17
|
+
import com.datadog.reactnative.sessionreplay.mappers.ReactViewModalMapper
|
|
17
18
|
import com.datadog.reactnative.sessionreplay.utils.text.TextViewUtils
|
|
18
19
|
import com.facebook.react.views.image.ReactImageView
|
|
20
|
+
import com.facebook.react.views.modal.ReactModalHostView
|
|
19
21
|
import com.facebook.react.views.text.ReactTextView
|
|
20
22
|
import com.facebook.react.views.textinput.ReactEditText
|
|
21
23
|
import com.facebook.react.views.view.ReactViewGroup
|
|
@@ -34,6 +36,7 @@ internal class ReactNativeSessionReplayExtensionSupport(
|
|
|
34
36
|
MapperTypeWrapper(ReactViewGroup::class.java, ReactViewGroupMapper()),
|
|
35
37
|
MapperTypeWrapper(ReactTextView::class.java, ReactTextMapper(textViewUtils)),
|
|
36
38
|
MapperTypeWrapper(ReactEditText::class.java, ReactEditTextMapper(textViewUtils)),
|
|
39
|
+
MapperTypeWrapper(ReactModalHostView::class.java, ReactViewModalMapper()),
|
|
37
40
|
)
|
|
38
41
|
}
|
|
39
42
|
|
package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/DefaultMapper.kt
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
package com.datadog.reactnative.sessionreplay.mappers
|
|
8
|
+
|
|
9
|
+
import ReactViewBackgroundDrawableUtils
|
|
10
|
+
import android.view.View
|
|
11
|
+
import com.datadog.android.api.InternalLogger
|
|
12
|
+
import com.datadog.android.sessionreplay.model.MobileSegment
|
|
13
|
+
import com.datadog.android.sessionreplay.recorder.MappingContext
|
|
14
|
+
import com.datadog.android.sessionreplay.recorder.mapper.BaseWireframeMapper
|
|
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
|
+
import com.datadog.reactnative.sessionreplay.utils.DrawableUtils
|
|
22
|
+
|
|
23
|
+
internal open class DefaultMapper<T: View>(
|
|
24
|
+
private val drawableUtils: DrawableUtils =
|
|
25
|
+
ReactViewBackgroundDrawableUtils()
|
|
26
|
+
): BaseWireframeMapper<T>(
|
|
27
|
+
viewIdentifierResolver = DefaultViewIdentifierResolver,
|
|
28
|
+
colorStringFormatter = DefaultColorStringFormatter,
|
|
29
|
+
viewBoundsResolver = DefaultViewBoundsResolver,
|
|
30
|
+
drawableToColorMapper = DrawableToColorMapper.getDefault()
|
|
31
|
+
) {
|
|
32
|
+
override fun map(
|
|
33
|
+
view: T,
|
|
34
|
+
mappingContext: MappingContext,
|
|
35
|
+
asyncJobStatusCallback: AsyncJobStatusCallback,
|
|
36
|
+
internalLogger: InternalLogger
|
|
37
|
+
): List<MobileSegment.Wireframe> {
|
|
38
|
+
val pixelDensity = mappingContext.systemInformation.screenDensity
|
|
39
|
+
val viewGlobalBounds = resolveViewGlobalBounds(view, pixelDensity)
|
|
40
|
+
val backgroundDrawable = drawableUtils.getReactBackgroundFromDrawable(view.background)
|
|
41
|
+
|
|
42
|
+
// view.alpha is the value of the opacity prop on the js side
|
|
43
|
+
val opacity = view.alpha
|
|
44
|
+
|
|
45
|
+
val (shapeStyle, border) =
|
|
46
|
+
if (backgroundDrawable != null) {
|
|
47
|
+
drawableUtils
|
|
48
|
+
.resolveShapeAndBorder(backgroundDrawable, opacity, pixelDensity)
|
|
49
|
+
} else {
|
|
50
|
+
null to null
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return listOf(
|
|
54
|
+
MobileSegment.Wireframe.ShapeWireframe(
|
|
55
|
+
resolveViewId(view),
|
|
56
|
+
viewGlobalBounds.x,
|
|
57
|
+
viewGlobalBounds.y,
|
|
58
|
+
viewGlobalBounds.width,
|
|
59
|
+
viewGlobalBounds.height,
|
|
60
|
+
shapeStyle = shapeStyle,
|
|
61
|
+
border = border
|
|
62
|
+
)
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
}
|
package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/ReactEditTextMapper.kt
CHANGED
|
@@ -61,7 +61,10 @@ internal class ReactEditTextMapper(
|
|
|
61
61
|
mappingContext = mappingContext,
|
|
62
62
|
asyncJobStatusCallback = asyncJobStatusCallback,
|
|
63
63
|
internalLogger = internalLogger
|
|
64
|
-
).filterNot {
|
|
64
|
+
).filterNot {
|
|
65
|
+
it is MobileSegment.Wireframe.ImageWireframe ||
|
|
66
|
+
it is MobileSegment.Wireframe.PlaceholderWireframe
|
|
67
|
+
}
|
|
65
68
|
|
|
66
69
|
return textViewUtils.mapTextViewToWireframes(
|
|
67
70
|
wireframes = backgroundWireframes,
|
|
@@ -7,63 +7,11 @@
|
|
|
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,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
package com.datadog.reactnative.sessionreplay.mappers
|
|
8
|
+
|
|
9
|
+
import ReactViewBackgroundDrawableUtils
|
|
10
|
+
import com.datadog.reactnative.sessionreplay.utils.DrawableUtils
|
|
11
|
+
import com.facebook.react.views.modal.ReactModalHostView
|
|
12
|
+
|
|
13
|
+
internal class ReactViewModalMapper(
|
|
14
|
+
private val drawableUtils: DrawableUtils =
|
|
15
|
+
ReactViewBackgroundDrawableUtils()
|
|
16
|
+
) : DefaultMapper<ReactModalHostView>(drawableUtils)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
|
|
3
|
+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
|
|
4
|
+
* Copyright 2016-Present Datadog, Inc.
|
|
5
|
+
*/
|
|
6
|
+
import android.graphics.drawable.Drawable
|
|
7
|
+
import android.graphics.drawable.InsetDrawable
|
|
8
|
+
import android.graphics.drawable.LayerDrawable
|
|
9
|
+
import com.datadog.android.sessionreplay.model.MobileSegment
|
|
10
|
+
import com.datadog.reactnative.sessionreplay.utils.DrawableUtils
|
|
11
|
+
import com.datadog.reactnative.sessionreplay.utils.formatAsRgba
|
|
12
|
+
import com.facebook.react.uimanager.Spacing
|
|
13
|
+
import com.facebook.react.views.view.ReactViewBackgroundDrawable
|
|
14
|
+
|
|
15
|
+
internal class ReactViewBackgroundDrawableUtils() : DrawableUtils() {
|
|
16
|
+
override fun resolveShapeAndBorder(
|
|
17
|
+
drawable: Drawable,
|
|
18
|
+
opacity: Float,
|
|
19
|
+
pixelDensity: Float
|
|
20
|
+
): Pair<MobileSegment.ShapeStyle?, MobileSegment.ShapeBorder?> {
|
|
21
|
+
if (drawable !is ReactViewBackgroundDrawable) {
|
|
22
|
+
return null to null
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
val borderProps = resolveBorder(drawable, pixelDensity)
|
|
26
|
+
val cornerRadius = (drawable.fullBorderRadius / pixelDensity).toLong()
|
|
27
|
+
|
|
28
|
+
val backgroundColor = getBackgroundColor(drawable)
|
|
29
|
+
val colorHexString = if (backgroundColor != null) {
|
|
30
|
+
formatAsRgba(backgroundColor)
|
|
31
|
+
} else {
|
|
32
|
+
return null to borderProps
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return MobileSegment.ShapeStyle(
|
|
36
|
+
colorHexString,
|
|
37
|
+
opacity,
|
|
38
|
+
cornerRadius
|
|
39
|
+
) to borderProps
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override fun getReactBackgroundFromDrawable(drawable: Drawable?): Drawable? {
|
|
43
|
+
if (drawable is ReactViewBackgroundDrawable) {
|
|
44
|
+
return drawable
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (drawable is InsetDrawable) {
|
|
48
|
+
return getReactBackgroundFromDrawable(drawable.drawable)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (drawable is LayerDrawable) {
|
|
52
|
+
for (layerNumber in 0 until drawable.numberOfLayers) {
|
|
53
|
+
val layer = drawable.getDrawable(layerNumber)
|
|
54
|
+
if (layer is ReactViewBackgroundDrawable) {
|
|
55
|
+
return layer
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return null
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private fun resolveBorder(
|
|
64
|
+
backgroundDrawable: ReactViewBackgroundDrawable,
|
|
65
|
+
pixelDensity: Float
|
|
66
|
+
): MobileSegment.ShapeBorder {
|
|
67
|
+
val borderWidth = (backgroundDrawable.fullBorderWidth / pixelDensity).toLong()
|
|
68
|
+
val borderColor = formatAsRgba(backgroundDrawable.getBorderColor(Spacing.ALL))
|
|
69
|
+
|
|
70
|
+
return MobileSegment.ShapeBorder(
|
|
71
|
+
color = borderColor,
|
|
72
|
+
width = borderWidth
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private fun getBackgroundColor(
|
|
77
|
+
backgroundDrawable: ReactViewBackgroundDrawable
|
|
78
|
+
): Int? {
|
|
79
|
+
return reflectionUtils.getDeclaredField(
|
|
80
|
+
backgroundDrawable,
|
|
81
|
+
COLOR_FIELD_NAME
|
|
82
|
+
) as Int?
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private companion object {
|
|
86
|
+
private const val COLOR_FIELD_NAME = "mColor"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import android.graphics.Color
|
|
1
2
|
import android.graphics.drawable.Drawable
|
|
2
3
|
import android.graphics.drawable.InsetDrawable
|
|
3
4
|
import android.graphics.drawable.LayerDrawable
|
|
@@ -60,7 +61,7 @@ internal class ReactViewBackgroundDrawableUtils() : DrawableUtils() {
|
|
|
60
61
|
pixelDensity: Float
|
|
61
62
|
): MobileSegment.ShapeBorder {
|
|
62
63
|
val borderWidth = (backgroundDrawable.fullBorderWidth / pixelDensity).toLong()
|
|
63
|
-
val borderColor = formatAsRgba(
|
|
64
|
+
val borderColor = formatAsRgba(getBorderColor(backgroundDrawable))
|
|
64
65
|
|
|
65
66
|
return MobileSegment.ShapeBorder(
|
|
66
67
|
color = borderColor,
|
|
@@ -68,6 +69,26 @@ internal class ReactViewBackgroundDrawableUtils() : DrawableUtils() {
|
|
|
68
69
|
)
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
private fun getBorderColor(backgroundDrawable: ReactViewBackgroundDrawable): Int {
|
|
73
|
+
val borderRgb = reflectionUtils.getDeclaredField(
|
|
74
|
+
backgroundDrawable,
|
|
75
|
+
BORDER_RGB_FIELD_NAME
|
|
76
|
+
) as Spacing?
|
|
77
|
+
|
|
78
|
+
val borderAlpha = reflectionUtils.getDeclaredField(
|
|
79
|
+
backgroundDrawable,
|
|
80
|
+
BORDER_ALPHA_FIELD_NAME
|
|
81
|
+
) as Spacing?
|
|
82
|
+
|
|
83
|
+
val rgb = borderRgb?.get(Spacing.ALL) ?: DEFAULT_BORDER_RGB
|
|
84
|
+
val alpha = borderAlpha?.get(Spacing.ALL) ?: DEFAULT_BORDER_ALPHA
|
|
85
|
+
|
|
86
|
+
val rgbComponent = 0x00FFFFFF and rgb.toInt()
|
|
87
|
+
val alphaComponent = -0x1000000 and ((alpha.toInt()) shl 24)
|
|
88
|
+
|
|
89
|
+
return rgbComponent or alphaComponent
|
|
90
|
+
}
|
|
91
|
+
|
|
71
92
|
private fun getBackgroundColor(
|
|
72
93
|
backgroundDrawable: ReactViewBackgroundDrawable
|
|
73
94
|
): Int? {
|
|
@@ -79,5 +100,9 @@ internal class ReactViewBackgroundDrawableUtils() : DrawableUtils() {
|
|
|
79
100
|
|
|
80
101
|
private companion object {
|
|
81
102
|
private const val COLOR_FIELD_NAME = "mColor"
|
|
103
|
+
private const val BORDER_RGB_FIELD_NAME = "mBorderRGB"
|
|
104
|
+
private const val BORDER_ALPHA_FIELD_NAME = "mBorderAlpha"
|
|
105
|
+
private const val DEFAULT_BORDER_RGB: Int = 0x00FFFFFF and Color.BLACK
|
|
106
|
+
private const val DEFAULT_BORDER_ALPHA: Int = -0x1000000 and Color.BLACK
|
|
82
107
|
}
|
|
83
108
|
}
|
|
@@ -11,6 +11,7 @@ import com.datadog.reactnative.sessionreplay.mappers.ReactEditTextMapper
|
|
|
11
11
|
import com.datadog.reactnative.sessionreplay.mappers.ReactNativeImageViewMapper
|
|
12
12
|
import com.datadog.reactnative.sessionreplay.mappers.ReactTextMapper
|
|
13
13
|
import com.datadog.reactnative.sessionreplay.mappers.ReactViewGroupMapper
|
|
14
|
+
import com.datadog.reactnative.sessionreplay.mappers.ReactViewModalMapper
|
|
14
15
|
import com.datadog.reactnative.sessionreplay.utils.text.TextViewUtils
|
|
15
16
|
import com.facebook.react.bridge.NativeModule
|
|
16
17
|
import com.facebook.react.bridge.ReactContext
|
|
@@ -62,7 +63,7 @@ internal class ReactNativeSessionReplayExtensionSupportTest {
|
|
|
62
63
|
val customViewMappers = testedExtensionSupport.getCustomViewMappers()
|
|
63
64
|
|
|
64
65
|
// Then
|
|
65
|
-
assertThat(customViewMappers).hasSize(
|
|
66
|
+
assertThat(customViewMappers).hasSize(5)
|
|
66
67
|
|
|
67
68
|
assertThat(customViewMappers[0].getUnsafeMapper())
|
|
68
69
|
.isInstanceOf(ReactNativeImageViewMapper::class.java)
|
|
@@ -75,5 +76,8 @@ internal class ReactNativeSessionReplayExtensionSupportTest {
|
|
|
75
76
|
|
|
76
77
|
assertThat(customViewMappers[3].getUnsafeMapper())
|
|
77
78
|
.isInstanceOf(ReactEditTextMapper::class.java)
|
|
79
|
+
|
|
80
|
+
assertThat(customViewMappers[4].getUnsafeMapper())
|
|
81
|
+
.isInstanceOf(ReactViewModalMapper::class.java)
|
|
78
82
|
}
|
|
79
83
|
}
|
|
@@ -14,6 +14,6 @@ var _reactNative = require("react-native");
|
|
|
14
14
|
/**
|
|
15
15
|
* Do not import this Spec directly, use NativeSessionReplayType instead.
|
|
16
16
|
*/
|
|
17
|
-
// eslint-disable-next-line
|
|
17
|
+
// eslint-disable-next-line import/no-default-export
|
|
18
18
|
var _default = exports.default = _reactNative.TurboModuleRegistry.get('DdSessionReplay');
|
|
19
19
|
//# sourceMappingURL=NativeDdSessionReplay.js.map
|
|
@@ -12,6 +12,6 @@ import { TurboModuleRegistry } from 'react-native';
|
|
|
12
12
|
* Do not import this Spec directly, use NativeSessionReplayType instead.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
// eslint-disable-next-line
|
|
15
|
+
// eslint-disable-next-line import/no-default-export
|
|
16
16
|
export default TurboModuleRegistry.get('DdSessionReplay');
|
|
17
17
|
//# sourceMappingURL=NativeDdSessionReplay.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datadog/mobile-react-native-session-replay",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.4",
|
|
4
4
|
"description": "A client-side React Native module to enable session replay with Datadog",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datadog",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"javaPackageName": "com.datadog.reactnative.sessionreplay"
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "8c31bf4d2a3fb6e1f1596b36cd61fa27c41b8576"
|
|
94
94
|
}
|