diff --git a/.gitignore b/.gitignore
index 43cfe626..1f760fd6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,6 +44,7 @@ local.properties
android/.classpath
android/.settings
android/.project
+
# Node
node_modules
*.log
@@ -87,3 +88,7 @@ RNTester/build
# VS Code
.vscode/
+
+# Lerna
+.nx/
+nx.json
\ No newline at end of file
diff --git a/DEVELOPING.md b/DEVELOPING.md
index f158d4cf..c2276fc0 100644
--- a/DEVELOPING.md
+++ b/DEVELOPING.md
@@ -13,7 +13,9 @@ Any new package under ./packages/ will get automatically picked up as a new Yarn
- `package.json` with name, description, main, typings (other fields will be filled by yarn constraints, version is supplied by Lerna)
- `tsconfig.json` that extends from the one at the root
- `README.md`
-- `src/` and `__tests__/` folders to contain the code for the package
+- `src/` and `__tests__/` folders to contain the code for the package.
+
+If an item from the previous list is missing, the package won't compile.
## Adding dependencies
@@ -25,6 +27,119 @@ are shared between multiple packages then they should be added to the Yarn const
This is also where we define common peerDependencies and enforce a common version. These are packages such as React Native
that our packages require but that we leave to the customer to have defined as explicit dependencies.
+## Adding new Native Modules
+
+If new packages needs to connect with native code there are few things to have in mind.
+The folder structure should be something like the following:
+
+```
+packages/
+└── my-new-package/
+ ├── ios/ # containing an Xcode workspace/project
+ ├── android/ # containing an Android workspace/project
+ ├── src/
+ │ ├── __tests__/
+ │ └── index.ts
+ ├── tsconfig.json
+ ├── package.json
+ ├── .eslintrc.js
+ ├── README.md
+ └── MyNewPackage.podspec
+```
+
+> Make sure the new `package.json` file list all files/folders we want to get packed during the build and pack process. Example:
+
+```json
+{
+ "files": [
+ "lib",
+ "android",
+ "ios",
+ "NewPackageModule.podspec"
+ ],
+}
+```
+
+This example is configured to pack lib/, android/, ios/ and NewPackageModule.podspec into the package we will publish in the future. All folders/files that should be packed and published should be listed here. If they are not there, the pack/publish process will ignore them.
+
+## iOS Native Module
+
+References are very important when developing a new iOS Standalone Native Module, we encourage developers to create new modules through Xcode to avoid any issue related to this.
+
+### Recommended steps
+
+- Open Xcode and create a new workspace.
+- Create a new target with the same name
+- Create the proper files following the [iOS Native Modules for React Native](https://reactnative.dev/docs/native-modules-ios) official documentation.
+
+This repository already contains classes using Swift. We highly recommend to keep this approach. More information about how to do it can be found in the (official documentation)[https://reactnative.dev/docs/native-modules-ios#exporting-swift].
+
+At the end of this process the ios folder structure should contain something like the following:
+
+```
+ios/
+└── MyNewModule.xcworkspace
+└── MyNewModule/
+ ├── MyNewModule.xcodeproj
+ ├── MyNewModule-Bridging-Header.h
+ ├── MyNewModule.m
+ └── MyNewModule.swift
+```
+
+This is the bare minimum we need to create a new iOS Native Module.
+
+> Do not forget to properly create the .podspec file outside the ios folder listing all dependencies. Also it's a good idea to check in that this file is in place after run the build and pack the new package. Without this file the new iOS Native Module won't be recognized by the application and won't be installed.
+
+## Android Native Module
+
+Also for Android Standalone Native Modules we highly recommend to start the development process using Android Studio.
+
+### Recommended steps
+
+- Open Android Studio and create a new project using Empty Activity template.
+- Provide a proper Project and Package Name (i.e MyNewPiece and io.embrace.mynewpiece respectively)
+- Choose a location to save the new project (under android/ folder), select the languaje for the project and the build configuration and finish the process.
+
+This process is going to create several folders/files with an structure like
+
+```
+android/
+├── src/
+│ └── main/
+│ ├── java/
+│ │ └── io/
+│ │ └── embrace/
+│ │ └── mynewpiece/
+│ │ └── MyNewPiece.java # we will tweak this file name in following steps
+│ ├── res/
+│ └── AndroidManifest.xml
+├── gradlew.bat
+├── gradlew
+├── gradle/
+│ └── wrapper/
+│ ├── gradle-wrapper.properties
+│ └── gradle-wrapper.jar
+├── local.properties
+├── gradle.properties
+├── settings.gradle (or settings.gradle.kts)
+└── build.gradle (or build.gradle.kts)
+```
+
+In order to create an (Android React Native Module)[https://reactnative.dev/docs/native-modules-android] it's also recommended to follow the official documentation
+
+Once this is done files should be the following inside `io.embrace.mynewpiece`:
+
+```
+src/
+└── main/
+ └── java/
+ └── io/
+ └── embrace/
+ └── myapplication/
+ ├── MyNewPieceModule.java
+ └── MyNewPiecePackage.java
+```
+
## Testing changes during development
From the root of the project you can lint and test all packages with:
diff --git a/integration-tests/basic-test-app/app/(tabs)/index.tsx b/integration-tests/basic-test-app/app/(tabs)/index.tsx
index 14900b98..fd21486a 100644
--- a/integration-tests/basic-test-app/app/(tabs)/index.tsx
+++ b/integration-tests/basic-test-app/app/(tabs)/index.tsx
@@ -51,7 +51,7 @@ const HomeScreen = () => {
"custom.property.test": "hey",
"another.property": "ho",
"yet.another": "hum",
- "rn.sdk.test": 1234567,
+ "rn.sdk.test": "1234567",
});
}, []);
@@ -84,6 +84,22 @@ const HomeScreen = () => {
title="CRASH (not anonymous)"
/>
+
+
+ Logs
+
+
+
+
+
+
+ Crashes (Unhandled Exceptions)
+
+
+
);
};
diff --git a/integration-tests/basic-test-app/app/_layout.tsx b/integration-tests/basic-test-app/app/_layout.tsx
index bf51f2c7..add8e5fc 100644
--- a/integration-tests/basic-test-app/app/_layout.tsx
+++ b/integration-tests/basic-test-app/app/_layout.tsx
@@ -5,6 +5,7 @@ import * as SplashScreen from "expo-splash-screen";
import {useEffect} from "react";
import "react-native-reanimated";
import {initialize as initEmbrace} from "@embrace-io/react-native";
+import {initialize as initEmbraceWithCustomExporters} from "@embrace-io/react-native-otlp";
import {useColorScheme} from "@/hooks/useColorScheme";
@@ -12,6 +13,25 @@ import {useColorScheme} from "@/hooks/useColorScheme";
SplashScreen.preventAutoHideAsync();
export default function RootLayout() {
+ const initWithCustomExporters = initEmbraceWithCustomExporters({
+ // logExporter: {
+ // endpoint: "http://localhost:4317/v1/logs",
+ // header: {
+ // key: "a-key",
+ // token: "a-token",
+ // },
+ // timeout: 30000,
+ // },
+ traceExporter: {
+ endpoint: "http://localhost:8080/otlp-http/v1/traces",
+ // header: {
+ // key: "a-key",
+ // token: "a-token",
+ // },
+ timeout: 30000,
+ },
+ });
+
useEffect(() => {
const init = async () => {
await initEmbrace({
@@ -20,6 +40,7 @@ export default function RootLayout() {
appId: "abcdf",
// endpointBaseUrl: "http://localhost:8877",
},
+ replaceInit: initWithCustomExporters,
},
});
};
diff --git a/integration-tests/basic-test-app/ios/Podfile b/integration-tests/basic-test-app/ios/Podfile
index 55166436..110cef80 100644
--- a/integration-tests/basic-test-app/ios/Podfile
+++ b/integration-tests/basic-test-app/ios/Podfile
@@ -14,6 +14,8 @@ install! 'cocoapods',
:deterministic_uuids => false
prepare_react_native_project!
+# include the following when using 'EmbraceInternalGrpcSwift'
+# use_modular_headers!
target 'basictestapp' do
use_expo_modules!
diff --git a/integration-tests/basic-test-app/ios/Podfile.lock b/integration-tests/basic-test-app/ios/Podfile.lock
index df299598..53babcc9 100644
--- a/integration-tests/basic-test-app/ios/Podfile.lock
+++ b/integration-tests/basic-test-app/ios/Podfile.lock
@@ -1,6 +1,7 @@
PODS:
- boost (1.83.0)
- DoubleConversion (1.1.6)
+ - EmbraceInternalSwiftLog (1.4.4-internal)
- EmbraceIO (6.4.2):
- EmbraceIO/EmbraceIO (= 6.4.2)
- EmbraceIO/EmbraceCaptureService (6.4.2):
@@ -60,18 +61,18 @@ PODS:
- EXJSONUtils (0.13.1)
- EXManifests (0.14.3):
- ExpoModulesCore
- - Expo (51.0.9):
+ - Expo (51.0.32):
- ExpoModulesCore
- - expo-dev-client (4.0.15):
+ - expo-dev-client (4.0.26):
- EXManifests
- expo-dev-launcher
- expo-dev-menu
- expo-dev-menu-interface
- EXUpdatesInterface
- - expo-dev-launcher (4.0.16):
+ - expo-dev-launcher (4.0.27):
- DoubleConversion
- EXManifests
- - expo-dev-launcher/Main (= 4.0.16)
+ - expo-dev-launcher/Main (= 4.0.27)
- expo-dev-menu
- expo-dev-menu-interface
- ExpoModulesCore
@@ -97,7 +98,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- - expo-dev-launcher/Main (4.0.16):
+ - expo-dev-launcher/Main (4.0.27):
- DoubleConversion
- EXManifests
- expo-dev-launcher/Unsafe
@@ -126,7 +127,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- - expo-dev-launcher/Unsafe (4.0.16):
+ - expo-dev-launcher/Unsafe (4.0.27):
- DoubleConversion
- EXManifests
- expo-dev-menu
@@ -154,10 +155,10 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- - expo-dev-menu (5.0.14):
+ - expo-dev-menu (5.0.21):
- DoubleConversion
- - expo-dev-menu/Main (= 5.0.14)
- - expo-dev-menu/ReactNativeCompatibles (= 5.0.14)
+ - expo-dev-menu/Main (= 5.0.21)
+ - expo-dev-menu/ReactNativeCompatibles (= 5.0.21)
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
@@ -178,7 +179,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- expo-dev-menu-interface (1.8.3)
- - expo-dev-menu/Main (5.0.14):
+ - expo-dev-menu/Main (5.0.21):
- DoubleConversion
- EXManifests
- expo-dev-menu-interface
@@ -204,7 +205,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- - expo-dev-menu/ReactNativeCompatibles (5.0.14):
+ - expo-dev-menu/ReactNativeCompatibles (5.0.21):
- DoubleConversion
- glog
- hermes-engine
@@ -225,7 +226,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- - expo-dev-menu/SafeAreaView (5.0.14):
+ - expo-dev-menu/SafeAreaView (5.0.21):
- DoubleConversion
- ExpoModulesCore
- glog
@@ -247,7 +248,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- - expo-dev-menu/Vendored (5.0.14):
+ - expo-dev-menu/Vendored (5.0.21):
- DoubleConversion
- expo-dev-menu/SafeAreaView
- glog
@@ -269,17 +270,17 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- - ExpoAsset (10.0.6):
+ - ExpoAsset (10.0.10):
- ExpoModulesCore
- ExpoFileSystem (17.0.1):
- ExpoModulesCore
- - ExpoFont (12.0.6):
+ - ExpoFont (12.0.10):
- ExpoModulesCore
- - ExpoHead (3.5.14):
+ - ExpoHead (3.5.23):
- ExpoModulesCore
- ExpoKeepAwake (13.0.2):
- ExpoModulesCore
- - ExpoModulesCore (1.12.12):
+ - ExpoModulesCore (1.12.24):
- DoubleConversion
- glog
- hermes-engine
@@ -302,11 +303,11 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- - ExpoSystemUI (3.0.4):
+ - ExpoSystemUI (3.0.7):
- ExpoModulesCore
- ExpoWebBrowser (13.0.3):
- ExpoModulesCore
- - EXSplashScreen (0.27.4):
+ - EXSplashScreen (0.27.5):
- DoubleConversion
- ExpoModulesCore
- glog
@@ -1495,9 +1496,14 @@ PODS:
- React-logger (= 0.74.1)
- React-perflogger (= 0.74.1)
- React-utils (= 0.74.1)
- - RNEmbrace (5.0.0):
+ - RNEmbrace (5.0.1):
- EmbraceIO (= 6.4.2)
- React-Core
+ - RNEmbraceOTLP (5.0.1):
+ - EmbraceInternalSwiftLog (= 1.4.4-internal)
+ - EmbraceIO (= 6.4.2)
+ - React-Core
+ - SwiftProtobuf (= 1.20.2)
- RNGestureHandler (2.16.2):
- DoubleConversion
- glog
@@ -1563,6 +1569,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- SocketRocket (0.7.0)
+ - SwiftProtobuf (1.20.2)
- Yoga (0.0.0)
DEPENDENCIES:
@@ -1641,6 +1648,7 @@ DEPENDENCIES:
- React-utils (from `../node_modules/react-native/ReactCommon/react/utils`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- "RNEmbrace (from `../node_modules/@embrace-io/react-native`)"
+ - "RNEmbraceOTLP (from `../node_modules/@embrace-io/react-native-otlp`)"
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
@@ -1648,8 +1656,10 @@ DEPENDENCIES:
SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
+ - EmbraceInternalSwiftLog
- EmbraceIO
- SocketRocket
+ - SwiftProtobuf
EXTERNAL SOURCES:
boost:
@@ -1799,6 +1809,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon"
RNEmbrace:
:path: "../node_modules/@embrace-io/react-native"
+ RNEmbraceOTLP:
+ :path: "../node_modules/@embrace-io/react-native-otlp"
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
RNReanimated:
@@ -1811,24 +1823,25 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
DoubleConversion: 76ab83afb40bddeeee456813d9c04f67f78771b5
+ EmbraceInternalSwiftLog: a7b20002f2ca34400678012c3c3e8f7d51da5c79
EmbraceIO: ebbe930c0d46039a533979bf98f8cef1c1a347f1
EXConstants: 409690fbfd5afea964e5e9d6c4eb2c2b59222c59
EXJSONUtils: 30c17fd9cc364d722c0946a550dfbf1be92ef6a4
EXManifests: c1fab4c3237675e7b0299ea8df0bcb14baca4f42
- Expo: 6381470c669c3f31c8ac0ebd8e88686f925146ad
- expo-dev-client: 48494556ca0cef533fb646443bda456d0280827f
- expo-dev-launcher: 39b26f372ede78fb636cd404e6e3ddbc59331e5a
- expo-dev-menu: 8559d77f4037c6105b21a424dec68f235496c391
+ Expo: 33132a667698a3259a4e6c0af1b4936388e5fa33
+ expo-dev-client: 4f9100af6be210a360aa67f42649881251aa362a
+ expo-dev-launcher: c8e85bf244a2492448c88adbc3585ca13572f7b9
+ expo-dev-menu: 0db38ce92be7228dadb588f7069e037fd9d165d8
expo-dev-menu-interface: be32c09f1e03833050f0ee290dcc86b3ad0e73e4
- ExpoAsset: 9b7433ecc5f1b608ccbb823492e062bde944abd2
+ ExpoAsset: 323700f291684f110fb55f0d4022a3362ea9f875
ExpoFileSystem: 80bfe850b1f9922c16905822ecbf97acd711dc51
- ExpoFont: c84702079267ae51161c20bb8b925670907ffa2f
- ExpoHead: 28ccee5977648d15f6a62b9a680a4bd169a1515b
+ ExpoFont: 00756e6c796d8f7ee8d211e29c8b619e75cbf238
+ ExpoHead: fcb28a68ed4ba28f177394d2dfb8a0a8824cd103
ExpoKeepAwake: 3b8815d9dd1d419ee474df004021c69fdd316d08
- ExpoModulesCore: 828d63de45d4fbacabe2963fc406a8e9daeed992
- ExpoSystemUI: b5ecc4b6781b6369fb8b3a0903bea36fae3dd090
+ ExpoModulesCore: f30a203ff1863bab3dd9f4421e7fc1564797f18a
+ ExpoSystemUI: d4f065a016cae6721b324eb659cdee4d4cf0cb26
ExpoWebBrowser: 7595ccac6938eb65b076385fd23d035db9ecdc8e
- EXSplashScreen: d439ca817211886dc80a00f3761e3b6d861d7205
+ EXSplashScreen: fbf0ec78e9cee911df188bf17b4fe51d15a84b87
EXUpdatesInterface: 996527fd7d1a5d271eb523258d603f8f92038f24
FBLazyVector: 898d14d17bf19e2435cafd9ea2a1033efe445709
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
@@ -1882,13 +1895,15 @@ SPEC CHECKSUMS:
React-runtimescheduler: e2152ed146b6a35c07386fc2ac4827b27e6aad12
React-utils: 3285151c9d1e3a28a9586571fc81d521678c196d
ReactCommon: f42444e384d82ab89184aed5d6f3142748b54768
- RNEmbrace: 73c04decc2c9c546269a99ce8bbf3110e2ca7d9d
+ RNEmbrace: 62fa472d78c9e0e1fcbdbb3281c85b20220cc837
+ RNEmbraceOTLP: d3a548896f79653d63474f846a3e27e3913ae142
RNGestureHandler: 2282cfbcf86c360d29f44ace393203afd5c6cff7
RNReanimated: 35f9ac9c3ac42d0497ebd1cce5c39d7687a8493e
RNScreens: b32a9ff15bea7fcdbe5dff6477bc503f792b1208
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
- Yoga: b9a182ab00cf25926e7f79657d08c5d23c2d03b0
+ SwiftProtobuf: 9f458aaa7844a2fc0b910053e66578bc4e2da9c1
+ Yoga: 348f8b538c3ed4423eb58a8e5730feec50bce372
-PODFILE CHECKSUM: 1edead627dbfaafffa1f3d9403f6946f03ecf4c1
+PODFILE CHECKSUM: cdb0285a603c422871c56b4e8612b56df6bca33e
COCOAPODS: 1.15.2
diff --git a/integration-tests/basic-test-app/package.json b/integration-tests/basic-test-app/package.json
index 9d659b34..ee590017 100644
--- a/integration-tests/basic-test-app/package.json
+++ b/integration-tests/basic-test-app/package.json
@@ -1,7 +1,6 @@
{
"name": "basic-test-app",
"main": "expo-router/entry",
- "version": "1.0.0",
"scripts": {
"start": "expo start",
"reset-project": "node ./scripts/reset-project.js",
@@ -16,6 +15,7 @@
},
"dependencies": {
"@embrace-io/react-native": "file:../artifacts/embrace-io-react-native-local.tgz",
+ "@embrace-io/react-native-otlp": "file:../artifacts/embrace-io-react-native-otlp-local.tgz",
"@expo/vector-icons": "^14.0.0",
"@react-navigation/native": "^6.0.2",
"expo": "~51.0.9",
diff --git a/integration-tests/update-local-embrace.sh b/integration-tests/update-local-embrace.sh
index 8909f928..943105cd 100755
--- a/integration-tests/update-local-embrace.sh
+++ b/integration-tests/update-local-embrace.sh
@@ -3,10 +3,13 @@
# build required packages
pushd ..
npx lerna run build --scope=@embrace-io/react-native
+npx lerna run build --scope=@embrace-io/react-native-otlp
popd
# pack required packages into tarballs
./pack.sh ../packages/core/ artifacts/embrace-io-react-native-local.tgz
+./pack.sh ../packages/react-native-otlp/ artifacts/embrace-io-react-native-otlp-local.tgz
# install
npm --prefix basic-test-app add ./artifacts/embrace-io-react-native-local.tgz
+npm --prefix basic-test-app add ./artifacts/embrace-io-react-native-otlp-local.tgz
diff --git a/jest.config.js b/jest.config.js
index baaf17de..c4f3c465 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -13,6 +13,7 @@ module.exports = {
"/examples/",
"/integration-tests/",
"/packages/core/test-project/",
+ "/packages/.*/node_modules/",
],
collectCoverage: true,
coverageThreshold: {
diff --git a/package.json b/package.json
index e3c6f8b0..66401752 100644
--- a/package.json
+++ b/package.json
@@ -35,6 +35,7 @@
"@babel/preset-env": "^7.9.5",
"@babel/preset-react": "^7.24.7",
"@babel/preset-typescript": "^7.24.7",
+ "@react-native-community/cli-platform-ios": "^3.2.0",
"@react-native-community/eslint-config": "^3.2.0",
"@types/gzip-js": "^0.3.3",
"@types/jest": "^29.5.13",
diff --git a/packages/core/android/gradle.properties b/packages/core/android/gradle.properties
index fae6efd9..108ed12e 100644
--- a/packages/core/android/gradle.properties
+++ b/packages/core/android/gradle.properties
@@ -1 +1 @@
-emb_android_sdk=6.13.0
\ No newline at end of file
+emb_android_sdk=6.13.0
diff --git a/packages/core/ios/.swiftlint.yml b/packages/core/ios/.swiftlint.yml
deleted file mode 100644
index 63576a16..00000000
--- a/packages/core/ios/.swiftlint.yml
+++ /dev/null
@@ -1,40 +0,0 @@
-disabled_rules: # rule identifiers turned on by default to exclude from running
- - identifier_name
- - function_parameter_count
- - notification_center_detachment
- - compiler_protocol_init
-
-opt_in_rules:
- - conditional_returns_on_newline
-
-reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, codeclimate, junit, html, emoji, sonarqube, markdown, github-actions-logging, summary)
-
-file_length:
- warning: 800
- error: 1000
-
-line_length:
- ignores_comments: true
- ignores_interpolated_strings: true
-
-type_body_length:
- warning: 600
- error: 800
-
-type_name:
- max_length:
- warning: 60
- allowed_symbols: ["_"]
-
-function_body_length:
- warning: 100
- error: 300
-
-large_tuple:
- warning: 4
- error: 6
-
-cyclomatic_complexity:
- ignores_case_statements: true
- warning: 20
- error: 30
diff --git a/packages/core/ios/RNEmbrace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/packages/core/ios/RNEmbrace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 00000000..18d98100
--- /dev/null
+++ b/packages/core/ios/RNEmbrace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/packages/core/ios/RNEmbrace/EmbraceManager.swift b/packages/core/ios/RNEmbrace/EmbraceManager.swift
index 76df4a76..b71ae7ff 100644
--- a/packages/core/ios/RNEmbrace/EmbraceManager.swift
+++ b/packages/core/ios/RNEmbrace/EmbraceManager.swift
@@ -94,7 +94,10 @@ class EmbraceManager: NSObject {
platform: .reactNative,
endpoints: endpoints,
captureServices: servicesBuilder.build(),
- crashReporter: crashReporter
+ crashReporter: crashReporter,
+ // if config is here, add it
+ // config.exporter
+ export: nil
)
}
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 2a39c05c..dae2eefe 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -66,7 +66,7 @@ const handleError = async (error: Error, callback: () => void) => {
const isObjectNonEmpty = (obj?: object): boolean =>
Object.keys(obj || {}).length > 0;
-export const initialize = async ({
+const initialize = async ({
patch,
sdkConfig,
}: {patch?: string; sdkConfig?: SDKConfig} = {}): Promise => {
@@ -81,11 +81,19 @@ export const initialize = async ({
return createFalsePromise();
}
- const result = await NativeModules.EmbraceManager.startNativeEmbraceSDK(
- (Platform.OS === "ios" && sdkConfig?.ios) || {},
- );
+ const {replaceInit: customStartEmbraceSDK, ...originalSdkConfig} =
+ sdkConfig || {};
+
+ const startSdkConfig =
+ (Platform.OS === "ios" && originalSdkConfig?.ios) || {};
+
+ const isStarted = customStartEmbraceSDK
+ ? await customStartEmbraceSDK(startSdkConfig)
+ : await NativeModules.EmbraceManager.startNativeEmbraceSDK(
+ startSdkConfig,
+ );
- if (!result) {
+ if (!isStarted) {
console.warn(
"[Embrace] We could not initialize Embrace's native SDK, please check the Embrace integration docs at https://embrace.io/docs/react-native/integration/",
);
@@ -390,5 +398,5 @@ const createTruePromise = (): Promise => {
});
};
-export {WARNING, ERROR, INFO};
+export {initialize, WARNING, ERROR, INFO};
export {type Properties};
diff --git a/packages/core/src/interfaces/Config.ts b/packages/core/src/interfaces/Config.ts
index ee3f11e7..f00d1c82 100644
--- a/packages/core/src/interfaces/Config.ts
+++ b/packages/core/src/interfaces/Config.ts
@@ -1,12 +1,18 @@
/**
* Defines the SDK configuration that can be passed into `initialize`
*/
-export interface SDKConfig {
- ios?: {
- appId: string;
- appGroupId?: string;
- disableCrashReporter?: boolean;
- disableAutomaticViewCapture?: boolean;
- endpointBaseUrl?: string;
- };
+
+interface IOSConfig {
+ appId: string;
+ appGroupId?: string;
+ disableCrashReporter?: boolean;
+ disableAutomaticViewCapture?: boolean;
+ endpointBaseUrl?: string;
}
+
+interface SDKConfig {
+ ios?: IOSConfig;
+ replaceInit?: (config: IOSConfig | NonNullable