Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- v5
- cocoa-v9
- release/**
pull_request:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codegen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- v5
- cocoa-v9
- release/**
pull_request:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- v5
- cocoa-v9
- release/**
pull_request:
types: [opened, synchronize, reopened, labeled]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/native-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- v5
- cocoa-v9
- release/**
pull_request:
types: [opened, synchronize, reopened, labeled]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sample-application-expo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- v5
- cocoa-v9
pull_request:
types: [opened, synchronize, reopened, labeled]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sample-application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- v5
- cocoa-v9
pull_request:
types: [opened, synchronize, reopened, labeled]

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/testflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- main
- cocoa-v9

pull_request:
paths:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

### Dependencies

- Bump Cocoa SDK from v8.57.2 to v9.0.0-alpha.0 ([#5356](https://github.com/getsentry/sentry-react-native/pull/5356))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#900-alpha0)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.57.2...9.0.0-alpha.0)
- Bump JavaScript SDK from v10.24.0 to v10.25.0 ([#5362](https://github.com/getsentry/sentry-react-native/pull/5362))
- [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#10250)
- [diff](https://github.com/getsentry/sentry-javascript/compare/10.24.0...10.25.0)
Expand Down
36 changes: 33 additions & 3 deletions dev-packages/e2e-tests/patch-scripts/rn.patch.podfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@ if (enableHermes === null) {
throw new Error('Invalid engine');
}

// Optional iOS version argument, defaults to '15.1' due to Cocoa SDK V9 and RN 0.81.0 requirement
const iosVersion = args['ios-version'] || '15.1';

debug.log('Patching Podfile', args['pod-file']);
const content = fs.readFileSync(args['pod-file'], 'utf8');
let content = fs.readFileSync(args['pod-file'], 'utf8');

const isHermesEnabled = content.includes(':hermes_enabled => true,');
const shouldPatch = enableHermes !== isHermesEnabled;
if (shouldPatch) {
const patched = content.replace(
content = content.replace(
/:hermes_enabled.*/,
enableHermes ? ':hermes_enabled => true,' : ':hermes_enabled => false,',
);
Expand All @@ -36,7 +39,34 @@ if (shouldPatch) {
} else {
debug.log('Patching Podfile for JSC');
}
fs.writeFileSync(args['pod-file'], patched);
}

// Patch iOS version
const platformPattern = /platform :ios, (min_ios_version_supported|['"][0-9.]+['"])/;
const currentMatch = content.match(platformPattern);

if (currentMatch) {
const currentValue = currentMatch[1];
const shouldPatchVersion = currentValue === 'min_ios_version_supported' ||
currentValue !== `'${iosVersion}'`;

if (shouldPatchVersion) {
content = content.replace(
platformPattern,
`platform :ios, '${iosVersion}'`
);
debug.log(`Patching iOS version to ${iosVersion} (was: ${currentValue})`);
} else {
debug.log(`iOS version already set to ${iosVersion}`);
}
} else {
debug.log('Warning: Could not find platform :ios line to patch');
}

// Write the file if any changes were made
if (shouldPatch || currentMatch) {
fs.writeFileSync(args['pod-file'], content);
debug.log('Podfile patched successfully!');
} else {
debug.log('Podfile is already patched!');
}
2 changes: 1 addition & 1 deletion packages/core/RNSentry.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Pod::Spec.new do |s|

s.compiler_flags = other_cflags

s.dependency 'Sentry/HybridSDK', '8.57.3'
s.dependency 'Sentry/HybridSDK', '>= 9.0.0-alpha.0'

if defined? install_modules_dependencies
# Default React Native dependencies for 0.71 and above (new and legacy architecture)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@
338739072A7D7D2800950DDD /* RNSentryReplay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryReplay.h; path = ../ios/RNSentryReplay.h; sourceTree = "<group>"; };
33958C672BFCEF5A00AD1FB6 /* RNSentryOnDrawReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryOnDrawReporter.h; path = ../ios/RNSentryOnDrawReporter.h; sourceTree = "<group>"; };
33AFDFEC2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentryFramesTrackerListenerTests.m; sourceTree = "<group>"; };
33AFDFEE2B8D14C200AAB120 /* RNSentryFramesTrackerListenerTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNSentryFramesTrackerListenerTests.h; sourceTree = "<group>"; };
33AFDFF02B8D15E500AAB120 /* RNSentryDependencyContainerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentryDependencyContainerTests.m; sourceTree = "<group>"; };
33AFDFF22B8D15F600AAB120 /* RNSentryDependencyContainerTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNSentryDependencyContainerTests.h; sourceTree = "<group>"; };
33AFE0132B8F31AF00AAB120 /* RNSentryDependencyContainer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryDependencyContainer.h; path = ../ios/RNSentryDependencyContainer.h; sourceTree = "<group>"; };
33DEDFE92D8DBE5B006066E4 /* RNSentryOnDrawReporterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNSentryOnDrawReporterTests.swift; sourceTree = "<group>"; };
33DEDFEB2D8DC800006066E4 /* RNSentryOnDrawReporter+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNSentryOnDrawReporter+Test.h"; sourceTree = "<group>"; };
Expand All @@ -52,6 +50,8 @@
33F58ACF2977037D008F60EA /* RNSentryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNSentryTests.m; sourceTree = "<group>"; };
650CB718ACFBD05609BF2126 /* libPods-RNSentryCocoaTesterTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNSentryCocoaTesterTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
E2321E7CFA55AB617247098E /* Pods-RNSentryCocoaTesterTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNSentryCocoaTesterTests.debug.xcconfig"; path = "Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests.debug.xcconfig"; sourceTree = "<group>"; };
F48F26542EA2A481008A185E /* RNSentryEmitNewFrameEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryEmitNewFrameEvent.h; path = ../ios/RNSentryEmitNewFrameEvent.h; sourceTree = SOURCE_ROOT; };
F48F26552EA2A4D4008A185E /* RNSentryFramesTrackerListener.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryFramesTrackerListener.h; path = ../ios/RNSentryFramesTrackerListener.h; sourceTree = SOURCE_ROOT; };
FADF868E2EBD053E00D6652D /* SentrySDKWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SentrySDKWrapper.h; path = ../ios/SentrySDKWrapper.h; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -109,9 +109,7 @@
33F58ACF2977037D008F60EA /* RNSentryTests.m */,
3339C4802D6625570088EB3A /* RNSentryUserTests.m */,
33AFDFEC2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m */,
33AFDFEE2B8D14C200AAB120 /* RNSentryFramesTrackerListenerTests.h */,
33AFDFF02B8D15E500AAB120 /* RNSentryDependencyContainerTests.m */,
33AFDFF22B8D15F600AAB120 /* RNSentryDependencyContainerTests.h */,
3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */,
332D33462CDBDBB600547D76 /* RNSentryReplayOptionsTests.swift */,
3380C6C32CE25ECA0018B9B6 /* RNSentryReplayPostInitTests.swift */,
Expand Down Expand Up @@ -140,6 +138,8 @@
FADF868E2EBD053E00D6652D /* SentrySDKWrapper.h */,
33AFE0132B8F31AF00AAB120 /* RNSentryDependencyContainer.h */,
338739072A7D7D2800950DDD /* RNSentryReplay.h */,
F48F26542EA2A481008A185E /* RNSentryEmitNewFrameEvent.h */,
F48F26552EA2A4D4008A185E /* RNSentryFramesTrackerListener.h */,
);
name = RNSentry;
sourceTree = "<group>";
Expand Down Expand Up @@ -238,10 +238,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests-resources.sh\"\n";
Expand Down Expand Up @@ -436,7 +440,7 @@
"\"$(PODS_TARGET_SRCROOT)/include/\"",
"\"${PODS_ROOT}/Sentry/Sources/Sentry/include\"",
);
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.RNSentryCocoaTesterTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -503,7 +507,7 @@
"\"$(PODS_TARGET_SRCROOT)/include/\"",
"\"${PODS_ROOT}/Sentry/Sources/Sentry/include\"",
);
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = io.sentry.RNSentryCocoaTesterTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#import "RNSentryDependencyContainerTests.h"
#import "RNSentryDependencyContainer.h"
#import <OCMock/OCMock.h>
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
@import Sentry;

@interface RNSentryDependencyContainerTests : XCTestCase

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#import "RNSentryFramesTrackerListenerTests.h"
#import "RNSentryDependencyContainer.h"
#import "RNSentryFramesTrackerListener.h"
#import <OCMock/OCMock.h>
#import <UIKit/UIKit.h>
#import <XCTest/XCTest.h>
@import Sentry;

@interface RNSentryFramesTrackerListenerTests : XCTestCase

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "RNSentryEmitNewFrameEvent.h"
#import "RNSentryOnDrawReporter.h"
#import <Foundation/Foundation.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ - (void)testCreateOptionsWithDictionaryRemovesPerformanceProperties
XCTAssertEqual(
actualOptions.tracesSampleRate, nil, @"Traces sample rate should not be passed to native");
XCTAssertEqual(actualOptions.tracesSampler, nil, @"Traces sampler should not be passed to native");
XCTAssertEqual(actualOptions.enableTracing, false, @"EnableTracing should not be passed to native");
}

- (void)testCaptureFailedRequestsIsDisabled
Expand Down Expand Up @@ -348,10 +347,7 @@ - (void)testCreateOptionsWithDictionaryEnableLogsEnabled
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
XCTAssertNil(error, @"Should not pass no error");

id experimentalOptions = [actualOptions valueForKey:@"experimental"];
XCTAssertNotNil(experimentalOptions, @"Experimental options should not be nil");

BOOL enableLogs = [[experimentalOptions valueForKey:@"enableLogs"] boolValue];
BOOL enableLogs = [[actualOptions valueForKey:@"enableLogs"] boolValue];
XCTAssertTrue(enableLogs, @"enableLogs should be enabled");
}

Expand All @@ -370,11 +366,7 @@ - (void)testCreateOptionsWithDictionaryEnableLogsDisabled

XCTAssertNotNil(actualOptions, @"Did not create sentry options");
XCTAssertNil(error, @"Should not pass no error");

id experimentalOptions = [actualOptions valueForKey:@"experimental"];
XCTAssertNotNil(experimentalOptions, @"Experimental options should not be nil");

BOOL enableLogs = [[experimentalOptions valueForKey:@"enableLogs"] boolValue];
BOOL enableLogs = [[actualOptions valueForKey:@"enableLogs"] boolValue];
XCTAssertFalse(enableLogs, @"enableLogs should be disabled");
}

Expand Down
18 changes: 6 additions & 12 deletions packages/core/ios/RNSentry.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#import <Sentry/SentryException.h>
#import <Sentry/SentryFormatter.h>
#import <Sentry/SentryGeo.h>
#import <Sentry/SentryScreenFrames.h>
#import <Sentry/SentryUser.h>

// This guard prevents importing Hermes in JSC apps
Expand All @@ -47,13 +46,14 @@
#endif

#if SENTRY_HAS_UIKIT
# import "RNSentryFramesTrackerListener.h"
# import "RNSentryEmitNewFrameEvent.h"
# import "RNSentryRNSScreen.h"
#endif

#import "RNSentryExperimentalOptions.h"
#import "RNSentryVersion.h"
#import "SentrySDKWrapper.h"
#import "SentryScreenFramesWrapper.h"

static bool hasFetchedAppStart;

Expand Down Expand Up @@ -486,21 +486,15 @@ - (void)stopObserving

#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
if (PrivateSentrySDKOnly.isFramesTrackingRunning) {
SentryScreenFrames *frames = PrivateSentrySDKOnly.currentScreenFrames;

if (frames == nil) {
if (![SentryScreenFramesWrapper canTrackFrames]) {
resolve(nil);
return;
}

NSNumber *total = [NSNumber numberWithLong:frames.total];
NSNumber *frozen = [NSNumber numberWithLong:frames.frozen];
NSNumber *slow = [NSNumber numberWithLong:frames.slow];

resolve(@ {
@"totalFrames" : total,
@"frozenFrames" : frozen,
@"slowFrames" : slow,
@"totalFrames" : [SentryScreenFramesWrapper totalFrames],
@"frozenFrames" : [SentryScreenFramesWrapper frozenFrames],
@"slowFrames" : [SentryScreenFramesWrapper slowFrames],
});
} else {
resolve(nil);
Expand Down
3 changes: 2 additions & 1 deletion packages/core/ios/RNSentryDependencyContainer.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#import <Sentry/SentryDefines.h>

#import "RNSentryFramesTrackerListener.h"
#import "RNSentryEmitNewFrameEvent.h"
@class RNSentryFramesTrackerListener;

@interface RNSentryDependencyContainer : NSObject
SENTRY_NO_INIT
Expand Down
1 change: 1 addition & 0 deletions packages/core/ios/RNSentryDependencyContainer.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#import "RNSentryDependencyContainer.h"
#import "RNSentryFramesTrackerListener.h"
@import Sentry;

@implementation RNSentryDependencyContainer {
Expand Down
3 changes: 3 additions & 0 deletions packages/core/ios/RNSentryEmitNewFrameEvent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#import <Foundation/Foundation.h>

typedef void (^RNSentryEmitNewFrameEvent)(NSNumber *newFrameTimestampInSeconds);
2 changes: 1 addition & 1 deletion packages/core/ios/RNSentryExperimentalOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ + (void)setEnableLogs:(BOOL)enabled sentryOptions:(SentryOptions *)sentryOptions
if (sentryOptions == nil) {
return;
}
sentryOptions.experimental.enableLogs = enabled;
sentryOptions.enableLogs = enabled;
}

+ (void)setEnableSessionReplayInUnreliableEnvironment:(BOOL)enabled
Expand Down
4 changes: 2 additions & 2 deletions packages/core/ios/RNSentryFramesTrackerListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

#if SENTRY_HAS_UIKIT

# import "RNSentryEmitNewFrameEvent.h"
# import <Foundation/Foundation.h>
# import <React/RCTEventEmitter.h>
# import <Sentry/SentryFramesTracker.h>

typedef void (^RNSentryEmitNewFrameEvent)(NSNumber *newFrameTimestampInSeconds);
@import Sentry;

@protocol RNSentryFramesTrackerListenerProtocol <SentryFramesTrackerListener>

Expand Down
2 changes: 2 additions & 0 deletions packages/core/ios/RNSentryFramesTrackerListener.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#if SENTRY_HAS_UIKIT

@import Sentry;

@implementation RNSentryFramesTrackerListener

- (instancetype)initWithSentryFramesTracker:(SentryFramesTracker *)framesTracker
Expand Down
3 changes: 2 additions & 1 deletion packages/core/ios/RNSentryOnDrawReporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

#if SENTRY_HAS_UIKIT

# import "RNSentryFramesTrackerListener.h"
# import <React/RCTViewManager.h>
# import <UIKit/UIKit.h>

@protocol RNSentryFramesTrackerListenerProtocol;

@interface RNSentryOnDrawReporter : RCTViewManager

@end
Expand Down
Loading
Loading