-
-
Notifications
You must be signed in to change notification settings - Fork 38
Fix(V3): Duplicated session / Fix incompatibility with Cocoa V9 #1088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
daa33ea
bb1c141
fc2a7a5
bcf1992
38ca5c8
690c282
0a6b205
6b04ae0
3853ed0
7c6b5c4
1bb319d
d9c629e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,11 +2,6 @@ import Foundation | |
| import Capacitor | ||
| @preconcurrency import Sentry | ||
|
|
||
| // Keep compatibility with CocoaPods. | ||
| #if SWIFT_PACKAGE | ||
| import Sentry._Hybrid | ||
| #endif | ||
|
|
||
| /** | ||
| * Please read the Capacitor iOS Plugin Development Guide | ||
| * here: https://capacitorjs.com/docs/plugins/ios | ||
|
|
@@ -70,7 +65,7 @@ public class SentryCapacitorPlugin: CAPPlugin, CAPBridgedPlugin { | |
| } | ||
|
|
||
| do { | ||
| let options = try SentryOptionsInternal.initWithDict(optionsDict) | ||
| let options = try createOptions(from: optionsDict) | ||
| let sdkVersion = PrivateSentrySDKOnly.getSdkVersionString() | ||
| PrivateSentrySDKOnly.setSdkName(nativeSdkName, andVersionString: sdkVersion) | ||
|
|
||
|
|
@@ -102,8 +97,67 @@ public class SentryCapacitorPlugin: CAPPlugin, CAPBridgedPlugin { | |
|
|
||
| call.resolve() | ||
| } catch { | ||
| call.reject("Failed to start native SDK") | ||
| call.reject("Failed to start native SDK: \(error.localizedDescription)") | ||
| } | ||
| } | ||
|
|
||
| private func createOptions(from dict: [AnyHashable: Any]) throws -> Options { | ||
| guard let dsn = dict["dsn"] as? String else { | ||
| throw NSError(domain: "SentryCapacitor", code: 1, userInfo: [NSLocalizedDescriptionKey: "DSN is required"]) | ||
| } | ||
|
|
||
| let options = Options() | ||
| options.dsn = dsn | ||
|
|
||
| if let debug = dict["debug"] as? Bool { | ||
| options.debug = debug | ||
| } | ||
|
|
||
| if let environment = dict["environment"] as? String { | ||
| options.environment = environment | ||
| } | ||
|
|
||
| if let release = dict["release"] as? String { | ||
| options.releaseName = release | ||
| } | ||
|
|
||
| if let dist = dict["dist"] as? String { | ||
| options.dist = dist | ||
| } | ||
|
|
||
| if let enableAutoSessionTracking = dict["enableAutoSessionTracking"] as? Bool { | ||
| options.enableAutoSessionTracking = enableAutoSessionTracking | ||
| } | ||
|
|
||
| if let sessionTrackingIntervalMillis = dict["sessionTrackingIntervalMillis"] as? Int { | ||
| options.sessionTrackingIntervalMillis = UInt(sessionTrackingIntervalMillis) | ||
| } | ||
|
|
||
| if let maxBreadcrumbs = dict["maxBreadcrumbs"] as? UInt { | ||
| options.maxBreadcrumbs = maxBreadcrumbs | ||
| } | ||
|
Comment on lines
+132
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: A negative value for Suggested FixBefore casting Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd rather limit this on the JavaScript side. |
||
|
|
||
| if let enableNativeCrashHandling = dict["enableNativeCrashHandling"] as? Bool { | ||
| options.enableCrashHandler = enableNativeCrashHandling | ||
| } | ||
|
|
||
| if let attachStacktrace = dict["attachStacktrace"] as? Bool { | ||
| options.attachStacktrace = attachStacktrace | ||
| } | ||
|
|
||
| if let sampleRate = dict["sampleRate"] as? Double { | ||
| options.sampleRate = NSNumber(value: sampleRate) | ||
| } | ||
|
|
||
| if let tracesSampleRate = dict["tracesSampleRate"] as? Double { | ||
| options.tracesSampleRate = NSNumber(value: tracesSampleRate) | ||
| } | ||
|
|
||
| if let enableAutoPerformanceTracing = dict["enableAutoPerformanceTracing"] as? Bool { | ||
| options.enableAutoPerformanceTracing = enableAutoPerformanceTracing | ||
| } | ||
|
|
||
| return options | ||
| } | ||
|
|
||
| @objc func captureEnvelope(_ call: CAPPluginCall) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.