@datadog/mobile-react-native-session-replay 2.6.1 → 2.6.3

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.
Files changed (29) hide show
  1. package/README.md +3 -3
  2. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/DdSessionReplayImplementation.kt +5 -5
  3. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/ReactNativeSessionReplayExtensionSupport.kt +5 -29
  4. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/ShadowNodeWrapper.kt +2 -2
  5. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/ReactEditTextMapper.kt +3 -26
  6. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/mappers/ReactTextMapper.kt +3 -25
  7. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/utils/text/FabricTextViewUtils.kt +74 -0
  8. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/utils/text/LegacyTextViewUtils.kt +118 -0
  9. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/{ReactTextPropertiesResolver.kt → utils/text/TextViewUtils.kt} +60 -96
  10. package/android/src/rn75/kotlin/com/datadog/reactnative/sessionreplay/extensions/LengthPercentageExt.kt +1 -2
  11. package/android/src/rn75/kotlin/com/datadog/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.kt +1 -3
  12. package/android/src/rn76/kotlin/com/datadog/reactnative/sessionreplay/extensions/LengthPercentageExt.kt +1 -1
  13. package/android/src/rn76/kotlin/com/datadog/reactnative/sessionreplay/utils/ReactViewBackgroundDrawableUtils.kt +1 -3
  14. package/android/src/rnlegacy/kotlin/com.datadog.reactnative.sessionreplay/utils/ReactViewBackgroundDrawableUtils.kt +2 -7
  15. package/android/src/test/kotlin/com/datadog/reactnative/sessionreplay/ReactNativeSessionReplayExtensionSupportTest.kt +3 -17
  16. package/android/src/test/kotlin/com/datadog/reactnative/sessionreplay/{ReactTextPropertiesResolverTest.kt → utils/text/TextViewUtilsTest.kt} +171 -38
  17. package/ios/Sources/DdSessionReplay.mm +4 -4
  18. package/ios/Sources/DdSessionReplayImplementation.swift +13 -3
  19. package/ios/Sources/RCTFabricWrapper.h +13 -0
  20. package/ios/Sources/RCTFabricWrapper.mm +120 -0
  21. package/ios/Sources/RCTTextPropertiesWrapper.h +23 -0
  22. package/ios/Sources/RCTTextPropertiesWrapper.mm +28 -0
  23. package/ios/Sources/RCTTextViewRecorder.swift +69 -49
  24. package/ios/Sources/RCTVersion.h +8 -0
  25. package/package.json +5 -3
  26. package/scripts/set-ios-rn-version.js +47 -0
  27. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/NoopTextPropertiesResolver.kt +0 -22
  28. package/android/src/main/kotlin/com/datadog/reactnative/sessionreplay/utils/TextViewUtils.kt +0 -40
  29. package/android/src/test/kotlin/com/datadog/reactnative/sessionreplay/utils/TextViewUtilsTest.kt +0 -109
@@ -1,109 +0,0 @@
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.utils
8
-
9
- import android.content.res.Resources
10
- import android.graphics.Typeface
11
- import android.util.DisplayMetrics
12
- import android.widget.TextView
13
- import com.datadog.android.sessionreplay.model.MobileSegment
14
- import com.datadog.android.sessionreplay.recorder.MappingContext
15
- import com.datadog.android.sessionreplay.recorder.SystemInformation
16
- import com.datadog.reactnative.sessionreplay.ReactTextPropertiesResolver
17
- import fr.xgouchet.elmyr.Forge
18
- import fr.xgouchet.elmyr.junit5.ForgeExtension
19
- import org.assertj.core.api.Assertions.assertThat
20
- import org.junit.jupiter.api.BeforeEach
21
- import org.junit.jupiter.api.Test
22
- import org.junit.jupiter.api.extension.ExtendWith
23
- import org.junit.jupiter.api.extension.Extensions
24
- import org.mockito.Mock
25
- import org.mockito.junit.jupiter.MockitoExtension
26
- import org.mockito.junit.jupiter.MockitoSettings
27
- import org.mockito.kotlin.eq
28
- import org.mockito.kotlin.whenever
29
- import org.mockito.quality.Strictness
30
-
31
- @Extensions(
32
- ExtendWith(MockitoExtension::class),
33
- ExtendWith(ForgeExtension::class)
34
- )
35
- @MockitoSettings(strictness = Strictness.LENIENT)
36
- internal class TextViewUtilsTest {
37
- private lateinit var testedUtils: TextViewUtils
38
-
39
- @Mock
40
- private lateinit var mockReactTextPropertiesResolver: ReactTextPropertiesResolver
41
-
42
- @Mock
43
- private lateinit var mockMappingContext: MappingContext
44
-
45
- @Mock
46
- private lateinit var mockTextView: TextView
47
-
48
- @Mock
49
- private lateinit var mockSystemInformation: SystemInformation
50
-
51
- @Mock
52
- private lateinit var mockResources: Resources
53
-
54
- @Mock
55
- private lateinit var mockDisplayMetrics: DisplayMetrics
56
-
57
- @BeforeEach
58
- fun `set up`(forge: Forge) {
59
- whenever(mockResources.displayMetrics).thenReturn(mockDisplayMetrics)
60
- whenever(mockTextView.resources).thenReturn(mockResources)
61
- whenever(mockSystemInformation.screenDensity).thenReturn(0f)
62
- whenever(mockMappingContext.systemInformation).thenReturn(mockSystemInformation)
63
- whenever(mockTextView.text).thenReturn(forge.aString())
64
- whenever(mockTextView.typeface).thenReturn(Typeface.SANS_SERIF)
65
-
66
- testedUtils = TextViewUtils()
67
- }
68
-
69
- @Test
70
- fun `M return wireframe W map() { even if not TextWireframeType }`(
71
- @Mock mockImageWireframe: MobileSegment.Wireframe.ImageWireframe
72
- ) {
73
- // When
74
- val result = testedUtils.mapTextViewToWireframes(
75
- wireframes = listOf(mockImageWireframe),
76
- view = mockTextView,
77
- mappingContext = mockMappingContext,
78
- reactTextPropertiesResolver = mockReactTextPropertiesResolver
79
- )
80
-
81
- // Then
82
- assertThat(result).contains(mockImageWireframe)
83
- }
84
-
85
- @Test
86
- fun `M return textWireframe W map()`(
87
- @Mock mockTextWireframe: MobileSegment.Wireframe.TextWireframe
88
- ) {
89
- // Given
90
- whenever(
91
- mockReactTextPropertiesResolver.addReactNativeProperties(
92
- originalWireframe = eq(mockTextWireframe),
93
- view = eq(mockTextView),
94
- pixelDensity = eq(0f)
95
- )
96
- ).thenReturn(mockTextWireframe)
97
-
98
- // When
99
- val result = testedUtils.mapTextViewToWireframes(
100
- wireframes = listOf(mockTextWireframe),
101
- view = mockTextView,
102
- mappingContext = mockMappingContext,
103
- reactTextPropertiesResolver = mockReactTextPropertiesResolver
104
- )[0] as MobileSegment.Wireframe.TextWireframe
105
-
106
- // Then
107
- assertThat(result).isEqualTo(mockTextWireframe)
108
- }
109
- }