Skip to content

Commit 1d0635f

Browse files
itaybreantonisdenrasenoahsmartinphilipphofmann
authored
chore: Move from using Hybrid SDK subspec to regular Sentry podspec (#5451)
* chore(deps): update Cocoa SDK to v9.0.0-alpha.0 * Adds changelog * fix: Fixes SentryScreenFrames use after being converted to Swift (#5153) * fix: Fixes SentryScreenFrames use after being converted to Swift * Fix build --------- Co-authored-by: Antonis Lilis <antonis.lilis@sentry.io> * Move `sentry-cocoa` `enableLogs` out of experimental (#5267) * fix: Fixes SentryScreenFrames use after being converted to Swift * Fix build * Use non-experimental enableLogs * bump target * remove enable tracing * Update enableLogs tests --------- Co-authored-by: Itay Brenner <itay.brenner@sentry.io> Co-authored-by: Itay Brenner <itaybrenner@hotmail.com> Co-authored-by: Antonis Lilis <antonis.lilis@sentry.io> * chore: Remove SentryFrameTracker imports (#5276) * fix: Fixes SentryScreenFrames use after being converted to Swift * Fix build * Use non-experimental enableLogs * bump target * remove enable tracing * Update enableLogs tests * chore: Fix RNSentry after SentryFramesTracker conversion to swift * Run linter * Remove unused debug image provider imports * Remove imports * chore: Remove deprecated user property * chore: Remove use of deprecate integrations API (#5304) * Remove use of integrations in tests * chore: Remove use of deprecated prop (#5322) * ref: Move options to wrapper --------- Co-authored-by: Antonis Lilis <antonis.lilis@sentry.io> Co-authored-by: Denis Andrasec <denrase@gmail.com> Co-authored-by: Noah Martin <noahm444@gmail.com> * fix(podspec): Cocoa V9 allow any alpha version * chore(sample): Cocoa-v9: Bump MacOS sample to macos 12.0 (#5359) * fix: Fixes SentryScreenFrames use after being converted to Swift * Fix build * Use non-experimental enableLogs * bump target * remove enable tracing * Update enableLogs tests * chore: Fix RNSentry after SentryFramesTracker conversion to swift * Run linter * Remove unused debug image provider imports * Remove imports * chore: Remove deprecated user property * chore: Remove use of deprecate integrations API (#5304) * Remove use of integrations in tests * chore: Remove use of deprecated prop (#5322) * ref: Move options to wrapper * chore(sample): Bump MacOS sample to macos 12.0 wich is the minimum for v9 --------- Co-authored-by: Itay Brenner <itay.brenner@sentry.io> Co-authored-by: Itay Brenner <itaybrenner@hotmail.com> Co-authored-by: Denis Andrasec <denrase@gmail.com> Co-authored-by: Noah Martin <noahm444@gmail.com> * chore(e2e): Cocoa-v9: Bump E2E to iOS 15.0 (#5369) * fix: Fixes SentryScreenFrames use after being converted to Swift * Fix build * Use non-experimental enableLogs * bump target * remove enable tracing * Update enableLogs tests * chore: Fix RNSentry after SentryFramesTracker conversion to swift * Run linter * Remove unused debug image provider imports * Remove imports * chore: Remove deprecated user property * chore: Remove use of deprecate integrations API (#5304) * Remove use of integrations in tests * chore: Remove use of deprecated prop (#5322) * ref: Move options to wrapper * chore(sample): Bump MacOS sample to macos 12.0 wich is the minimum for v9 * chore(e2e): Cocoa-v9: Bump E2E to iOS 15.0 * Bump to 15.1 due to RN 0.81.0 requirements --------- Co-authored-by: Itay Brenner <itay.brenner@sentry.io> Co-authored-by: Itay Brenner <itaybrenner@hotmail.com> Co-authored-by: Denis Andrasec <denrase@gmail.com> Co-authored-by: Noah Martin <noahm444@gmail.com> * chore(ci): Cocoa V9: Run the full CI checks for cocoa-v9 (#5370) * Update changelog * Bumpt to RC1 * Remove cocoa-v9 from ci branches * fix: Use new session replay name for hybrid SDK * Fix rename * chore(lint): Fixes lint issues * Update changelog to GA * chore: Move from using Hybrid SDK subspec to regular Sentry podspec * Update changelog * Bump minimum to 9.1.0 * Replace SentryOptionsInternal with PrivateSentrySDKOnly helper method * Replace the deprecated `optionsWithDictionary` with `options(with:)` * Added RNSentry+formatters.h * Do not use subspec * Fix lint issues * Remove Unused import * Fix build issue * Add header search paths --------- Co-authored-by: Antonis Lilis <antonis.lilis@sentry.io> Co-authored-by: Denis Andrašec <denrase@gmail.com> Co-authored-by: Noah Martin <noahm444@gmail.com> Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
1 parent 8cc8812 commit 1d0635f

File tree

11 files changed

+67
-31
lines changed

11 files changed

+67
-31
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ cd sentry-react-native
136136
Comment out sentry dependency in `RNSentry.podspec`.
137137

138138
```diff
139-
- s.dependency 'Sentry/HybridSDK', '7.31.0'
140-
+ s.dependency 'Sentry/HybridSDK'
139+
- s.dependency 'Sentry', '7.31.0'
140+
+ s.dependency 'Sentry'
141141
```
142142

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

148148
# ... react native config
149149

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

153153
end

packages/core/RNSentry.podspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,11 @@ Pod::Spec.new do |s|
4747
s.compiler_flags = other_cflags
4848

4949
s.pod_target_xcconfig = {
50-
'DEFINES_MODULE' => 'YES'
50+
'DEFINES_MODULE' => 'YES',
51+
'HEADER_SEARCH_PATHS' => '$(inherited) "${PODS_ROOT}/Sentry/Sources/Sentry" "${PODS_ROOT}/Sentry/Sources/Sentry/include"'
5152
}
5253

53-
s.dependency 'Sentry/HybridSDK', '9.3.0'
54+
s.dependency 'Sentry', '9.3.0'
5455

5556
if defined? install_modules_dependencies
5657
# Default React Native dependencies for 0.71 and above (new and legacy architecture)

packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryReplayOptionsTests.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ final class RNSentryReplayOptions: XCTestCase {
6767
] as NSDictionary).mutableCopy() as! NSMutableDictionary
6868
RNSentryReplay.updateOptions(optionsDict)
6969

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

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

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

@@ -108,7 +108,7 @@ final class RNSentryReplayOptions: XCTestCase {
108108

109109
RNSentryReplay.updateOptions(optionsDict)
110110

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

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

124124
RNSentryReplay.updateOptions(optionsDict)
125125

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

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

139139
RNSentryReplay.updateOptions(optionsDict)
140140

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

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

163163
RNSentryReplay.updateOptions(optionsDict)
164164

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

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

177177
RNSentryReplay.updateOptions(optionsDict)
178178

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

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

191191
RNSentryReplay.updateOptions(optionsDict)
192192

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

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

205205
RNSentryReplay.updateOptions(optionsDict)
206206

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

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

218218
RNSentryReplay.updateOptions(optionsDict)
219219

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

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

232232
RNSentryReplay.updateOptions(optionsDict)
233233

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

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

246246
RNSentryReplay.updateOptions(optionsDict)
247247

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

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

259259
RNSentryReplay.updateOptions(optionsDict)
260260

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

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

273273
RNSentryReplay.updateOptions(optionsDict)
274274

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

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

287287
RNSentryReplay.updateOptions(optionsDict)
288288

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

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

301301
RNSentryReplay.updateOptions(optionsDict)
302302

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

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

315315
RNSentryReplay.updateOptions(optionsDict)
316316

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

319319
XCTAssertEqual(actualOptions.sessionReplay.quality, SentryReplayOptions.SentryReplayQuality.medium)
320320
}

packages/core/ios/RNSentry+fetchNativeStack.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#import "RNSentry+formatters.h"
12
#import "RNSentry.h"
23
#import "RNSentryBreadcrumb.h"
34
#import "RNSentryId.h"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#import <Foundation/Foundation.h>
2+
3+
// This file is a copy from
4+
// https://github.com/getsentry/sentry-cocoa/blob/6c20265de0903b835a299e2e9da0f7af50af09f5/Sources/Sentry/include/HybridPublic/SentryFormatter.h
5+
6+
// 2 for the 0x prefix, plus 16 for the hex value, plus 1 for the null terminator
7+
#define SENTRY_HEX_ADDRESS_LENGTH 19
8+
9+
static inline NSString *
10+
sentry_snprintfHexAddress(uint64_t value)
11+
{
12+
char buffer[SENTRY_HEX_ADDRESS_LENGTH];
13+
snprintf(buffer, SENTRY_HEX_ADDRESS_LENGTH, "0x%016llx", value);
14+
NSString *nsString = [NSString stringWithCString:buffer encoding:NSASCIIStringEncoding];
15+
return nsString;
16+
}
17+
18+
static inline NSString *
19+
sentry_formatHexAddress(NSNumber *value)
20+
{
21+
/*
22+
* We observed a 41% speedup by using snprintf vs +[NSString stringWithFormat:]. In a trial
23+
* using a profile, we observed the +[NSString stringWithFormat:] using 282ms of CPU time, vs
24+
* 164ms of CPU time for snprintf. There is also an assumed space improvement due to not needing
25+
* to allocate as many instances of NSString, like for the format string literal, instead only
26+
* using stack-bound C strings.
27+
*/
28+
return sentry_snprintfHexAddress([value unsignedLongLongValue]);
29+
}
30+
31+
static inline NSString *
32+
sentry_formatHexAddressUInt64(uint64_t value)
33+
{
34+
return sentry_snprintfHexAddress(value);
35+
}

packages/core/ios/RNSentry.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#import <Sentry/SentryDebugMeta.h>
2525
#import <Sentry/SentryEvent.h>
2626
#import <Sentry/SentryException.h>
27-
#import <Sentry/SentryFormatter.h>
2827
#import <Sentry/SentryGeo.h>
2928
#import <Sentry/SentryUser.h>
3029

packages/core/ios/RNSentryRNSScreen.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
# import "RNSentryDependencyContainer.h"
66
# import "RNSentryFramesTrackerListener.h"
7-
# import <Sentry/SentrySwizzle.h>
7+
# import "SentrySwizzle.h"
88
@import Sentry;
99

1010
@implementation RNSentryRNSScreen

packages/core/ios/RNSentrySDK.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#import "RNSentrySDK.h"
22
#import "RNSentryStart.h"
3+
#import <Sentry/PrivateSentrySDKOnly.h>
34
#import <Sentry/Sentry.h>
4-
#import <Sentry/SentryOptionsInternal.h>
55

66
static NSString *SENTRY_OPTIONS_RESOURCE_NAME = @"sentry.options";
77
static NSString *SENTRY_OPTIONS_RESOURCE_TYPE = @"json";
@@ -60,7 +60,7 @@ + (void)start:(NSString *)path configureOptions:(void (^)(SentryOptions *options
6060
if (options == nil) {
6161
// Fallback in case that options file could not be parsed.
6262
NSError *fallbackError = nil;
63-
options = [SentryOptionsInternal initWithDict:@{} didFailWithError:&fallbackError];
63+
options = [PrivateSentrySDKOnly optionsWithDictionary:@{} didFailWithError:&fallbackError];
6464
if (fallbackError != nil) {
6565
NSLog(@"[RNSentry] Failed to create fallback options with error: %@",
6666
fallbackError.localizedDescription);

packages/core/ios/RNSentryStart.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ + (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)
4646
BOOL isSessionReplayEnabled = NO;
4747
#endif
4848

49-
SentryOptions *sentryOptions = [SentryOptionsInternal initWithDict:mutableOptions
50-
didFailWithError:errorPointer];
49+
SentryOptions *sentryOptions = [PrivateSentrySDKOnly optionsWithDictionary:mutableOptions
50+
didFailWithError:errorPointer];
5151
if (*errorPointer != nil) {
5252
return nil;
5353
}

packages/core/ios/SentrySDKWrapper.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ + (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options
3535
error:(NSError *__autoreleasing *)errorPointer
3636
{
3737
NSString *dsn = [self getURLFromDSN:[options valueForKey:@"dsn"]];
38-
SentryOptions *sentryOptions = [SentryOptionsInternal initWithDict:options
39-
didFailWithError:errorPointer];
38+
SentryOptions *sentryOptions = [PrivateSentrySDKOnly optionsWithDictionary:options
39+
didFailWithError:errorPointer];
4040
if (*errorPointer != nil) {
4141
return nil;
4242
}

0 commit comments

Comments
 (0)