Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

### Dependencies

- Bump Cocoa SDK from v9.1.0 to v9.3.0 ([#5515](https://github.com/getsentry/sentry-react-native/pull/5515))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#930)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/9.1.0...9.3.0)
- Bump JavaScript SDK from v10.37.0 to v10.38.0 ([#5596](https://github.com/getsentry/sentry-react-native/pull/5596))
- [changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#10380)
- [diff](https://github.com/getsentry/sentry-javascript/compare/10.37.0...10.38.0)
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ cd sentry-react-native
Comment out sentry dependency in `RNSentry.podspec`.

```diff
- s.dependency 'Sentry/HybridSDK', '7.31.0'
+ s.dependency 'Sentry/HybridSDK'
- s.dependency 'Sentry', '7.31.0'
+ s.dependency 'Sentry'
```

Add local pods to `sample/ios/Podfile`.
Expand All @@ -147,7 +147,7 @@ target 'sample' do

# ... react native config

pod 'Sentry/HybridSDK', :path => '../../../../sentry-cocoa'
pod 'Sentry', :path => '../../../../sentry-cocoa'
# ... rest of the configuration

end
Expand Down
5 changes: 3 additions & 2 deletions packages/core/RNSentry.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ Pod::Spec.new do |s|
s.compiler_flags = other_cflags

s.pod_target_xcconfig = {
'DEFINES_MODULE' => 'YES'
'DEFINES_MODULE' => 'YES',
'HEADER_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}/Sentry/Sources/Sentry" "${PODS_ROOT}/Sentry/Sources/Sentry/include"'
}

s.dependency 'Sentry/HybridSDK', '9.1.0'
s.dependency 'Sentry', '9.3.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 @@ -67,7 +67,7 @@ final class RNSentryReplayOptions: XCTestCase {
] as NSDictionary).mutableCopy() as! NSMutableDictionary
RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])
XCTAssertEqual(actualOptions.sessionReplay.sessionSampleRate, 0.75)
}

Expand All @@ -78,7 +78,7 @@ final class RNSentryReplayOptions: XCTestCase {
] as NSDictionary).mutableCopy() as! NSMutableDictionary
RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])
XCTAssertEqual(actualOptions.sessionReplay.onErrorSampleRate, 0.75)
}

Expand Down Expand Up @@ -108,7 +108,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.maskAllImages, true)
assertContainsClass(classArray: actualOptions.sessionReplay.maskedViewClasses, stringClass: "RCTImageView")
Expand All @@ -123,7 +123,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.maskAllImages, false)
XCTAssertEqual(actualOptions.sessionReplay.maskedViewClasses.count, 0)
Expand All @@ -138,7 +138,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.maskAllText, true)
assertContainsClass(classArray: actualOptions.sessionReplay.maskedViewClasses, stringClass: "RCTTextView")
Expand All @@ -162,7 +162,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.maskAllText, false)
XCTAssertEqual(actualOptions.sessionReplay.maskedViewClasses.count, 0)
Expand All @@ -176,7 +176,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertTrue(actualOptions.sessionReplay.enableViewRendererV2)
}
Expand All @@ -190,7 +190,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertTrue(actualOptions.sessionReplay.enableViewRendererV2)
}
Expand All @@ -204,7 +204,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertFalse(actualOptions.sessionReplay.enableViewRendererV2)
}
Expand All @@ -217,7 +217,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertFalse(actualOptions.sessionReplay.enableFastViewRendering)
}
Expand All @@ -231,7 +231,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertTrue(actualOptions.sessionReplay.enableFastViewRendering)
}
Expand All @@ -245,7 +245,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertFalse(actualOptions.sessionReplay.enableFastViewRendering)
}
Expand All @@ -258,7 +258,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.quality, SentryReplayOptions.SentryReplayQuality.medium)
}
Expand All @@ -272,7 +272,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.quality, SentryReplayOptions.SentryReplayQuality.low)
}
Expand All @@ -286,7 +286,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.quality, SentryReplayOptions.SentryReplayQuality.medium)
}
Expand All @@ -300,7 +300,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.quality, SentryReplayOptions.SentryReplayQuality.high)
}
Expand All @@ -314,7 +314,7 @@ final class RNSentryReplayOptions: XCTestCase {

RNSentryReplay.updateOptions(optionsDict)

let actualOptions = try! SentryOptionsInternal.initWithDict(optionsDict as! [String: Any])
let actualOptions = try! PrivateSentrySDKOnly.options(with: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.sessionReplay.quality, SentryReplayOptions.SentryReplayQuality.medium)
}
Expand Down
1 change: 1 addition & 0 deletions packages/core/ios/RNSentry+fetchNativeStack.m
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#import "RNSentry+formatters.h"
#import "RNSentry.h"
#import "RNSentryBreadcrumb.h"
#import "RNSentryId.h"
Expand Down
35 changes: 35 additions & 0 deletions packages/core/ios/RNSentry+formatters.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#import <Foundation/Foundation.h>

// This file is a copy from
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: do we use this? why copy it here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @lucas-zimerman 👍
it was actually added with e1d97f3 in #5451
I think it is not needed now though. I removed it with 0f1f386. Let's see if the CI is happy 🤞

// https://github.com/getsentry/sentry-cocoa/blob/6c20265de0903b835a299e2e9da0f7af50af09f5/Sources/Sentry/include/HybridPublic/SentryFormatter.h

// 2 for the 0x prefix, plus 16 for the hex value, plus 1 for the null terminator
#define SENTRY_HEX_ADDRESS_LENGTH 19

static inline NSString *
sentry_snprintfHexAddress(uint64_t value)
{
char buffer[SENTRY_HEX_ADDRESS_LENGTH];
snprintf(buffer, SENTRY_HEX_ADDRESS_LENGTH, "0x%016llx", value);
NSString *nsString = [NSString stringWithCString:buffer encoding:NSASCIIStringEncoding];
return nsString;
}

static inline NSString *
sentry_formatHexAddress(NSNumber *value)
{
/*
* We observed a 41% speedup by using snprintf vs +[NSString stringWithFormat:]. In a trial
* using a profile, we observed the +[NSString stringWithFormat:] using 282ms of CPU time, vs
* 164ms of CPU time for snprintf. There is also an assumed space improvement due to not needing
* to allocate as many instances of NSString, like for the format string literal, instead only
* using stack-bound C strings.
*/
return sentry_snprintfHexAddress([value unsignedLongLongValue]);
}

static inline NSString *
sentry_formatHexAddressUInt64(uint64_t value)
{
return sentry_snprintfHexAddress(value);
}
1 change: 0 additions & 1 deletion packages/core/ios/RNSentry.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#import <Sentry/SentryDebugMeta.h>
#import <Sentry/SentryEvent.h>
#import <Sentry/SentryException.h>
#import <Sentry/SentryFormatter.h>
#import <Sentry/SentryGeo.h>
#import <Sentry/SentryUser.h>

Expand Down
2 changes: 1 addition & 1 deletion packages/core/ios/RNSentryRNSScreen.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# import "RNSentryDependencyContainer.h"
# import "RNSentryFramesTrackerListener.h"
# import <Sentry/SentrySwizzle.h>
# import "SentrySwizzle.h"
@import Sentry;

@implementation RNSentryRNSScreen
Expand Down
4 changes: 2 additions & 2 deletions packages/core/ios/RNSentrySDK.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#import "RNSentrySDK.h"
#import "RNSentryStart.h"
#import <Sentry/PrivateSentrySDKOnly.h>
#import <Sentry/Sentry.h>
#import <Sentry/SentryOptionsInternal.h>

static NSString *SENTRY_OPTIONS_RESOURCE_NAME = @"sentry.options";
static NSString *SENTRY_OPTIONS_RESOURCE_TYPE = @"json";
Expand Down Expand Up @@ -60,7 +60,7 @@ + (void)start:(NSString *)path configureOptions:(void (^)(SentryOptions *options
if (options == nil) {
// Fallback in case that options file could not be parsed.
NSError *fallbackError = nil;
options = [SentryOptionsInternal initWithDict:@{} didFailWithError:&fallbackError];
options = [PrivateSentrySDKOnly optionsWithDictionary:@{} didFailWithError:&fallbackError];
if (fallbackError != nil) {
NSLog(@"[RNSentry] Failed to create fallback options with error: %@",
fallbackError.localizedDescription);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/ios/RNSentryStart.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ + (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)
BOOL isSessionReplayEnabled = NO;
#endif

SentryOptions *sentryOptions = [SentryOptionsInternal initWithDict:mutableOptions
didFailWithError:errorPointer];
SentryOptions *sentryOptions = [PrivateSentrySDKOnly optionsWithDictionary:mutableOptions
didFailWithError:errorPointer];
if (*errorPointer != nil) {
return nil;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/ios/SentrySDKWrapper.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ + (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options
error:(NSError *__autoreleasing *)errorPointer
{
NSString *dsn = [self getURLFromDSN:[options valueForKey:@"dsn"]];
SentryOptions *sentryOptions = [SentryOptionsInternal initWithDict:options
didFailWithError:errorPointer];
SentryOptions *sentryOptions = [PrivateSentrySDKOnly optionsWithDictionary:options
didFailWithError:errorPointer];
if (*errorPointer != nil) {
return nil;
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/update-cocoa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

file="$(dirname "$0")/../packages/core/RNSentry.podspec"
content=$(cat $file)
regex="('Sentry/HybridSDK', *)'([0-9\.]+)'"
regex="('Sentry', *)'([0-9\.]+)'"
if ! [[ $content =~ $regex ]]; then
echo "Failed to find the plugin version in $file"
exit 1
Expand Down
Loading