diff --git a/CHANGELOG.md b/CHANGELOG.md index f0454a3469..e67270fd9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,9 +19,9 @@ ### Dependencies -- Reapply "Bump Cocoa SDK from v8.39.0 to v8.46.0 (#4103)" ([#4442](https://github.com/getsentry/sentry-dotnet/pull/4442)) - - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8460) - - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.39.0...8.46.0) +- Bump sentry-cocoa from 8.39.0 to 8.55.1 ([#4442](https://github.com/getsentry/sentry-dotnet/pull/4442), [#4483](https://github.com/getsentry/sentry-dotnet/pull/4483), [#4485](https://github.com/getsentry/sentry-dotnet/pull/4485)) + - [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8551) + - [diff](https://github.com/getsentry/sentry-cocoa/compare/8.39.0...8.55.1) - Bump Native SDK from v0.9.1 to v0.10.1 ([#4436](https://github.com/getsentry/sentry-dotnet/pull/4436), [#4492](https://github.com/getsentry/sentry-dotnet/pull/4492)) - [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0101) - [diff](https://github.com/getsentry/sentry-native/compare/0.9.1...0.10.1) diff --git a/modules/sentry-cocoa.properties b/modules/sentry-cocoa.properties index f3c920b1e0..cb992f6d1a 100644 --- a/modules/sentry-cocoa.properties +++ b/modules/sentry-cocoa.properties @@ -1,2 +1,2 @@ -version = 8.53.2 +version = 8.55.1 repo = https://github.com/getsentry/sentry-cocoa diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index d06ebea472..04d44efeb6 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -49,14 +49,14 @@ if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ # Verify checksum Write-Output "Verifying package checksum..." $actualSha256 = (Get-FileHash -Path $downloadPath -Algorithm SHA256).Hash.ToLower() - + if ($actualSha256 -ne $expectedSha256) { Write-Error "Checksum verification failed. Expected: $expectedSha256, Actual: $actualSha256" Remove-Item $downloadPath -Force -ErrorAction SilentlyContinue exit 1 } - + Write-Output "Checksum verification passed." if (Test-Path $downloadPath) @@ -108,7 +108,7 @@ foreach ($file in $filesToPatch) { $content = Get-Content -Path $file -Raw $content = $content -replace ']+)>', '"$1"' - $content = $content -replace '#import SENTRY_HEADER\(([^)]+)\)', '#import "$1.h"' + $content = $content -replace '#\s*import SENTRY_HEADER\(([^)]+)\)', '#import "$1.h"' Set-Content -Path $file -Value $content } else @@ -209,7 +209,10 @@ $Text = $Text -replace '\bISentrySerializable\b', 'SentrySerializable' $Text = $Text -replace ': INSCopying,', ':' -replace '\s?[:,] INSCopying', '' # Remove iOS attributes like [iOS (13, 0)] -$Text = $Text -replace '\[iOS \(13,\s?0\)\]\n?', '' +$Text = $Text -replace '\[iOS \(13,\s?0\)\]\n?\s*', '' + +# Remove Unavailable attributes like [Unavailable (PlatformName.iOSAppExtension)] +$Text = $Text -replace '\[Unavailable \(PlatformName\.\w+\)\]\n?\s*', '' # Fix delegate argument names $Text = $Text -replace '(NSError) arg\d', '$1 error' @@ -219,6 +222,7 @@ $Text = $Text -replace '(SentrySamplingContext) arg\d', '$1 samplingContext' $Text = $Text -replace '(SentryBreadcrumb) arg\d', '$1 breadcrumb' $Text = $Text -replace '(SentrySpan) arg\d', '$1 span' $Text = $Text -replace '(SentryAppStartMeasurement) arg\d', '$1 appStartMeasurement' +$Text = $Text -replace '(SentryLog) arg\d', '$1 log' # Adjust nullable return delegates (though broken until this is fixed: https://github.com/xamarin/xamarin-macios/issues/17109) $Text = $Text -replace 'delegate \w+ Sentry(BeforeBreadcrumb|BeforeSendEvent|TracesSampler)Callback', "[return: NullAllowed]`n$&" @@ -259,8 +263,9 @@ $Text = $Text -replace '\[Verify \(MethodToProperty\)\]\n\s*(.+) \{ get; \}', '$ # We have some that accept either NSString or NSRegularExpression, which have no common type so they use NSObject $Text = $Text -replace '\s*\[Verify \(StronglyTypedNSArray\)\]\n', '' -# Fix broken line comment +# Fix broken multi-line comments $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\()\n\s*', '$1' +$Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\([^)]*?)"\s*\r?\n\s*"', '$1 ' # Remove default IsEqual implementation (already implemented by NSObject) $Text = $Text -replace '(?ms)\n?^ *// [^\n]*isEqual:.*?$.*?;\n', '' diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 3b563d3c4f..31997fdfd7 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -34,6 +34,10 @@ namespace Sentry.CocoaSdk; [Internal] delegate SentrySpan SentryBeforeSendSpanCallback (SentrySpan span); +// typedef SentryLog * _Nullable (^SentryBeforeSendLogCallback)(SentryLog * _Nonnull); +[Internal] +delegate SentryLog SentryBeforeSendLogCallback (SentryLog log); + // typedef BOOL (^SentryBeforeCaptureScreenshotCallback)(SentryEvent * _Nonnull); [Internal] delegate bool SentryBeforeCaptureScreenshotCallback (SentryEvent @event); @@ -611,12 +615,12 @@ interface SentryException : SentrySerializable [Internal] interface SentryFeedbackAPI { - // -(void)showWidget __attribute__((availability(ios, introduced=13.0))); - [Export ("showWidget")] + // -(void)showWidget __attribute__((availability(ios, introduced=13.0))) __attribute__((availability(macos_app_extension, unavailable))) __attribute__((availability(ios_app_extension, unavailable))); + [Export ("showWidget")] void ShowWidget (); - // -(void)hideWidget __attribute__((availability(ios, introduced=13.0))); - [Export ("hideWidget")] + // -(void)hideWidget __attribute__((availability(ios, introduced=13.0))) __attribute__((availability(macos_app_extension, unavailable))) __attribute__((availability(ios_app_extension, unavailable))); + [Export ("hideWidget")] void HideWidget (); } @@ -669,6 +673,18 @@ interface SentryFrame : SentrySerializable [NullAllowed, Export ("columnNumber", ArgumentSemantic.Copy)] NSNumber ColumnNumber { get; set; } + // @property (copy, nonatomic) NSString * _Nullable contextLine; + [NullAllowed, Export ("contextLine")] + string ContextLine { get; set; } + + // @property (copy, nonatomic) NSArray * _Nullable preContext; + [NullAllowed, Export ("preContext", ArgumentSemantic.Copy)] + string[] PreContext { get; set; } + + // @property (copy, nonatomic) NSArray * _Nullable postContext; + [NullAllowed, Export ("postContext", ArgumentSemantic.Copy)] + string[] PostContext { get; set; } + // @property (copy, nonatomic) NSNumber * _Nullable inApp; [NullAllowed, Export ("inApp", ArgumentSemantic.Copy)] NSNumber InApp { get; set; } @@ -676,6 +692,10 @@ interface SentryFrame : SentrySerializable // @property (copy, nonatomic) NSNumber * _Nullable stackStart; [NullAllowed, Export ("stackStart", ArgumentSemantic.Copy)] NSNumber StackStart { get; set; } + + // @property (copy, nonatomic) NSDictionary * _Nullable vars; + [NullAllowed, Export ("vars", ArgumentSemantic.Copy)] + NSDictionary Vars { get; set; } } // @interface SentryGeo : NSObject @@ -1389,6 +1409,10 @@ interface SentryOptions [NullAllowed, Export ("beforeSendSpan", ArgumentSemantic.Copy)] SentryBeforeSendSpanCallback BeforeSendSpan { get; set; } + // @property (copy, nonatomic) SentryBeforeSendLogCallback _Nullable beforeSendLog; + [NullAllowed, Export ("beforeSendLog", ArgumentSemantic.Copy)] + SentryBeforeSendLogCallback BeforeSendLog { get; set; } + // @property (copy, nonatomic) SentryBeforeBreadcrumbCallback _Nullable beforeBreadcrumb; [NullAllowed, Export ("beforeBreadcrumb", ArgumentSemantic.Copy)] SentryBeforeBreadcrumbCallback BeforeBreadcrumb { get; set; } @@ -1405,8 +1429,8 @@ interface SentryOptions [NullAllowed, Export ("onCrashedLastRun", ArgumentSemantic.Copy)] SentryOnCrashedLastRunCallback OnCrashedLastRun { get; set; } - // @property (copy, nonatomic) NSArray * _Nullable integrations; - [NullAllowed, Export ("integrations", ArgumentSemantic.Copy)] + // @property (copy, nonatomic) DEPRECATED_MSG_ATTRIBUTE("Setting `SentryOptions.integrations` is deprecated. Integrations should be enabled or disabled using their respective `SentryOptions.enable*` property.") NSArray * integrations __attribute__((deprecated("Setting `SentryOptions.integrations` is deprecated. Integrations should be enabled or disabled using their respective `SentryOptions.enable*` property."))); + [Export ("integrations", ArgumentSemantic.Copy)] string[] Integrations { get; set; } // +(NSArray * _Nonnull)defaultIntegrations; @@ -1562,19 +1586,19 @@ interface SentryOptions [NullAllowed, Export ("configureProfiling", ArgumentSemantic.Copy)] SentryProfilingConfigurationBlock ConfigureProfiling { get; set; } - // @property (assign, nonatomic) BOOL enableAppLaunchProfiling; + // @property (assign, nonatomic) BOOL enableAppLaunchProfiling __attribute__((deprecated("This property is deprecated and will be removed in a future version of the SDK. See SentryProfileOptions.startOnAppStart and SentryProfileOptions.lifecycle"))); [Export ("enableAppLaunchProfiling")] bool EnableAppLaunchProfiling { get; set; } - // @property (nonatomic, strong) NSNumber * _Nullable profilesSampleRate; - [NullAllowed, Export ("profilesSampleRate", ArgumentSemantic.Strong)] + // @property (nonatomic, strong) DEPRECATED_MSG_ATTRIBUTE("This property is deprecated and will be removed in a future version of the SDK. See SentryProfileOptions.sessionSampleRate") NSNumber * profilesSampleRate __attribute__((deprecated("This property is deprecated and will be removed in a future version of the SDK. See SentryProfileOptions.sessionSampleRate"))); + [Export ("profilesSampleRate", ArgumentSemantic.Strong)] NSNumber ProfilesSampleRate { get; set; } - // @property (nonatomic) SentryTracesSamplerCallback _Nullable profilesSampler; - [NullAllowed, Export ("profilesSampler", ArgumentSemantic.Assign)] + // @property (nonatomic) DEPRECATED_MSG_ATTRIBUTE("This property is deprecated and will be removed in a future version of the SDK. See SentryProfileOptions.sessionSampleRate") SentryTracesSamplerCallback profilesSampler __attribute__((deprecated("This property is deprecated and will be removed in a future version of the SDK. See SentryProfileOptions.sessionSampleRate"))); + [Export ("profilesSampler", ArgumentSemantic.Assign)] SentryTracesSamplerCallback ProfilesSampler { get; set; } - // @property (readonly, assign, nonatomic) BOOL isProfilingEnabled; + // @property (readonly, assign, nonatomic) BOOL isProfilingEnabled __attribute__((deprecated("This property is deprecated and will be removed in a future version of the SDK"))); [Export ("isProfilingEnabled")] bool IsProfilingEnabled { get; } @@ -1649,8 +1673,8 @@ interface SentryOptions [Export ("_swiftExperimentalOptions")] NSObject _swiftExperimentalOptions { get; } - // @property (copy, nonatomic) API_AVAILABLE(ios(13.0)) SentryUserFeedbackConfigurationBlock configureUserFeedback __attribute__((availability(ios, introduced=13.0))); - [Export ("configureUserFeedback", ArgumentSemantic.Copy)] + // @property (copy, nonatomic) API_AVAILABLE(ios(13.0)) SentryUserFeedbackConfigurationBlock configureUserFeedback __attribute__((availability(ios, introduced=13.0))) __attribute__((availability(macos_app_extension, unavailable))) __attribute__((availability(ios_app_extension, unavailable))); + [Export ("configureUserFeedback", ArgumentSemantic.Copy)] SentryUserFeedbackConfigurationBlock ConfigureUserFeedback { get; set; } } @@ -1734,218 +1758,6 @@ interface SentryRequest : SentrySerializable string Url { get; set; } } -// @interface SentrySDK : NSObject -[BaseType (typeof(NSObject))] -[DisableDefaultCtor] -[Internal] -interface SentrySDK -{ - // @property (readonly, nonatomic, class) id _Nullable span; - [Static] - [NullAllowed, Export ("span")] - SentrySpan Span { get; } - - // @property (readonly, nonatomic, class) BOOL isEnabled; - [Static] - [Export ("isEnabled")] - bool IsEnabled { get; } - - // @property (readonly, nonatomic, class) SentryReplayApi * _Nonnull replay; - [Static] - [Export ("replay")] - SentryReplayApi Replay { get; } - - // +(void)startWithOptions:(SentryOptions * _Nonnull)options __attribute__((swift_name("start(options:)"))); - [Static] - [Export ("startWithOptions:")] - void StartWithOptions (SentryOptions options); - - // +(void)startWithConfigureOptions:(void (^ _Nonnull)(SentryOptions * _Nonnull))configureOptions __attribute__((swift_name("start(configureOptions:)"))); - [Static] - [Export ("startWithConfigureOptions:")] - void StartWithConfigureOptions (Action configureOptions); - - // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event __attribute__((swift_name("capture(event:)"))); - [Static] - [Export ("captureEvent:")] - SentryId CaptureEvent (SentryEvent @event); - - // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(event:scope:)"))); - [Static] - [Export ("captureEvent:withScope:")] - SentryId CaptureEvent (SentryEvent @event, SentryScope scope); - - // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block __attribute__((swift_name("capture(event:block:)"))); - [Static] - [Export ("captureEvent:withScopeBlock:")] - SentryId CaptureEvent (SentryEvent @event, Action block); - - // +(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation __attribute__((swift_name("startTransaction(name:operation:)"))); - [Static] - [Export ("startTransactionWithName:operation:")] - SentrySpan StartTransactionWithName (string name, string operation); - - // +(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation bindToScope:(BOOL)bindToScope __attribute__((swift_name("startTransaction(name:operation:bindToScope:)"))); - [Static] - [Export ("startTransactionWithName:operation:bindToScope:")] - SentrySpan StartTransactionWithName (string name, string operation, bool bindToScope); - - // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext __attribute__((swift_name("startTransaction(transactionContext:)"))); - [Static] - [Export ("startTransactionWithContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext); - - // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope __attribute__((swift_name("startTransaction(transactionContext:bindToScope:)"))); - [Static] - [Export ("startTransactionWithContext:bindToScope:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope); - - // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext __attribute__((swift_name("startTransaction(transactionContext:bindToScope:customSamplingContext:)"))); - [Static] - [Export ("startTransactionWithContext:bindToScope:customSamplingContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope, NSDictionary customSamplingContext); - - // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext __attribute__((swift_name("startTransaction(transactionContext:customSamplingContext:)"))); - [Static] - [Export ("startTransactionWithContext:customSamplingContext:")] - SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, NSDictionary customSamplingContext); - - // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error __attribute__((swift_name("capture(error:)"))); - [Static] - [Export ("captureError:")] - SentryId CaptureError (NSError error); - - // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(error:scope:)"))); - [Static] - [Export ("captureError:withScope:")] - SentryId CaptureError (NSError error, SentryScope scope); - - // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block __attribute__((swift_name("capture(error:block:)"))); - [Static] - [Export ("captureError:withScopeBlock:")] - SentryId CaptureError (NSError error, Action block); - - // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception __attribute__((swift_name("capture(exception:)"))); - [Static] - [Export ("captureException:")] - SentryId CaptureException (NSException exception); - - // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(exception:scope:)"))); - [Static] - [Export ("captureException:withScope:")] - SentryId CaptureException (NSException exception, SentryScope scope); - - // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block __attribute__((swift_name("capture(exception:block:)"))); - [Static] - [Export ("captureException:withScopeBlock:")] - SentryId CaptureException (NSException exception, Action block); - - // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message __attribute__((swift_name("capture(message:)"))); - [Static] - [Export ("captureMessage:")] - SentryId CaptureMessage (string message); - - // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(message:scope:)"))); - [Static] - [Export ("captureMessage:withScope:")] - SentryId CaptureMessage (string message, SentryScope scope); - - // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block __attribute__((swift_name("capture(message:block:)"))); - [Static] - [Export ("captureMessage:withScopeBlock:")] - SentryId CaptureMessage (string message, Action block); - - // +(void)captureUserFeedback:(SentryUserFeedback * _Nonnull)userFeedback __attribute__((swift_name("capture(userFeedback:)"))) __attribute__((deprecated("Use SentrySDK.captureFeedback or use or configure our new managed UX with SentryOptions.configureUserFeedback."))); - [Static] - [Export ("captureUserFeedback:")] - void CaptureUserFeedback (SentryUserFeedback userFeedback); - - // +(void)captureFeedback:(SentryFeedback * _Nonnull)feedback __attribute__((swift_name("capture(feedback:)"))); - [Static] - [Export ("captureFeedback:")] - void CaptureFeedback (SentryFeedback feedback); - - // @property (readonly, nonatomic, class) API_AVAILABLE(ios(13.0)) SentryFeedbackAPI * feedback __attribute__((availability(ios, introduced=13.0))); - [Static] - [Export ("feedback")] - SentryFeedbackAPI Feedback { get; } - - // +(void)addBreadcrumb:(SentryBreadcrumb * _Nonnull)crumb __attribute__((swift_name("addBreadcrumb(_:)"))); - [Static] - [Export ("addBreadcrumb:")] - void AddBreadcrumb (SentryBreadcrumb crumb); - - // +(void)configureScope:(void (^ _Nonnull)(SentryScope * _Nonnull))callback; - [Static] - [Export ("configureScope:")] - void ConfigureScope (Action callback); - - // @property (readonly, nonatomic, class) BOOL crashedLastRun; - [Static] - [Export ("crashedLastRun")] - bool CrashedLastRun { get; } - - // @property (readonly, nonatomic, class) BOOL detectedStartUpCrash; - [Static] - [Export ("detectedStartUpCrash")] - bool DetectedStartUpCrash { get; } - - // +(void)setUser:(SentryUser * _Nullable)user; - [Static] - [Export ("setUser:")] - void SetUser ([NullAllowed] SentryUser user); - - // +(void)startSession; - [Static] - [Export ("startSession")] - void StartSession (); - - // +(void)endSession; - [Static] - [Export ("endSession")] - void EndSession (); - - // +(void)crash; - [Static] - [Export ("crash")] - void Crash (); - - // +(void)reportFullyDisplayed; - [Static] - [Export ("reportFullyDisplayed")] - void ReportFullyDisplayed (); - - // +(void)pauseAppHangTracking; - [Static] - [Export ("pauseAppHangTracking")] - void PauseAppHangTracking (); - - // +(void)resumeAppHangTracking; - [Static] - [Export ("resumeAppHangTracking")] - void ResumeAppHangTracking (); - - // +(void)flush:(NSTimeInterval)timeout __attribute__((swift_name("flush(timeout:)"))); - [Static] - [Export ("flush:")] - void Flush (double timeout); - - // +(void)close; - [Static] - [Export ("close")] - void Close (); - - // +(void)startProfiler; - [Static] - [Export ("startProfiler")] - void StartProfiler (); - - // +(void)stopProfiler; - [Static] - [Export ("stopProfiler")] - void StopProfiler (); -} - // @interface SentrySamplingContext : NSObject [BaseType (typeof(NSObject))] [Internal] @@ -2523,10 +2335,10 @@ interface PrivateSentrySDKOnly [Export ("captureViewHierarchy")] NSData CaptureViewHierarchy(); - // +(void)setCurrentScreen:(NSString * _Nonnull)screenName; + // +(void)setCurrentScreen:(NSString * _Nullable)screenName; [Static] [Export ("setCurrentScreen:")] - void SetCurrentScreen (string screenName); + void SetCurrentScreen ([NullAllowed] string screenName); // +(UIView * _Nonnull)sessionReplayMaskingOverlay:(id _Nonnull)options; [Static] diff --git a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj index 0409fadeba..07bf94f189 100644 --- a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj +++ b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj @@ -75,7 +75,7 @@ - + * _Nonnull attributes; + [Export ("attributes", ArgumentSemantic.Copy)] + NSDictionary Attributes { get; set; } + + // @property (nonatomic, strong) NSNumber * _Nullable severityNumber; + [NullAllowed, Export ("severityNumber", ArgumentSemantic.Strong)] + NSNumber SeverityNumber { get; set; } +} + +// @interface SentryLogger : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry12SentryLogger")] +[DisableDefaultCtor] +[Internal] +interface SentryLogger +{ + // -(void)trace:(NSString * _Nonnull)body; + [Export ("trace:")] + void Trace (string body); + + // -(void)trace:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("trace:attributes:")] + void Trace (string body, NSDictionary attributes); + + // -(void)debug:(NSString * _Nonnull)body; + [Export ("debug:")] + void Debug (string body); + + // -(void)debug:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("debug:attributes:")] + void Debug (string body, NSDictionary attributes); + + // -(void)info:(NSString * _Nonnull)body; + [Export ("info:")] + void Info (string body); + + // -(void)info:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("info:attributes:")] + void Info (string body, NSDictionary attributes); + + // -(void)warn:(NSString * _Nonnull)body; + [Export ("warn:")] + void Warn (string body); + + // -(void)warn:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("warn:attributes:")] + void Warn (string body, NSDictionary attributes); + + // -(void)error:(NSString * _Nonnull)body; + [Export ("error:")] + void Error (string body); + + // -(void)error:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("error:attributes:")] + void Error (string body, NSDictionary attributes); + + // -(void)fatal:(NSString * _Nonnull)body; + [Export ("fatal:")] + void Fatal (string body); + + // -(void)fatal:(NSString * _Nonnull)body attributes:(NSDictionary * _Nonnull)attributes; + [Export ("fatal:attributes:")] + void Fatal (string body, NSDictionary attributes); +} + // @interface SentryProfileOptions : NSObject [BaseType(typeof(NSObject), Name = "_TtC6Sentry20SentryProfileOptions")] [DisableDefaultCtor] @@ -248,6 +334,228 @@ interface SentryRRWebEvent : SentrySerializable new NSDictionary Serialize(); } +// @interface SentrySDK : NSObject +[BaseType(typeof(NSObject), Name = "_TtC6Sentry9SentrySDK")] +[DisableDefaultCtor] +[Internal] +interface SentrySDK +{ + // @property (readonly, nonatomic, strong, class) id _Nullable span; + [Static] + [NullAllowed, Export ("span", ArgumentSemantic.Strong)] + SentrySpan Span { get; } + + // @property (readonly, nonatomic, class) BOOL isEnabled; + [Static] + [Export ("isEnabled")] + bool IsEnabled { get; } + + // @property (readonly, nonatomic, strong, class) SentryReplayApi * _Nonnull replay; + [Static] + [Export ("replay", ArgumentSemantic.Strong)] + SentryReplayApi Replay { get; } + + // @property (readonly, nonatomic, strong, class) SentryLogger * _Nonnull logger; + [Static] + [Export ("logger", ArgumentSemantic.Strong)] + SentryLogger Logger { get; } + + // +(void)startWithOptions:(SentryOptions * _Nonnull)options; + [Static] + [Export ("startWithOptions:")] + void StartWithOptions (SentryOptions options); + + // +(void)startWithConfigureOptions:(void (^ _Nonnull)(SentryOptions * _Nonnull))configureOptions; + [Static] + [Export ("startWithConfigureOptions:")] + void StartWithConfigureOptions (Action configureOptions); + + // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event; + [Static] + [Export ("captureEvent:")] + SentryId CaptureEvent (SentryEvent @event); + + // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScope:(SentryScope * _Nonnull)scope; + [Static] + [Export ("captureEvent:withScope:")] + SentryId CaptureEvent (SentryEvent @event, SentryScope scope); + + // +(SentryId * _Nonnull)captureEvent:(SentryEvent * _Nonnull)event withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; + [Static] + [Export ("captureEvent:withScopeBlock:")] + SentryId CaptureEvent (SentryEvent @event, Action block); + + // +(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation; + [Static] + [Export ("startTransactionWithName:operation:")] + SentrySpan StartTransactionWithName (string name, string operation); + + // +(id _Nonnull)startTransactionWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation bindToScope:(BOOL)bindToScope; + [Static] + [Export ("startTransactionWithName:operation:bindToScope:")] + SentrySpan StartTransactionWithName (string name, string operation, bool bindToScope); + + // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext; + [Static] + [Export ("startTransactionWithContext:")] + SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext); + + // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope; + [Static] + [Export ("startTransactionWithContext:bindToScope:")] + SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope); + + // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext bindToScope:(BOOL)bindToScope customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext; + [Static] + [Export ("startTransactionWithContext:bindToScope:customSamplingContext:")] + SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, bool bindToScope, NSDictionary customSamplingContext); + + // +(id _Nonnull)startTransactionWithContext:(SentryTransactionContext * _Nonnull)transactionContext customSamplingContext:(NSDictionary * _Nonnull)customSamplingContext; + [Static] + [Export ("startTransactionWithContext:customSamplingContext:")] + SentrySpan StartTransactionWithContext (SentryTransactionContext transactionContext, NSDictionary customSamplingContext); + + // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error; + [Static] + [Export ("captureError:")] + SentryId CaptureError (NSError error); + + // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScope:(SentryScope * _Nonnull)scope; + [Static] + [Export ("captureError:withScope:")] + SentryId CaptureError (NSError error, SentryScope scope); + + // +(SentryId * _Nonnull)captureError:(NSError * _Nonnull)error withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; + [Static] + [Export ("captureError:withScopeBlock:")] + SentryId CaptureError (NSError error, Action block); + + // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception; + [Static] + [Export ("captureException:")] + SentryId CaptureException (NSException exception); + + // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScope:(SentryScope * _Nonnull)scope; + [Static] + [Export ("captureException:withScope:")] + SentryId CaptureException (NSException exception, SentryScope scope); + + // +(SentryId * _Nonnull)captureException:(NSException * _Nonnull)exception withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; + [Static] + [Export ("captureException:withScopeBlock:")] + SentryId CaptureException (NSException exception, Action block); + + // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message; + [Static] + [Export ("captureMessage:")] + SentryId CaptureMessage (string message); + + // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScope:(SentryScope * _Nonnull)scope; + [Static] + [Export ("captureMessage:withScope:")] + SentryId CaptureMessage (string message, SentryScope scope); + + // +(SentryId * _Nonnull)captureMessage:(NSString * _Nonnull)message withScopeBlock:(void (^ _Nonnull)(SentryScope * _Nonnull))block; + [Static] + [Export ("captureMessage:withScopeBlock:")] + SentryId CaptureMessage (string message, Action block); + + // +(void)captureUserFeedback:(SentryUserFeedback * _Nonnull)userFeedback __attribute__((deprecated("Use SentrySDK.back or use or configure our new managed UX with SentryOptions.configureUserFeedback."))); + [Static] + [Export ("captureUserFeedback:")] + void CaptureUserFeedback (SentryUserFeedback userFeedback); + + // +(void)captureFeedback:(SentryFeedback * _Nonnull)feedback; + [Static] + [Export ("captureFeedback:")] + void CaptureFeedback (SentryFeedback feedback); + + // @property (readonly, nonatomic, strong, class) SentryFeedbackAPI * _Nonnull feedback __attribute__((availability(ios, introduced=13.0))); + [Static] + [Export ("feedback", ArgumentSemantic.Strong)] + SentryFeedbackAPI Feedback { get; } + + // +(void)addBreadcrumb:(SentryBreadcrumb * _Nonnull)crumb; + [Static] + [Export ("addBreadcrumb:")] + void AddBreadcrumb (SentryBreadcrumb crumb); + + // +(void)configureScope:(void (^ _Nonnull)(SentryScope * _Nonnull))callback; + [Static] + [Export ("configureScope:")] + void ConfigureScope (Action callback); + + // @property (readonly, nonatomic, class) BOOL crashedLastRun; + [Static] + [Export ("crashedLastRun")] + bool CrashedLastRun { get; } + + // @property (readonly, nonatomic, class) BOOL detectedStartUpCrash; + [Static] + [Export ("detectedStartUpCrash")] + bool DetectedStartUpCrash { get; } + + // +(void)setUser:(SentryUser * _Nullable)user; + [Static] + [Export ("setUser:")] + void SetUser ([NullAllowed] SentryUser user); + + // +(void)startSession; + [Static] + [Export ("startSession")] + void StartSession (); + + // +(void)endSession; + [Static] + [Export ("endSession")] + void EndSession (); + + // +(void)crash; + [Static] + [Export ("crash")] + void Crash (); + + // +(void)reportFullyDisplayed; + [Static] + [Export ("reportFullyDisplayed")] + void ReportFullyDisplayed (); + + // +(void)pauseAppHangTracking; + [Static] + [Export ("pauseAppHangTracking")] + void PauseAppHangTracking (); + + // +(void)resumeAppHangTracking; + [Static] + [Export ("resumeAppHangTracking")] + void ResumeAppHangTracking (); + + // +(void)flush:(NSTimeInterval)timeout; + [Static] + [Export ("flush:")] + void Flush (double timeout); + + // +(void)close; + [Static] + [Export ("close")] + void Close (); + + // +(void)startProfiler; + [Static] + [Export ("startProfiler")] + void StartProfiler (); + + // +(void)stopProfiler; + [Static] + [Export ("stopProfiler")] + void StopProfiler (); + + // +(void)clearLogger; + [Static] + [Export ("clearLogger")] + void ClearLogger (); +} + // @interface SentryUserFeedback : NSObject [BaseType(typeof(NSObject))] [DisableDefaultCtor] diff --git a/src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs index 5cc5cc81c7..806daffd87 100644 --- a/src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs +++ b/src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs @@ -12,10 +12,8 @@ namespace Sentry.CocoaSdk; [Native] internal enum SentryFeedbackSource : long { - Unknown = 0, - User = 1, - System = 2, - Other = 3 + Widget = 0, + Custom = 1 } [Native] @@ -29,6 +27,17 @@ internal enum SentryLevel : ulong Fatal = 5 } +[Native] +internal enum SentryStructuredLogLevel : long +{ + Trace = 0, + Debug = 1, + Info = 2, + Warn = 3, + Error = 4, + Fatal = 5 +} + [Native] internal enum SentryProfileLifecycle : long {