From aefa2513296045f6875ee321611147d18c83ba7d Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Fri, 27 Dec 2024 13:55:39 +0100 Subject: [PATCH] tracker: react native "sendMessage" hook for gql integration --- tracker/tracker-reactnative/README.md | 28 +++++ .../example/ios/Podfile.lock | 8 +- .../project.pbxproj | 112 +++++++++--------- .../tracker-reactnative/example/src/App.tsx | 31 +++++ .../ios/ReactNativeORConnector.m | 4 +- .../ios/ReactNativeORConnector.swift | 2 +- .../openreplay-react-native.podspec | 6 +- tracker/tracker-reactnative/src/index.tsx | 17 ++- 8 files changed, 136 insertions(+), 72 deletions(-) diff --git a/tracker/tracker-reactnative/README.md b/tracker/tracker-reactnative/README.md index 438ce9750..96ac330db 100644 --- a/tracker/tracker-reactnative/README.md +++ b/tracker/tracker-reactnative/README.md @@ -9,3 +9,31 @@ npm install @openreplay/react-native ``` Please see [the documentation](https://docs.openreplay.com/en/rn-sdk/) for more information about usage. + +### React Native and GraphQL + +You can use [@openreplay/tracker-graphql](https://www.npmjs.com/package/@openreplay/tracker-graphql) to handle graphql events in react-native applications as well, via + +```js +import { createRelayMiddleware } from '@openreplay/tracker-graphql'; + +const appWrapper = { + active: () => true, + send: (gqlMsg) => { + const type = 'gql'; + const msg = JSON.stringify({ + operationKind: gqlMsg[1], + operationName: gqlMsg[2], + variables: gqlMsg[3], + response: gqlMsg[4], + duration: gqlMsg[5], + }); + Openreplay.sendCustomMessage(type, msg); + }, +}; + +// @ts-ignore - emulating web tracker here for middleware +const middleware = createRelayMiddleware(appWrapper); + +// .. connect to relay network layer +``` diff --git a/tracker/tracker-reactnative/example/ios/Podfile.lock b/tracker/tracker-reactnative/example/ios/Podfile.lock index ea9b6ffbe..4a0f93b59 100644 --- a/tracker/tracker-reactnative/example/ios/Podfile.lock +++ b/tracker/tracker-reactnative/example/ios/Podfile.lock @@ -9,14 +9,14 @@ PODS: - hermes-engine (0.74.0): - hermes-engine/Pre-built (= 0.74.0) - hermes-engine/Pre-built (0.74.0) - - Openreplay (1.0.15): + - Openreplay (1.0.17): - DeviceKit - SWCompression - openreplay-react-native (0.6.11): - DoubleConversion - glog - hermes-engine - - Openreplay (= 1.0.15) + - Openreplay (= 1.0.17) - RCT-Folly (= 2024.01.01.00) - RCTRequired - RCTTypeSafety @@ -1423,8 +1423,8 @@ SPEC CHECKSUMS: fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120 glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2 hermes-engine: 6eae7edb2f563ee41d7c1f91f4f2e57c26d8a5c3 - Openreplay: ae72a7ca1a05d7da026b7ee8f4f84dcdfaa44021 - openreplay-react-native: 0cfa1842c5b2457f6e9d5fa564f746192317b20c + Openreplay: 2bffa68a1606c95cd04618f0095864649d076d40 + openreplay-react-native: e77361570814a3c92483423b463011536b2346b6 RCT-Folly: 045d6ecaa59d826c5736dfba0b2f4083ff8d79df RCTDeprecation: 3ca8b6c36bfb302e1895b72cfe7db0de0c92cd47 RCTRequired: 9fc183af555fd0c89a366c34c1ae70b7e03b1dc5 diff --git a/tracker/tracker-reactnative/example/ios/ReactNativeExample.xcodeproj/project.pbxproj b/tracker/tracker-reactnative/example/ios/ReactNativeExample.xcodeproj/project.pbxproj index 7617be730..e9fa8ae95 100644 --- a/tracker/tracker-reactnative/example/ios/ReactNativeExample.xcodeproj/project.pbxproj +++ b/tracker/tracker-reactnative/example/ios/ReactNativeExample.xcodeproj/project.pbxproj @@ -11,9 +11,9 @@ 13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.mm */; }; 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; + 1B3DD9657AF7850CB6FA1B53 /* libPods-ReactNativeExample-ReactNativeExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 68F0ED938F2BC97A9BFD4365 /* libPods-ReactNativeExample-ReactNativeExampleTests.a */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; - 8CFDEAD4DCE52688468D5C80 /* libPods-ReactNativeExample-ReactNativeExampleTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5A889A4784F36428D3856494 /* libPods-ReactNativeExample-ReactNativeExampleTests.a */; }; - C7F3F3B67AF0BA29F7DAC50F /* libPods-ReactNativeExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F4C922963FC6C79114841BE6 /* libPods-ReactNativeExample.a */; }; + DA89C15737C59610E15C36FD /* libPods-ReactNativeExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 900A29F732B0D23F50779293 /* libPods-ReactNativeExample.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -30,6 +30,7 @@ 00E356EE1AD99517003FC87E /* ReactNativeExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ReactNativeExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 00E356F21AD99517003FC87E /* ReactNativeExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReactNativeExampleTests.m; sourceTree = ""; }; + 01E603FB97835EE257543318 /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig"; sourceTree = ""; }; 13B07F961A680F5B00A75B9A /* ReactNativeExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReactNativeExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ReactNativeExample/AppDelegate.h; sourceTree = ""; }; 13B07FB01A68108700A75B9A /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AppDelegate.mm; path = ReactNativeExample/AppDelegate.mm; sourceTree = ""; }; @@ -37,14 +38,13 @@ 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ReactNativeExample/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ReactNativeExample/main.m; sourceTree = ""; }; 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = ReactNativeExample/PrivacyInfo.xcprivacy; sourceTree = ""; }; - 212B4F1F0ABCF375B1354A0B /* Pods-ReactNativeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample.debug.xcconfig"; sourceTree = ""; }; - 5A889A4784F36428D3856494 /* libPods-ReactNativeExample-ReactNativeExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeExample-ReactNativeExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - 6102A46EF47DB7D6762C9A2B /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig"; sourceTree = ""; }; + 4ACA5716B98C6ABE43A0766D /* Pods-ReactNativeExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample.debug.xcconfig"; sourceTree = ""; }; + 51D080F1BD4B263A1A494122 /* Pods-ReactNativeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample.release.xcconfig"; sourceTree = ""; }; + 68F0ED938F2BC97A9BFD4365 /* libPods-ReactNativeExample-ReactNativeExampleTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeExample-ReactNativeExampleTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 7237FA23C741052532F892F9 /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig"; sourceTree = ""; }; 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = ReactNativeExample/LaunchScreen.storyboard; sourceTree = ""; }; - 837561A5C741BC8B67930889 /* Pods-ReactNativeExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample.release.xcconfig"; sourceTree = ""; }; - EA74B193F79CA13EE3B460C6 /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig"; sourceTree = ""; }; + 900A29F732B0D23F50779293 /* libPods-ReactNativeExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; - F4C922963FC6C79114841BE6 /* libPods-ReactNativeExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -52,7 +52,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8CFDEAD4DCE52688468D5C80 /* libPods-ReactNativeExample-ReactNativeExampleTests.a in Frameworks */, + 1B3DD9657AF7850CB6FA1B53 /* libPods-ReactNativeExample-ReactNativeExampleTests.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -60,7 +60,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C7F3F3B67AF0BA29F7DAC50F /* libPods-ReactNativeExample.a in Frameworks */, + DA89C15737C59610E15C36FD /* libPods-ReactNativeExample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -102,8 +102,8 @@ isa = PBXGroup; children = ( ED297162215061F000B7C4FE /* JavaScriptCore.framework */, - F4C922963FC6C79114841BE6 /* libPods-ReactNativeExample.a */, - 5A889A4784F36428D3856494 /* libPods-ReactNativeExample-ReactNativeExampleTests.a */, + 900A29F732B0D23F50779293 /* libPods-ReactNativeExample.a */, + 68F0ED938F2BC97A9BFD4365 /* libPods-ReactNativeExample-ReactNativeExampleTests.a */, ); name = Frameworks; sourceTree = ""; @@ -142,10 +142,10 @@ BBD78D7AC51CEA395F1C20DB /* Pods */ = { isa = PBXGroup; children = ( - 212B4F1F0ABCF375B1354A0B /* Pods-ReactNativeExample.debug.xcconfig */, - 837561A5C741BC8B67930889 /* Pods-ReactNativeExample.release.xcconfig */, - EA74B193F79CA13EE3B460C6 /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */, - 6102A46EF47DB7D6762C9A2B /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */, + 4ACA5716B98C6ABE43A0766D /* Pods-ReactNativeExample.debug.xcconfig */, + 51D080F1BD4B263A1A494122 /* Pods-ReactNativeExample.release.xcconfig */, + 7237FA23C741052532F892F9 /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */, + 01E603FB97835EE257543318 /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -157,12 +157,12 @@ isa = PBXNativeTarget; buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ReactNativeExampleTests" */; buildPhases = ( - D039EC238FC4B9FDBDAFB800 /* [CP] Check Pods Manifest.lock */, + 79E2EA345A351A0B80042F86 /* [CP] Check Pods Manifest.lock */, 00E356EA1AD99517003FC87E /* Sources */, 00E356EB1AD99517003FC87E /* Frameworks */, 00E356EC1AD99517003FC87E /* Resources */, - DD6933155112660ABBFB11CE /* [CP] Embed Pods Frameworks */, - 1038B73ED8C88C8CDF41F1FC /* [CP] Copy Pods Resources */, + 1BBDA02DD72D4004B217A05F /* [CP] Embed Pods Frameworks */, + EDC55199BC23BF9C078EF29C /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -178,13 +178,13 @@ isa = PBXNativeTarget; buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNativeExample" */; buildPhases = ( - BB963842CAFBE7B5A629B013 /* [CP] Check Pods Manifest.lock */, + 1DEEBC761A9F0AD9D41C9B8F /* [CP] Check Pods Manifest.lock */, 13B07F871A680F5B00A75B9A /* Sources */, 13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8E1A680F5B00A75B9A /* Resources */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - 35D9F844561F84987A5EA09A /* [CP] Embed Pods Frameworks */, - 3862ED11E8450BD142ECCA26 /* [CP] Copy Pods Resources */, + 102F54311A0D94A16229D75D /* [CP] Embed Pods Frameworks */, + 9C953D85F31015264F6EA5A7 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -267,24 +267,7 @@ shellPath = /bin/sh; shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; }; - 1038B73ED8C88C8CDF41F1FC /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 35D9F844561F84987A5EA09A /* [CP] Embed Pods Frameworks */ = { + 102F54311A0D94A16229D75D /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -301,24 +284,24 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 3862ED11E8450BD142ECCA26 /* [CP] Copy Pods Resources */ = { + 1BBDA02DD72D4004B217A05F /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-resources-${CONFIGURATION}-input-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Copy Pods Resources"; + name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-resources-${CONFIGURATION}-output-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-resources.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - BB963842CAFBE7B5A629B013 /* [CP] Check Pods Manifest.lock */ = { + 1DEEBC761A9F0AD9D41C9B8F /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -340,7 +323,7 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - D039EC238FC4B9FDBDAFB800 /* [CP] Check Pods Manifest.lock */ = { + 79E2EA345A351A0B80042F86 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -362,21 +345,38 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - DD6933155112660ABBFB11CE /* [CP] Embed Pods Frameworks */ = { + 9C953D85F31015264F6EA5A7 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Embed Pods Frameworks"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", + "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-frameworks.sh\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample/Pods-ReactNativeExample-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + EDC55199BC23BF9C078EF29C /* [CP] Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-resources-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Copy Pods Resources"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeExample-ReactNativeExampleTests/Pods-ReactNativeExample-ReactNativeExampleTests-resources.sh\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -412,7 +412,7 @@ /* Begin XCBuildConfiguration section */ 00E356F61AD99517003FC87E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = EA74B193F79CA13EE3B460C6 /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */; + baseConfigurationReference = 7237FA23C741052532F892F9 /* Pods-ReactNativeExample-ReactNativeExampleTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -439,7 +439,7 @@ }; 00E356F71AD99517003FC87E /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 6102A46EF47DB7D6762C9A2B /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */; + baseConfigurationReference = 01E603FB97835EE257543318 /* Pods-ReactNativeExample-ReactNativeExampleTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; @@ -463,7 +463,7 @@ }; 13B07F941A680F5B00A75B9A /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 212B4F1F0ABCF375B1354A0B /* Pods-ReactNativeExample.debug.xcconfig */; + baseConfigurationReference = 4ACA5716B98C6ABE43A0766D /* Pods-ReactNativeExample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; @@ -490,7 +490,7 @@ }; 13B07F951A680F5B00A75B9A /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 837561A5C741BC8B67930889 /* Pods-ReactNativeExample.release.xcconfig */; + baseConfigurationReference = 51D080F1BD4B263A1A494122 /* Pods-ReactNativeExample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; diff --git a/tracker/tracker-reactnative/example/src/App.tsx b/tracker/tracker-reactnative/example/src/App.tsx index d28e6544b..74f818d33 100644 --- a/tracker/tracker-reactnative/example/src/App.tsx +++ b/tracker/tracker-reactnative/example/src/App.tsx @@ -46,6 +46,33 @@ export default function App() { }); }; + const gqlTest = () => { + const appWrapper = { + active: () => true, + send: (gqlMsg) => { + const type = 'gql'; + const msg = JSON.stringify({ + operationKind: gqlMsg[1], + operationName: gqlMsg[2], + variables: gqlMsg[3], + response: gqlMsg[4], + duration: gqlMsg[5], + }); + Openreplay.sendCustomMessage(type, msg); + }, + }; + // just a mock + const mockMsg = [ + 'message id', + 'query', + 'operationName', + { data: 'some imporatnt data' }, + { response: 'some response data' }, + 100, + ]; + appWrapper.send(mockMsg); + }; + return ( @@ -69,6 +96,10 @@ export default function App() { Request + + GraphQL + + =0.71.0. # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79. if respond_to?(:install_modules_dependencies, true) - s.dependency "Openreplay", '1.0.15' + s.dependency "Openreplay", '1.0.17' install_modules_dependencies(s) else s.dependency "React-Core" - s.dependency "Openreplay", '1.0.15' + s.dependency "Openreplay", '1.0.17' # Don't install the dependencies when we run `pod install` in the old architecture. if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then @@ -38,7 +38,7 @@ Pod::Spec.new do |s| s.dependency "RCTRequired" s.dependency "RCTTypeSafety" s.dependency "ReactCommon/turbomodule/core" - s.dependency "Openreplay", '1.0.15' + s.dependency "Openreplay", '1.0.17' end end end diff --git a/tracker/tracker-reactnative/src/index.tsx b/tracker/tracker-reactnative/src/index.tsx index 79cb354ec..a3026daab 100644 --- a/tracker/tracker-reactnative/src/index.tsx +++ b/tracker/tracker-reactnative/src/index.tsx @@ -17,6 +17,8 @@ const LINKING_ERROR = '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n'; +console.log(Object.keys(ORTrackerConnector)); + interface Options { crashes?: boolean; analytics?: boolean; @@ -82,12 +84,9 @@ export function setUserID(userID: string) { ORTrackerConnector.setUserID(userID); } -export function sendMessage(type: string, msg: string) { - ORTrackerConnector.sendMessage(type, msg); -} - /** - * Using with gql plugin: + * Can be used with OR gql (Relay/Apollo) plugin: + * ``` * const appWrapper = { * active: () => true, * send: (gqlMsg) => { @@ -99,10 +98,15 @@ export function sendMessage(type: string, msg: string) { * response: gqlMsg[4], * duration: gqlMsg[5], * }) - * ORTrackerConnector.sendMessage(type, msg); + * sendMessage(type, msg); * } * } + * ``` * */ +export function sendMessage(type: string, msg: string) { + ORTrackerConnector.sendMessage(type, msg); +} + let patched = false; const patchNetwork = ( @@ -118,6 +122,7 @@ const patchNetwork = ( export default { tracker: ORTrackerConnector as IORTrackerConnector, + sendCustomMessage: sendMessage, patchNetwork: patchNetwork, ORTouchTrackingView: RnTrackerTouchTrackingView, ORTrackedInput: ORTrackedInput,