@datadog/mobile-react-native 2.4.2 → 2.4.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.
- package/android/src/main/kotlin/com/datadog/reactnative/FrameRateProvider.kt +5 -5
- package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
- package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +11 -23
- package/ios/Sources/SdkVersion.swift +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/version.ts +1 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
package com.datadog.reactnative
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import android.view.Choreographer
|
|
10
10
|
|
|
11
11
|
internal class FrameRateProvider(
|
|
12
12
|
reactFrameRateCallback: ((Double) -> Unit),
|
|
@@ -30,9 +30,9 @@ internal class FrameRateProvider(
|
|
|
30
30
|
internal class FpsFrameCallback(
|
|
31
31
|
private val reactFrameRateCallback: ((Double) -> Unit),
|
|
32
32
|
private val uiThreadExecutor: UiThreadExecutor
|
|
33
|
-
) :
|
|
33
|
+
) : Choreographer.FrameCallback {
|
|
34
34
|
|
|
35
|
-
private var choreographer:
|
|
35
|
+
private var choreographer: Choreographer? = null
|
|
36
36
|
private var lastFrameTime = -1L
|
|
37
37
|
|
|
38
38
|
override fun doFrame(time: Long) {
|
|
@@ -45,14 +45,14 @@ internal class FpsFrameCallback(
|
|
|
45
45
|
|
|
46
46
|
fun start() {
|
|
47
47
|
uiThreadExecutor.runOnUiThread {
|
|
48
|
-
choreographer =
|
|
48
|
+
choreographer = Choreographer.getInstance()
|
|
49
49
|
choreographer?.postFrameCallback(this@FpsFrameCallback)
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
fun stop() {
|
|
54
54
|
uiThreadExecutor.runOnUiThread {
|
|
55
|
-
choreographer =
|
|
55
|
+
choreographer = Choreographer.getInstance()
|
|
56
56
|
choreographer?.removeFrameCallback(this@FpsFrameCallback)
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -38,7 +38,6 @@ import com.datadog.tools.unit.toReadableMap
|
|
|
38
38
|
import com.facebook.react.bridge.Promise
|
|
39
39
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
40
40
|
import com.facebook.react.bridge.ReadableMap
|
|
41
|
-
import com.facebook.react.modules.core.ChoreographerCompat
|
|
42
41
|
import fr.xgouchet.elmyr.Forge
|
|
43
42
|
import fr.xgouchet.elmyr.annotation.AdvancedForgery
|
|
44
43
|
import fr.xgouchet.elmyr.annotation.BoolForgery
|
|
@@ -81,13 +80,6 @@ import org.mockito.kotlin.verifyNoInteractions
|
|
|
81
80
|
import org.mockito.kotlin.whenever
|
|
82
81
|
import org.mockito.quality.Strictness
|
|
83
82
|
|
|
84
|
-
fun mockChoreographerCompatInstance(mock: ChoreographerCompat = mock()) {
|
|
85
|
-
ChoreographerCompat::class.java.setStaticValue(
|
|
86
|
-
"sInstance",
|
|
87
|
-
mock
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
83
|
fun mockChoreographerInstance(mock: Choreographer = mock()) {
|
|
92
84
|
Choreographer::class.java.setStaticValue(
|
|
93
85
|
"sThreadInstance",
|
|
@@ -135,9 +127,6 @@ internal class DdSdkTest {
|
|
|
135
127
|
@Mock
|
|
136
128
|
lateinit var mockChoreographer: Choreographer
|
|
137
129
|
|
|
138
|
-
@Mock
|
|
139
|
-
lateinit var mockChoreographerCompat: ChoreographerCompat
|
|
140
|
-
|
|
141
130
|
@BeforeEach
|
|
142
131
|
fun `set up`() {
|
|
143
132
|
val mockLooper = mock<Looper>()
|
|
@@ -148,10 +137,8 @@ internal class DdSdkTest {
|
|
|
148
137
|
whenever(mockRumMonitor._getInternal()) doReturn mockRumInternalProxy
|
|
149
138
|
|
|
150
139
|
doNothing().whenever(mockChoreographer).postFrameCallback(any())
|
|
151
|
-
doNothing().whenever(mockChoreographerCompat).postFrameCallback(any())
|
|
152
140
|
|
|
153
141
|
mockChoreographerInstance(mockChoreographer)
|
|
154
|
-
mockChoreographerCompatInstance(mockChoreographerCompat)
|
|
155
142
|
|
|
156
143
|
whenever(mockReactContext.applicationContext) doReturn mockContext
|
|
157
144
|
whenever(mockContext.packageName) doReturn "packageName"
|
|
@@ -1581,8 +1568,9 @@ internal class DdSdkTest {
|
|
|
1581
1568
|
.hasField("featureConfiguration") {
|
|
1582
1569
|
it.hasFieldEqualTo("vitalsMonitorUpdateFrequency", VitalsUpdateFrequency.RARE)
|
|
1583
1570
|
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1571
|
+
|
|
1572
|
+
argumentCaptor<Choreographer.FrameCallback> {
|
|
1573
|
+
verify(mockChoreographer).postFrameCallback(capture())
|
|
1586
1574
|
assertThat(firstValue).isInstanceOf(FpsFrameCallback::class.java)
|
|
1587
1575
|
}
|
|
1588
1576
|
}
|
|
@@ -1592,7 +1580,7 @@ internal class DdSdkTest {
|
|
|
1592
1580
|
@Forgery configuration: DdSdkConfiguration
|
|
1593
1581
|
) {
|
|
1594
1582
|
// Given
|
|
1595
|
-
doThrow(IllegalStateException()).whenever(
|
|
1583
|
+
doThrow(IllegalStateException()).whenever(mockChoreographer).postFrameCallback(any())
|
|
1596
1584
|
val bridgeConfiguration = configuration.copy(
|
|
1597
1585
|
vitalsUpdateFrequency = "NEVER",
|
|
1598
1586
|
longTaskThresholdMs = 0.0
|
|
@@ -1620,7 +1608,7 @@ internal class DdSdkTest {
|
|
|
1620
1608
|
.hasField("featureConfiguration") {
|
|
1621
1609
|
it.hasFieldEqualTo("vitalsMonitorUpdateFrequency", VitalsUpdateFrequency.NEVER)
|
|
1622
1610
|
}
|
|
1623
|
-
verifyNoInteractions(
|
|
1611
|
+
verifyNoInteractions(mockChoreographer)
|
|
1624
1612
|
}
|
|
1625
1613
|
|
|
1626
1614
|
@Test
|
|
@@ -1660,8 +1648,8 @@ internal class DdSdkTest {
|
|
|
1660
1648
|
.hasField("featureConfiguration") {
|
|
1661
1649
|
it.hasFieldEqualTo("vitalsMonitorUpdateFrequency", VitalsUpdateFrequency.AVERAGE)
|
|
1662
1650
|
}
|
|
1663
|
-
argumentCaptor<
|
|
1664
|
-
verify(
|
|
1651
|
+
argumentCaptor<Choreographer.FrameCallback> {
|
|
1652
|
+
verify(mockChoreographer).postFrameCallback(capture())
|
|
1665
1653
|
assertThat(firstValue).isInstanceOf(FpsFrameCallback::class.java)
|
|
1666
1654
|
|
|
1667
1655
|
// When
|
|
@@ -1698,8 +1686,8 @@ internal class DdSdkTest {
|
|
|
1698
1686
|
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1699
1687
|
|
|
1700
1688
|
// Then
|
|
1701
|
-
argumentCaptor<
|
|
1702
|
-
verify(
|
|
1689
|
+
argumentCaptor<Choreographer.FrameCallback> {
|
|
1690
|
+
verify(mockChoreographer).postFrameCallback(capture())
|
|
1703
1691
|
|
|
1704
1692
|
// When
|
|
1705
1693
|
firstValue.doFrame(timestampNs)
|
|
@@ -1735,8 +1723,8 @@ internal class DdSdkTest {
|
|
|
1735
1723
|
testedBridgeSdk.initialize(bridgeConfiguration.toReadableJavaOnlyMap(), mockPromise)
|
|
1736
1724
|
|
|
1737
1725
|
// Then
|
|
1738
|
-
argumentCaptor<
|
|
1739
|
-
verify(
|
|
1726
|
+
argumentCaptor<Choreographer.FrameCallback> {
|
|
1727
|
+
verify(mockChoreographer).postFrameCallback(capture())
|
|
1740
1728
|
|
|
1741
1729
|
// When
|
|
1742
1730
|
firstValue.doFrame(timestampNs)
|
package/lib/commonjs/version.js
CHANGED
package/lib/module/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "2.4.
|
|
1
|
+
export declare const version = "2.4.3";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datadog/mobile-react-native",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"description": "A client-side React Native module to interact with Datadog",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"datadog",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"javaPackageName": "com.datadog.reactnative"
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "d3b0fcb425c34d787de79ee8241fef84cd88d1a0"
|
|
101
101
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// generated by genversion
|
|
2
|
-
export const version = '2.4.
|
|
2
|
+
export const version = '2.4.3';
|