@datadog/mobile-react-native 3.0.2 → 3.0.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.
@@ -224,6 +224,7 @@ dependencies {
224
224
  testImplementation "com.github.xgouchet.Elmyr:jvm:1.3.1"
225
225
  testImplementation "org.mockito.kotlin:mockito-kotlin:5.1.0"
226
226
  testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
227
+ testImplementation("org.mockito:mockito-inline:5.2.0")
227
228
 
228
229
  unmock 'org.robolectric:android-all:4.4_r1-robolectric-r2'
229
230
  detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.23.8"
@@ -397,7 +397,7 @@ class DdSdkImplementation(
397
397
  val dm = context?.getSystemService(Context.DISPLAY_SERVICE) as? DisplayManager ?: return 60.0
398
398
  val display: Display = dm.getDisplay(Display.DEFAULT_DISPLAY) ?: return DEFAULT_REFRESH_HZ
399
399
 
400
- return display.supportedModes.maxOf { it.refreshRate.toDouble() }
400
+ return display.supportedModes.maxOfOrNull { it.refreshRate.toDouble() } ?: DEFAULT_REFRESH_HZ
401
401
  }
402
402
 
403
403
  // endregion
@@ -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.0.2"
10
+ internal const val SDK_VERSION = "3.0.3"
@@ -6,10 +6,13 @@
6
6
 
7
7
  package com.datadog.reactnative
8
8
 
9
+ import android.content.Context
9
10
  import android.content.pm.PackageInfo
11
+ import android.hardware.display.DisplayManager
10
12
  import android.os.Looper
11
13
  import android.util.Log
12
14
  import android.view.Choreographer
15
+ import android.view.Display
13
16
  import com.datadog.android.DatadogSite
14
17
  import com.datadog.android.core.configuration.BatchProcessingLevel
15
18
  import com.datadog.android.core.configuration.BatchSize
@@ -71,6 +74,8 @@ import org.junit.jupiter.params.provider.Arguments
71
74
  import org.junit.jupiter.params.provider.MethodSource
72
75
  import org.mockito.Answers
73
76
  import org.mockito.Mock
77
+ import org.mockito.Mockito.mock
78
+ import org.mockito.Mockito.`when`
74
79
  import org.mockito.junit.jupiter.MockitoExtension
75
80
  import org.mockito.junit.jupiter.MockitoSettings
76
81
  import org.mockito.kotlin.any
@@ -3452,6 +3457,29 @@ internal class DdSdkTest {
3452
3457
  assertThat(frameTimeSeconds).isEqualTo(0.016, Offset.offset(0.001))
3453
3458
  }
3454
3459
 
3460
+ @Test
3461
+ fun `M getMaxDisplayRefreshRate returns default when supportedModes is empty`() {
3462
+ // Given
3463
+ val mockContext = mock(Context::class.java)
3464
+ val mockDisplayManager = mock(DisplayManager::class.java)
3465
+ val mockDisplay = mock(Display::class.java)
3466
+
3467
+ `when`(mockContext.getSystemService(Context.DISPLAY_SERVICE)).thenReturn(mockDisplayManager)
3468
+ `when`(mockDisplayManager.getDisplay(Display.DEFAULT_DISPLAY)).thenReturn(mockDisplay)
3469
+ `when`(mockDisplay.supportedModes).thenReturn(arrayOf())
3470
+
3471
+ // When
3472
+ val result = testedBridgeSdk.normalizeFrameTime(
3473
+ frameTimeSeconds = 0.016,
3474
+ context = mockContext,
3475
+ fpsBudget = null,
3476
+ deviceDisplayFps = null
3477
+ )
3478
+
3479
+ // Then
3480
+ assertThat(result).isEqualTo(0.016, Offset.offset(0.001))
3481
+ }
3482
+
3455
3483
  // endregion
3456
3484
 
3457
3485
  // region Internal
@@ -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.0.2"
10
+ let SdkVersion = "3.0.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.0.2';
8
+ const version = exports.version = '3.0.3';
9
9
  //# sourceMappingURL=version.js.map
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '3.0.2';
2
+ export const version = '3.0.3';
3
3
  //# sourceMappingURL=version.js.map
@@ -1,2 +1,2 @@
1
- export declare const version = "3.0.2";
1
+ export declare const version = "3.0.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.0.2",
3
+ "version": "3.0.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": "5ba4e339092388a29f5fe19df8a21451ed89f083"
121
+ "gitHead": "8bdc86971007bead67d1d72f6454677fce07a89f"
122
122
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '3.0.2';
2
+ export const version = '3.0.3';