-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
louiszawadzki
committed
Dec 5, 2023
1 parent
876dac1
commit b1c4c9e
Showing
7 changed files
with
122 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/core/android/src/main/kotlin/com/datadog/reactnative/DdCoreTestsImplementation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
* This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
* Copyright 2016-Present Datadog, Inc. | ||
*/ | ||
|
||
package com.datadog.reactnative | ||
|
||
import com.datadog.android.Datadog | ||
import com.datadog.android.core.DatadogCoreProxy | ||
import com.facebook.react.bridge.Promise | ||
import com.facebook.react.bridge.ReadableMap | ||
|
||
/** | ||
* The entry point to use Datadog's Core Tests feature. | ||
*/ | ||
class DdCoreTestsImplementation() { | ||
fun clearData(promise: Promise) { | ||
val core = Datadog.getInstance() as DatadogCoreProxy | ||
core.clearData("logs") | ||
core.clearData("rum") | ||
core.clearData("tracing") | ||
core.clearData("session-replay") | ||
|
||
promise.resolve(null) | ||
} | ||
|
||
fun getAllEventsData(feature: String, promise: Promise) { | ||
val core = Datadog.getInstance() as DatadogCoreProxy | ||
val events = core.eventsWritten(feature) | ||
promise.resolve(events.toString()) | ||
} | ||
|
||
companion object { | ||
internal const val NAME = "DdCoreTests" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
packages/core/android/src/newarch/kotlin/com/datadog/reactnative/DdCoreTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
* This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
* Copyright 2016-Present Datadog, Inc. | ||
*/ | ||
|
||
package com.datadog.reactnative | ||
|
||
import com.facebook.react.bridge.Promise | ||
import com.facebook.react.bridge.ReactApplicationContext | ||
import com.facebook.react.bridge.ReactMethod | ||
import com.facebook.react.bridge.ReadableMap | ||
|
||
/** | ||
* The entry point to use Datadog's Core Tests feature. | ||
*/ | ||
class DdCoreTests( | ||
reactContext: ReactApplicationContext, | ||
) : NativeDdCoreTestsSpec(reactContext) { | ||
|
||
private val implementation = DdCoreTestsImplementation() | ||
|
||
override fun getName(): String = DdCoreTestsImplementation.NAME | ||
|
||
@ReactMethod | ||
override fun clearData(promise: Promise) { | ||
implementation.clearData(promise) | ||
} | ||
|
||
@ReactMethod | ||
override fun getAllEventsData(feature: String, promise: Promise) { | ||
implementation.getAllEventsData(feature, promise) | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
packages/core/android/src/oldarch/kotlin/com/datadog/reactnative/DdCoreTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | ||
* This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
* Copyright 2016-Present Datadog, Inc. | ||
*/ | ||
|
||
package com.datadog.reactnative | ||
|
||
import com.facebook.react.bridge.Promise | ||
import com.facebook.react.bridge.ReactApplicationContext | ||
import com.facebook.react.bridge.ReactContextBaseJavaModule | ||
import com.facebook.react.bridge.ReactMethod | ||
import com.facebook.react.bridge.ReadableMap | ||
|
||
/** | ||
* The entry point to use Datadog's Core Tests feature. | ||
*/ | ||
class DdCoreTests( | ||
reactContext: ReactApplicationContext | ||
) : ReactContextBaseJavaModule(reactContext) { | ||
|
||
private val implementation = DdCoreTestsImplementation() | ||
|
||
override fun getName(): String = DdCoreTestsImplementation.NAME | ||
|
||
@ReactMethod | ||
fun clearData(promise: Promise) { | ||
implementation.clearData(promise) | ||
} | ||
|
||
@ReactMethod | ||
fun getAllEventsData(feature: String, promise: Promise) { | ||
implementation.getAllEventsData(feature, promise) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters