Skip to content

Commit

Permalink
Merge pull request #555 from DataDog/louiszawadzki/rum-1818/record-io…
Browse files Browse the repository at this point in the history
…s-text-session-replay

Record iOS text in SR
  • Loading branch information
louiszawadzki authored Nov 24, 2023
2 parents cbcf405 + 6bcd537 commit 2b7c4c1
Show file tree
Hide file tree
Showing 10 changed files with 443 additions and 87 deletions.
54 changes: 27 additions & 27 deletions example-new-architecture/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
PODS:
- boost (1.76.0)
- CocoaAsyncSocket (7.6.5)
- DatadogCore (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogCrashReporting (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogCore (2.5.0):
- DatadogInternal (= 2.5.0)
- DatadogCrashReporting (2.5.0):
- DatadogInternal (= 2.5.0)
- PLCrashReporter (~> 1.11.1)
- DatadogInternal (2.4.0)
- DatadogLogs (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogRUM (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogInternal (2.5.0)
- DatadogLogs (2.5.0):
- DatadogInternal (= 2.5.0)
- DatadogRUM (2.5.0):
- DatadogInternal (= 2.5.0)
- DatadogSDKReactNative (2.0.1):
- DatadogCore (~> 2.4.0)
- DatadogCrashReporting (~> 2.4.0)
- DatadogLogs (~> 2.4.0)
- DatadogRUM (~> 2.4.0)
- DatadogTrace (~> 2.4.0)
- DatadogWebViewTracking (~> 2.4.0)
- DatadogCore (~> 2.5.0)
- DatadogCrashReporting (~> 2.5.0)
- DatadogLogs (~> 2.5.0)
- DatadogRUM (~> 2.5.0)
- DatadogTrace (~> 2.5.0)
- DatadogWebViewTracking (~> 2.5.0)
- RCT-Folly (= 2021.07.22.00)
- RCTRequired
- RCTTypeSafety
Expand All @@ -26,10 +26,10 @@ PODS:
- React-RCTFabric
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- DatadogTrace (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogWebViewTracking (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogTrace (2.5.0):
- DatadogInternal (= 2.5.0)
- DatadogWebViewTracking (2.5.0):
- DatadogInternal (= 2.5.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.71.10)
- FBReactNativeSpec (0.71.10):
Expand Down Expand Up @@ -959,14 +959,14 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DatadogCore: 67ce2f8cd2f58cc90bdee5486d847b49e4b31b0b
DatadogCrashReporting: 0d4bd014714946be77a1ed2d34897036892f2b7b
DatadogInternal: 5789bca7a0284b20655ba2a79738ac7d0cd56e70
DatadogLogs: 3b8c8778c32b780f916c2894b9d2c53bbf590803
DatadogRUM: 4207d091be536b888719969a7ca078e2c830819a
DatadogSDKReactNative: 9c95bed4eef14236ad675d88d6d3605a41f5d7be
DatadogTrace: ec75b1da1dcf9f5b574481a3773b296e0e1fda38
DatadogWebViewTracking: e7a5841f001f488fc0240d7cba1a984ab6c86e9a
DatadogCore: a152fbcc24ea1a6b937c9844b1c1d5b86f0a375e
DatadogCrashReporting: 53b458152130de5505901e025e0dd031ce057f31
DatadogInternal: 96448807156495aa41a9f177b8c849a404618948
DatadogLogs: 2e67adf2e2cccd84b880b42f52e56cd0b8c7ef82
DatadogRUM: d807827ad24ae6c738867e853df38c6cb2bb555b
DatadogSDKReactNative: 0b659c7de3043d16465ae3fd6e2d418a5b62261c
DatadogTrace: 703d7572acc1dcda474ab33b7db3d8d67984192c
DatadogWebViewTracking: 87c0c1c9de4da7bb4f9efb87595da6c3d333aba9
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: ddb55c55295ea51ed98aa7e2e08add2f826309d5
FBReactNativeSpec: 33a87f65f1a467d5f63d11d0cc106a10d3b0639d
Expand Down
79 changes: 40 additions & 39 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
PODS:
- boost (1.76.0)
- DatadogCore (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogCrashReporting (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogCore (2.5.0):
- DatadogInternal (= 2.5.0)
- DatadogCrashReporting (2.5.0):
- DatadogInternal (= 2.5.0)
- PLCrashReporter (~> 1.11.1)
- DatadogInternal (2.4.0)
- DatadogLogs (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogRUM (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogInternal (2.5.0)
- DatadogLogs (2.5.0):
- DatadogInternal (= 2.5.0)
- DatadogRUM (2.5.0):
- DatadogInternal (= 2.5.0)
- DatadogSDKReactNative (2.0.1):
- DatadogCore (~> 2.4.0)
- DatadogCrashReporting (~> 2.4.0)
- DatadogLogs (~> 2.4.0)
- DatadogRUM (~> 2.4.0)
- DatadogTrace (~> 2.4.0)
- DatadogWebViewTracking (~> 2.4.0)
- DatadogCore (~> 2.5.0)
- DatadogCrashReporting (~> 2.5.0)
- DatadogLogs (~> 2.5.0)
- DatadogRUM (~> 2.5.0)
- DatadogTrace (~> 2.5.0)
- DatadogWebViewTracking (~> 2.5.0)
- React-Core
- DatadogSDKReactNative/Tests (2.0.1):
- DatadogCore (~> 2.4.0)
- DatadogCrashReporting (~> 2.4.0)
- DatadogLogs (~> 2.4.0)
- DatadogRUM (~> 2.4.0)
- DatadogTrace (~> 2.4.0)
- DatadogWebViewTracking (~> 2.4.0)
- DatadogCore (~> 2.5.0)
- DatadogCrashReporting (~> 2.5.0)
- DatadogLogs (~> 2.5.0)
- DatadogRUM (~> 2.5.0)
- DatadogTrace (~> 2.5.0)
- DatadogWebViewTracking (~> 2.5.0)
- React-Core
- DatadogSDKReactNativeSessionReplay (2.0.1):
- DatadogSessionReplay (~> 2.4.0)
- DatadogSessionReplay (~> 2.5.0)
- React-Core
- DatadogSDKReactNativeSessionReplay/Tests (2.0.1):
- DatadogSessionReplay (~> 2.4.0)
- DatadogSessionReplay (~> 2.5.0)
- React-Core
- DatadogSessionReplay (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogTrace (2.4.0):
- DatadogInternal (= 2.4.0)
- DatadogWebViewTracking (2.4.0):
- DatadogInternal (= 2.4.0)
- React-RCTText
- DatadogSessionReplay (2.5.0):
- DatadogInternal (= 2.5.0)
- DatadogTrace (2.5.0):
- DatadogInternal (= 2.5.0)
- DatadogWebViewTracking (2.5.0):
- DatadogInternal (= 2.5.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.71.10)
- FBReactNativeSpec (0.71.10):
Expand Down Expand Up @@ -569,16 +570,16 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: 57d2868c099736d80fcd648bf211b4431e51a558
DatadogCore: 67ce2f8cd2f58cc90bdee5486d847b49e4b31b0b
DatadogCrashReporting: 0d4bd014714946be77a1ed2d34897036892f2b7b
DatadogInternal: 5789bca7a0284b20655ba2a79738ac7d0cd56e70
DatadogLogs: 3b8c8778c32b780f916c2894b9d2c53bbf590803
DatadogRUM: 4207d091be536b888719969a7ca078e2c830819a
DatadogSDKReactNative: b4d2c0926219c7fa0c7fdb3b9faf963b0c37bc4f
DatadogSDKReactNativeSessionReplay: c320633e2dc1f8d6a8656ff60ca9a3d9cf305035
DatadogSessionReplay: 8d17ac983669b62e3dd9159cf4a04e98fcf9abeb
DatadogTrace: ec75b1da1dcf9f5b574481a3773b296e0e1fda38
DatadogWebViewTracking: e7a5841f001f488fc0240d7cba1a984ab6c86e9a
DatadogCore: a152fbcc24ea1a6b937c9844b1c1d5b86f0a375e
DatadogCrashReporting: 53b458152130de5505901e025e0dd031ce057f31
DatadogInternal: 96448807156495aa41a9f177b8c849a404618948
DatadogLogs: 2e67adf2e2cccd84b880b42f52e56cd0b8c7ef82
DatadogRUM: d807827ad24ae6c738867e853df38c6cb2bb555b
DatadogSDKReactNative: 3bdadcd1ad69e2fb9fd53b823dddaa8d503edf6f
DatadogSDKReactNativeSessionReplay: 08001fa73bc35a9acb783cd4c4428cc3d22fdeb9
DatadogSessionReplay: e264895cd8093c22408f518e0c736f6c3ca6882c
DatadogTrace: 703d7572acc1dcda474ab33b7db3d8d67984192c
DatadogWebViewTracking: 87c0c1c9de4da7bb4f9efb87595da6c3d333aba9
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: ddb55c55295ea51ed98aa7e2e08add2f826309d5
FBReactNativeSpec: 90fc1a90b4b7a171e0a7c20ea426c1bf6ce4399c
Expand Down
15 changes: 15 additions & 0 deletions example/ios/PodfileForTests → example/ios/PodfileForSRTests
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,23 @@ if linkage != nil
use_frameworks! :linkage => linkage.to_sym
end

use_modular_headers!

target 'ddSdkReactnativeExample' do
native_ios_sdk_path = ENV['DD_NATIVE_IOS_SDK_PATH']
if (native_ios_sdk_path) then
pod 'DatadogCore', :path => "#{native_ios_sdk_path}/DatadogCore.podspec"
pod 'DatadogLogs', :path => "#{native_ios_sdk_path}/DatadogLogs.podspec"
pod 'DatadogTrace', :path => "#{native_ios_sdk_path}/DatadogTrace.podspec"
pod 'DatadogInternal', :path => "#{native_ios_sdk_path}/DatadogInternal.podspec"
pod 'DatadogRUM', :path => "#{native_ios_sdk_path}/DatadogRUM.podspec"
pod 'DatadogCrashReporting', :path => "#{native_ios_sdk_path}/DatadogCrashReporting.podspec"
pod 'DatadogWebViewTracking', :path => "#{native_ios_sdk_path}/DatadogWebViewTracking.podspec"
pod 'DatadogSessionReplay', :path => "#{native_ios_sdk_path}/DatadogSessionReplay.podspec"
end

pod 'DatadogSDKReactNative', :path => '../../packages/core/DatadogSDKReactNative.podspec', :testspecs => ['Tests']
pod 'DatadogSDKReactNativeSessionReplay', :path => '../../packages/react-native-session-replay/DatadogSDKReactNativeSessionReplay.podspec', :testspecs => ['Tests']

config = use_native_modules!

Expand Down
12 changes: 6 additions & 6 deletions packages/core/DatadogSDKReactNative.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ Pod::Spec.new do |s|
s.dependency "React-Core"

# /!\ Remember to keep the versions in sync with DatadogSDKReactNativeSessionReplay.podspec
s.dependency 'DatadogCore', '~> 2.4.0'
s.dependency 'DatadogLogs', '~> 2.4.0'
s.dependency 'DatadogTrace', '~> 2.4.0'
s.dependency 'DatadogRUM', '~> 2.4.0'
s.dependency 'DatadogCrashReporting', '~> 2.4.0'
s.dependency 'DatadogWebViewTracking', '~> 2.4.0'
s.dependency 'DatadogCore', '~> 2.5.0'
s.dependency 'DatadogLogs', '~> 2.5.0'
s.dependency 'DatadogTrace', '~> 2.5.0'
s.dependency 'DatadogRUM', '~> 2.5.0'
s.dependency 'DatadogCrashReporting', '~> 2.5.0'
s.dependency 'DatadogWebViewTracking', '~> 2.5.0'

s.test_spec 'Tests' do |test_spec|
test_spec.source_files = 'ios/Tests/*.swift'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ Pod::Spec.new do |s|
s.dependency "React-Core"

# /!\ Remember to keep the version in sync with DatadogSDKReactNative.podspec
s.dependency 'DatadogSessionReplay', '~> 2.4.0'
s.dependency 'DatadogSessionReplay', '~> 2.5.0'

s.test_spec 'Tests' do |test_spec|
test_spec.dependency "React-RCTText"
test_spec.source_files = 'ios/Tests/*.swift'
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

@implementation DdSessionReplay

@synthesize bridge = _bridge;
RCT_EXPORT_MODULE()

RCT_REMAP_METHOD(enable, withEnableReplaySampleRate:(double)replaySampleRate
Expand All @@ -36,7 +37,7 @@ @implementation DdSessionReplay
- (DdSessionReplayImplementation*)ddSessionReplayImplementation
{
if (_ddSessionReplayImplementation == nil) {
_ddSessionReplayImplementation = [[DdSessionReplayImplementation alloc] init];
_ddSessionReplayImplementation = [[DdSessionReplayImplementation alloc] initWithBridge:_bridge];
}
return _ddSessionReplayImplementation;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,40 @@
*/

import Foundation
import DatadogSessionReplay
@_spi(Internal) import DatadogSessionReplay
import DatadogInternal
import React

@objc
public class DdSessionReplayImplementation: NSObject {
private lazy var sessionReplay: SessionReplayProtocol = sessionReplayProvider()
private let sessionReplayProvider: () -> SessionReplayProtocol
private let uiManager: RCTUIManager

internal init(_ sessionReplayProvider: @escaping () -> SessionReplayProtocol) {
internal init(sessionReplayProvider: @escaping () -> SessionReplayProtocol, uiManager: RCTUIManager) {
self.sessionReplayProvider = sessionReplayProvider
self.uiManager = uiManager
}

@objc
public override convenience init() {
self.init({ NativeSessionReplay() })
public convenience init(bridge: RCTBridge) {
self.init(
sessionReplayProvider: { NativeSessionReplay() },
uiManager: bridge.uiManager
)
}

@objc
public func enable(replaySampleRate: Double, defaultPrivacyLevel: String, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
var sessionReplayConfiguration = SessionReplay.Configuration(
replaySampleRate: Float(replaySampleRate),
defaultPrivacyLevel: buildPrivacyLevel(privacyLevel: defaultPrivacyLevel as NSString)
)

sessionReplayConfiguration.setAdditionalNodeRecorders([RCTTextViewRecorder(uiManager: self.uiManager)])

sessionReplay.enable(
with: SessionReplay.Configuration(
replaySampleRate: Float(replaySampleRate),
defaultPrivacyLevel: buildPrivacyLevel(privacyLevel: defaultPrivacyLevel as NSString)
)
with: sessionReplayConfiguration
)
resolve(nil)
}
Expand Down
Loading

0 comments on commit 2b7c4c1

Please sign in to comment.