@datadog/mobile-react-native 3.5.2 → 3.5.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/README.md CHANGED
@@ -51,12 +51,12 @@ const datadogConfiguration = new DatadogProviderConfiguration(
51
51
  trackErrors: true, // track errors
52
52
  nativeCrashReportEnabled: true, // Optional: enable or disable native crash reports
53
53
  sessionSampleRate: 80, // Optional: sample RUM sessions (here, 80% of session will be sent to Datadog. Default = 100%)
54
- resourceTracingSamplingRate: 80, // Optional: sample tracing integrations for network calls between your app and your backend (here, 80% of calls to your instrumented backend will be linked from the RUM view to the APM view. Default = 20%)
54
+ resourceTraceSampleRate: 80, // Optional: sample tracing integrations for network calls between your app and your backend (here, 80% of calls to your instrumented backend will be linked from the RUM view to the APM view. Default = 20%)
55
55
  // You need to specify the hosts of your backends to enable tracing with these backends
56
56
  firstPartyHosts: ['example.com'], // matches 'example.com' and subdomains like 'api.example.com'
57
57
  },
58
58
  logsConfiguration: {
59
- logEventMapper: (logEvent) => {
59
+ logEventMapper: logEvent => {
60
60
  logEvent.message = `[CUSTOM] ${logEvent.message}`;
61
61
  return logEvent;
62
62
  }
@@ -218,6 +218,7 @@ class DdRumImplementation(private val datadog: DatadogWrapper = DatadogSDKWrappe
218
218
  * @param stacktrace The error stacktrace.
219
219
  * @param context The additional context to send.
220
220
  * @param timestampMs The timestamp when the error occurred (in milliseconds). If not provided, current timestamp will be used.
221
+ * @param fingerprint A custom fingerprint to group this error with similar ones.
221
222
  */
222
223
  @Suppress("LongParameterList")
223
224
  fun addError(
@@ -6,7 +6,6 @@
6
6
 
7
7
  package com.datadog.reactnative
8
8
 
9
- import com.datadog.android.core.configuration.BatchProcessingLevel
10
9
  import com.datadog.android.trace.TracingHeaderType
11
10
  import java.net.Proxy
12
11
 
@@ -37,6 +37,9 @@ class DdSdkImplementation(
37
37
  internal val initialized = AtomicBoolean(false)
38
38
  private var frameRateProvider: FrameRateProvider? = null
39
39
 
40
+ @Volatile
41
+ private var maxDisplayRefreshRate: Double? = null
42
+
40
43
  // region DdSdk
41
44
 
42
45
  /**
@@ -383,7 +386,7 @@ class DdSdkImplementation(
383
386
  val frameTimeMs = frameTimeSeconds * 1000.0
384
387
  val frameBudgetHz = fpsBudget ?: DEFAULT_REFRESH_HZ
385
388
  val maxDeviceDisplayHz = deviceDisplayFps ?: getMaxDisplayRefreshRate(context)
386
- ?: 60.0
389
+ ?: DEFAULT_REFRESH_HZ
387
390
 
388
391
  val maxDeviceFrameTimeMs = 1000.0 / maxDeviceDisplayHz
389
392
  val budgetFrameTimeMs = 1000.0 / frameBudgetHz
@@ -402,10 +405,14 @@ class DdSdkImplementation(
402
405
 
403
406
  @Suppress("CyclomaticComplexMethod")
404
407
  private fun getMaxDisplayRefreshRate(context: Context?): Double {
405
- val dm = context?.getSystemService(Context.DISPLAY_SERVICE) as? DisplayManager ?: return 60.0
408
+ maxDisplayRefreshRate?.let { return it }
409
+
410
+ val dm = context?.getSystemService(Context.DISPLAY_SERVICE) as? DisplayManager ?: return DEFAULT_REFRESH_HZ
406
411
  val display: Display = dm.getDisplay(Display.DEFAULT_DISPLAY) ?: return DEFAULT_REFRESH_HZ
412
+ val hz = display.supportedModes.maxOfOrNull { it.refreshRate.toDouble() } ?: DEFAULT_REFRESH_HZ
413
+ maxDisplayRefreshRate = hz
407
414
 
408
- return display.supportedModes.maxOfOrNull { it.refreshRate.toDouble() } ?: DEFAULT_REFRESH_HZ
415
+ return hz
409
416
  }
410
417
 
411
418
  // endregion
@@ -7,7 +7,6 @@
7
7
  package com.datadog.reactnative
8
8
 
9
9
  import com.facebook.react.TurboReactPackage
10
- import com.facebook.react.bridge.LifecycleEventListener
11
10
  import com.facebook.react.bridge.NativeModule
12
11
  import com.facebook.react.bridge.ReactApplicationContext
13
12
  import com.facebook.react.module.model.ReactModuleInfo
@@ -7,4 +7,4 @@
7
7
  package com.datadog.reactnative
8
8
 
9
9
  // This is automatically updated by the update-version.sh script
10
- internal const val SDK_VERSION = "3.5.2"
10
+ internal const val SDK_VERSION = "3.5.3"
@@ -76,6 +76,7 @@ import org.junit.jupiter.params.provider.MethodSource
76
76
  import org.mockito.Answers
77
77
  import org.mockito.Mock
78
78
  import org.mockito.Mockito.mock
79
+ import org.mockito.Mockito.times
79
80
  import org.mockito.Mockito.`when`
80
81
  import org.mockito.junit.jupiter.MockitoExtension
81
82
  import org.mockito.junit.jupiter.MockitoSettings
@@ -3595,6 +3596,35 @@ internal class DdSdkTest {
3595
3596
  assertThat(result).isEqualTo(0.016, Offset.offset(0.001))
3596
3597
  }
3597
3598
 
3599
+ @Test
3600
+ fun `M read supportedModes only once W normalizeFrameTime called multiple times`() {
3601
+ // Given
3602
+ val mockContext = mock(Context::class.java)
3603
+ val mockDisplayManager = mock(DisplayManager::class.java)
3604
+ val mockDisplay = mock(Display::class.java)
3605
+
3606
+ `when`(mockContext.getSystemService(Context.DISPLAY_SERVICE)).thenReturn(mockDisplayManager)
3607
+ `when`(mockDisplayManager.getDisplay(Display.DEFAULT_DISPLAY)).thenReturn(mockDisplay)
3608
+ `when`(mockDisplay.supportedModes).thenReturn(arrayOf())
3609
+
3610
+ // When
3611
+ testedBridgeSdk.normalizeFrameTime(
3612
+ frameTimeSeconds = 0.016,
3613
+ context = mockContext,
3614
+ fpsBudget = null,
3615
+ deviceDisplayFps = null
3616
+ )
3617
+ testedBridgeSdk.normalizeFrameTime(
3618
+ frameTimeSeconds = 0.016,
3619
+ context = mockContext,
3620
+ fpsBudget = null,
3621
+ deviceDisplayFps = null
3622
+ )
3623
+
3624
+ // Then
3625
+ verify(mockDisplay, times(1)).supportedModes
3626
+ }
3627
+
3598
3628
  // endregion
3599
3629
 
3600
3630
  // region Internal
@@ -93,9 +93,9 @@ public class DdLogsImplementation: NSObject {
93
93
  }
94
94
 
95
95
  internal extension DatadogLogs.Logger.Configuration {
96
- /// Creates a Logger configuration from briged configuration dictionary.
96
+ /// Creates a Logger configuration from bridged configuration dictionary.
97
97
  ///
98
- /// - Parameter dictionnary: The configuration from the bridge.
98
+ /// - Parameter sdkConfiguration: The configuration from the bridge.
99
99
  init(_ sdkConfiguration: DdSdkConfiguration) {
100
100
  self.init(
101
101
  networkInfoEnabled: true,
@@ -190,7 +190,6 @@ public class LogsConfiguration: NSObject {
190
190
  /// A configuration object for Datadog Tracing (APM) features.
191
191
  ///
192
192
  /// - Parameters:
193
- /// - resourceTracingSamplingRate: Percentage (0–100) of network resource traces to sample.
194
193
  /// - customEndpoint: A custom Trace intake endpoint to override the default Datadog intake.
195
194
  public class TraceConfiguration: NSObject {
196
195
  public var customEndpoint: String? = nil
@@ -7,4 +7,4 @@
7
7
  import Foundation
8
8
 
9
9
  // This is automatically updated by the update-version.sh script
10
- let SdkVersion = "3.5.2"
10
+ let SdkVersion = "3.5.3"
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // generated by genversion
8
- const version = exports.version = '3.5.2';
8
+ const version = exports.version = '3.5.3';
9
9
  //# sourceMappingURL=version.js.map
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '3.5.2';
2
+ export const version = '3.5.3';
3
3
  //# sourceMappingURL=version.js.map
@@ -1,2 +1,2 @@
1
- export declare const version = "3.5.2";
1
+ export declare const version = "3.5.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": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "A client-side React Native module to interact with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -118,5 +118,5 @@
118
118
  "dependencies": {
119
119
  "big-integer": "^1.6.52"
120
120
  },
121
- "gitHead": "92462dccefd689815d87dabbad0d41572cd06cca"
121
+ "gitHead": "7abbd15c05e878a83db1357a051d3aa3978c47a8"
122
122
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '3.5.2';
2
+ export const version = '3.5.3';