Skip to content
Merged
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
16 changes: 16 additions & 0 deletions .github/workflows/buildandtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,22 @@ jobs:
cache-dependency-path: yarn.lock
- name: Install Dependencies
run: yarn install

# Default of ubuntu and apt packages are too old compared to macos packages.
# This is required for using a newer version of clang-format.
- name: Setup clang-format V20
run: |
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)" 20
sudo apt-get install -y clang-20 clang-format-20 lld-20 lldb-20

- name: Set clang-format V20 as default
run: |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-20 200
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-20 200
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-20 200
clang --version
clang-format --version

- name: Lint
run: yarn lint

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

### Features

- Enable logs on native side of iOS ([#5190](https://github.com/getsentry/sentry-react-native/pull/5190))
- Add mobile replay attributes to logs ([#5165](https://github.com/getsentry/sentry-react-native/pull/5165))

### Fixes
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"@expo/swiftlint": "^0.57.1",
"@naturalcycles/ktlint": "^1.13.0",
"@sentry/cli": "2.53.0",
"clang-format": "^1.8.0",
"downlevel-dts": "^0.11.0",
"google-java-format": "^1.4.0",
"lerna": "^8.1.8",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#import <RNSentry/RNSentry.h>

@interface
RNSentry (RNSentryInternal)
@interface RNSentry (RNSentryInternal)

+ (SentryUser *_Nullable)userFrom:(NSDictionary *)userKeys
otherUserKeys:(NSDictionary *)userDataKeys;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ - (void)testRNSentryDependencyContainerInitializesFrameTracker
OCMStub([(SentryDependencyContainer *)sentryDependencyContainerMock framesTracker])
.andReturn(frameTrackerMock);

RNSentryEmitNewFrameEvent emitNewFrameEvent = ^(NSNumber *newFrameTimestampInSeconds) {};
RNSentryEmitNewFrameEvent emitNewFrameEvent = ^(NSNumber *newFrameTimestampInSeconds) { };
[[RNSentryDependencyContainer sharedInstance]
initializeFramesTrackerListenerWith:emitNewFrameEvent];
XCTAssertNotNil([[RNSentryDependencyContainer sharedInstance] framesTrackerListener]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ - (void)testRNSentryFramesTrackerIsOneTimeListener
OCMStub([(SentryDependencyContainer *)sentryDependencyContainerMock framesTracker])
.andReturn(frameTrackerMock);

RNSentryEmitNewFrameEvent mockEventEmitter = ^(NSNumber *newFrameTimestampInSeconds) {};
RNSentryEmitNewFrameEvent mockEventEmitter = ^(NSNumber *newFrameTimestampInSeconds) { };

RNSentryFramesTrackerListener *actualListener = [[RNSentryFramesTrackerListener alloc]
initWithSentryFramesTracker:[[SentryDependencyContainer sharedInstance] framesTracker]
Expand All @@ -66,7 +66,7 @@ - (void)testRNSentryFramesTrackerAddsItselfAsListener
OCMStub([(SentryDependencyContainer *)sentryDependencyContainerMock framesTracker])
.andReturn(frameTrackerMock);

RNSentryEmitNewFrameEvent mockEventEmitter = ^(NSNumber *newFrameTimestampInSeconds) {};
RNSentryEmitNewFrameEvent mockEventEmitter = ^(NSNumber *newFrameTimestampInSeconds) { };

RNSentryFramesTrackerListener *actualListener = [[RNSentryFramesTrackerListener alloc]
initWithSentryFramesTracker:[[SentryDependencyContainer sharedInstance] framesTracker]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#import "RNSentryOnDrawReporter.h"
#import <Foundation/Foundation.h>

@interface
RNSentryOnDrawReporterView (Testing)
@interface RNSentryOnDrawReporterView (Testing)

+ (instancetype)createWithMockedListener;
- (RNSentryEmitNewFrameEvent)createEmitNewFrameEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ - (void)framesTrackerHasNewFrame:(nonnull NSDate *)newFrameDate

@end

@implementation
RNSentryOnDrawReporterView (Testing)
@implementation RNSentryOnDrawReporterView (Testing)

+ (instancetype)createWithMockedListener
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

@class SentryOptions;

@interface
SentrySDKInternal (PrivateTests)
@interface SentrySDKInternal (PrivateTests)

+ (nullable SentryOptions *)options;
@end
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,50 @@ - (void)testCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Default
enableUnhandledCPPExceptions, @"enableUnhandledCPPExceptionsV2 should default to disabled");
}

- (void)testCreateOptionsWithDictionaryEnableLogsEnabled
{
RNSentry *rnSentry = [[RNSentry alloc] init];
NSError *error = nil;

NSDictionary *_Nonnull mockedReactNativeDictionary = @{
@"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456",
@"enableLogs" : @YES,
};
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
error:&error];

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];
XCTAssertTrue(enableLogs, @"enableLogs should be enabled");
}

- (void)testCreateOptionsWithDictionaryEnableLogsDisabled
{
RNSentry *rnSentry = [[RNSentry alloc] init];
NSError *error = nil;

NSDictionary *_Nonnull mockedReactNativeDictionary = @{
@"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456",
@"enableLogs" : @NO,
};
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
error:&error];

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];
XCTAssertFalse(enableLogs, @"enableLogs should be disabled");
}

- (void)testPassesErrorOnWrongDsn
{
RNSentry *rnSentry = [[RNSentry alloc] init];
Expand Down
3 changes: 1 addition & 2 deletions packages/core/ios/RNSentry+fetchNativeStack.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

// This method was moved to a new category so we can use `@import Sentry` to use Sentry's Swift
// classes
@implementation
RNSentry (fetchNativeStack)
@implementation RNSentry (fetchNativeStack)

- (NSDictionary *)fetchNativeStackFramesBy:(NSArray<NSNumber *> *)instructionsAddr
symbolicate:(SymbolicateCallbackType)symbolicate
Expand Down
3 changes: 1 addition & 2 deletions packages/core/ios/RNSentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ typedef int (*SymbolicateCallbackType)(const void *, Dl_info *);

@end

@interface
RNSentry (fetchNativeStack)
@interface RNSentry (fetchNativeStack)

- (NSDictionary *_Nonnull)fetchNativeStackFramesBy:(NSArray<NSNumber *> *)instructionsAddr
symbolicate:(SymbolicateCallbackType)symbolicate;
Expand Down
Loading
Loading