From 5c23c5f69202e52c207ca78cd5182f9efbd02f53 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 14 Aug 2025 09:46:04 +1200 Subject: [PATCH 1/3] Revert "Revert "Bump to cocoa sdk v8.46.0 (#4103)" (#4202)" This reverts commit e3ad69a89d42a879c199eb87a4e50a21c95e91d9. --- CHANGELOG.md | 5 - Directory.Build.props | 2 +- Directory.Build.targets | 2 +- modules/sentry-cocoa.properties | 2 +- .../Sentry.Samples.Maui.csproj | 2 +- scripts/generate-cocoa-bindings.ps1 | 80 +--- src/Sentry.Bindings.Cocoa/ApiDefinitions.cs | 188 +++++--- .../Sentry.Bindings.Cocoa.csproj | 2 + src/Sentry.Bindings.Cocoa/StructsAndEnums.cs | 22 - .../SwiftApiDefinitions.cs | 405 ++++++++++++++++++ .../SwiftStructsAndEnums.cs | 65 +++ 11 files changed, 614 insertions(+), 161 deletions(-) create mode 100644 src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs create mode 100644 src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 2219c95c1c..d80becdc0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -158,11 +158,6 @@ - .NET MAUI integration with CommunityToolkit.Mvvm Async Relay Commands can now be auto spanned with the new package Sentry.Maui.CommunityToolkit.Mvvm ([#4125](https://github.com/getsentry/sentry-dotnet/pull/4125)) -### Fixes - -- Revert "Bump Cocoa SDK from v8.39.0 to v8.46.0 (#4103)" ([#4202](https://github.com/getsentry/sentry-dotnet/pull/4202)) - - IMPORTANT: Fixes multiple issues running versions 5.6.x and 5.7.x of the Sentry SDK for .NET on iOS (initialising the SDK and sending data to Sentry) - ### Dependencies - Bump Native SDK from v0.8.4 to v0.8.5 ([#4189](https://github.com/getsentry/sentry-dotnet/pull/4189)) diff --git a/Directory.Build.props b/Directory.Build.props index 0f0289c5e4..9000530601 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -48,7 +48,7 @@ --> $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) - 12.2 + 13.0 15.0 21.0 10.0.17763.0 diff --git a/Directory.Build.targets b/Directory.Build.targets index 7593967e09..b01536755f 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -10,7 +10,7 @@ --> $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) - 12.2 + 13.0 15.0 21.0 10.0.17763.0 diff --git a/modules/sentry-cocoa.properties b/modules/sentry-cocoa.properties index 799f17ac06..9d8498fef2 100644 --- a/modules/sentry-cocoa.properties +++ b/modules/sentry-cocoa.properties @@ -1,2 +1,2 @@ -version = 8.39.0 +version = 8.46.0 repo = https://github.com/getsentry/sentry-cocoa diff --git a/samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj b/samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj index 9f87848b21..77c4e079ee 100644 --- a/samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj +++ b/samples/Sentry.Samples.Maui/Sentry.Samples.Maui.csproj @@ -32,7 +32,7 @@ 1.0 1 - 12.2 + 13.0 15.0 21.0 10.0.17763.0 diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index dc56868e59..90b3d76a51 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -1,3 +1,5 @@ +# Reference: https://github.com/xamarin/xamarin-macios/blob/main/docs/website/binding_types_reference_guide.md + Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' @@ -173,41 +175,6 @@ $Text = $Text -replace '\bpublic\b', 'internal' # Remove static CFunctions class $Text = $Text -replace '(?ms)\nstatic class CFunctions.*?}\n', '' -# This enum resides in the Sentry-Swift.h -# Appending it here so we don't need to import and create bindings for the entire header -$SentryLevel = @' - -[Native] -internal enum SentryLevel : ulong -{ - None = 0, - Debug = 1, - Info = 2, - Warning = 3, - Error = 4, - Fatal = 5 -} -'@ - -# This enum resides in the Sentry-Swift.h -# Appending it here so we don't need to import and create bindings for the entire header -$SentryTransactionNameSource = @' - -[Native] -internal enum SentryTransactionNameSource : long -{ - Custom = 0, - Url = 1, - Route = 2, - View = 3, - Component = 4, - Task = 5 -} -'@ - -$Text += "`n$SentryLevel" -$Text += "`n$SentryTransactionNameSource" - # Add header and output file $Text = "$Header`n`n$Text" $Text | Out-File "$BindingsPath/$File" @@ -238,6 +205,9 @@ $Text = $Text -replace '\bISentrySerializable\b', 'SentrySerializable' # Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130 $Text = $Text -replace ': INSCopying,', ':' -replace '\s?[:,] INSCopying', '' +# Remove iOS attributes like [iOS (13, 0)] +$Text = $Text -replace '\[iOS \(13, 0\)\]\n?', '' + # Fix delegate argument names $Text = $Text -replace '(NSError) arg\d', '$1 error' $Text = $Text -replace '(NSHttpUrlResponse) arg\d', '$1 response' @@ -279,7 +249,7 @@ $Text = $Text -replace '\[Static\]\s*\[Internal\]\s*partial\s+interface\s+Consta # Update MethodToProperty translations $Text = $Text -replace '(Export \("get\w+"\)\]\n)\s*\[Verify \(MethodToProperty\)\]\n(.+ \{ get; \})', '$1$2' -$Text = $Text -replace '\[Verify \(MethodToProperty\)\]\n\s*(.+ (?:Hash|Value|DefaultIntegrations) \{ get; \})', '$1' +$Text = $Text -replace '\[Verify \(MethodToProperty\)\]\n\s*(.+ (?:Hash|Value|DefaultIntegrations|AppStartMeasurementWithSpans|BaggageHttpHeader) \{ get; \})', '$1' $Text = $Text -replace '\[Verify \(MethodToProperty\)\]\n\s*(.+) \{ get; \}', '$1();' # Allow weakly typed NSArray @@ -292,7 +262,7 @@ $Text = $Text -replace '(DEPRECATED_MSG_ATTRIBUTE\()\n\s*', '$1' # Remove default IsEqual implementation (already implemented by NSObject) $Text = $Text -replace '(?ms)\n?^ *// [^\n]*isEqual:.*?$.*?;\n', '' -# Replace obsolete platform avaialbility attributes +# Replace obsolete platform availability attributes $Text = $Text -replace '([\[,] )MacCatalyst \(', '$1Introduced (PlatformName.MacCatalyst, ' $Text = $Text -replace '([\[,] )Mac \(', '$1Introduced (PlatformName.MacOSX, ' $Text = $Text -replace '([\[,] )iOS \(', '$1Introduced (PlatformName.iOS, ' @@ -305,7 +275,6 @@ $Text = $Text -replace '(?m)(^\s*\/\/[^\r\n]*$\s*\[Export \("serialize"\)\]$\s*) $Text = $Text -replace '.*SentryEnvelope .*?[\s\S]*?\n\n', '' $Text = $Text -replace '.*typedef.*SentryOnAppStartMeasurementAvailable.*?[\s\S]*?\n\n', '' -$Text = $Text -replace '\n.*SentryReplayBreadcrumbConverter.*?[\s\S]*?\);\n', '' $propertiesToRemove = @( 'SentryAppStartMeasurement', @@ -321,41 +290,6 @@ foreach ($property in $propertiesToRemove) $Text = $Text -replace "\n.*property.*$property.*?[\s\S]*?\}\n", '' } -# This interface resides in the Sentry-Swift.h -# Appending it here so we don't need to import and create bindings for the entire header -$SentryId = @' - -// @interface SentryId : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry8SentryId")] -[Internal] -interface SentryId -{ - // @property (nonatomic, strong, class) SentryId * _Nonnull empty; - [Static] - [Export ("empty", ArgumentSemantic.Strong)] - SentryId Empty { get; set; } - - // @property (readonly, copy, nonatomic) NSString * _Nonnull sentryIdString; - [Export ("sentryIdString")] - string SentryIdString { get; } - - // -(instancetype _Nonnull)initWithUuid:(NSUUID * _Nonnull)uuid __attribute__((objc_designated_initializer)); - [Export ("initWithUuid:")] - [DesignatedInitializer] - NativeHandle Constructor (NSUuid uuid); - - // -(instancetype _Nonnull)initWithUUIDString:(NSString * _Nonnull)uuidString __attribute__((objc_designated_initializer)); - [Export ("initWithUUIDString:")] - [DesignatedInitializer] - NativeHandle Constructor (string uuidString); - - // @property (readonly, nonatomic) NSUInteger hash; - [Export ("hash")] - nuint Hash { get; } -} -'@ - -$Text += "`n$SentryId" # Add header and output file $Text = "$Header`n`n$Text" diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 77ad1d5797..cf38a5e4b4 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -27,6 +27,7 @@ namespace Sentry.CocoaSdk; // typedef SentryEvent * _Nullable (^SentryBeforeSendEventCallback)(SentryEvent * _Nonnull); [Internal] +[return: NullAllowed] delegate SentryEvent SentryBeforeSendEventCallback (SentryEvent @event); // typedef id _Nullable (^SentryBeforeSendSpanCallback)(id _Nonnull); @@ -54,13 +55,13 @@ namespace Sentry.CocoaSdk; [return: NullAllowed] delegate NSNumber SentryTracesSamplerCallback (SentrySamplingContext samplingContext); -// typedef void (^SentrySpanCallback)(id _Nullable); +// typedef void (^SentrySpanCallback)(DEPRECATED_MSG_ATTRIBUTE("See `SentryScope.useSpan` for reasoning of deprecation.") id); [Internal] -delegate void SentrySpanCallback ([NullAllowed] SentrySpan span); +delegate void SentrySpanCallback (SentrySpan span); -// typedef BOOL (^SentryBeforeEmitMetricCallback)(NSString * _Nonnull, NSDictionary * _Nonnull); +// typedef void (^SentryUserFeedbackConfigurationBlock)(SentryUserFeedbackConfiguration * _Nonnull); [Internal] -delegate bool SentryBeforeEmitMetricCallback (string arg0, NSDictionary arg1); +delegate void SentryUserFeedbackConfigurationBlock (SentryUserFeedbackConfiguration arg0); // @interface SentryAttachment : NSObject [BaseType (typeof(NSObject))] @@ -138,6 +139,10 @@ interface SentryBaggage [NullAllowed, Export ("userSegment")] string UserSegment { get; } + // @property (readonly, nonatomic) NSString * _Nullable sampleRand; + [NullAllowed, Export ("sampleRand")] + string SampleRand { get; } + // @property (readonly, nonatomic) NSString * _Nullable sampleRate; [NullAllowed, Export ("sampleRate")] string SampleRate { get; } @@ -154,6 +159,10 @@ interface SentryBaggage [Export ("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampled:replayId:")] NativeHandle Constructor (SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampled, [NullAllowed] string replayId); + // -(instancetype _Nonnull)initWithTraceId:(SentryId * _Nonnull)traceId publicKey:(NSString * _Nonnull)publicKey releaseName:(NSString * _Nullable)releaseName environment:(NSString * _Nullable)environment transaction:(NSString * _Nullable)transaction userSegment:(NSString * _Nullable)userSegment sampleRate:(NSString * _Nullable)sampleRate sampleRand:(NSString * _Nullable)sampleRand sampled:(NSString * _Nullable)sampled replayId:(NSString * _Nullable)replayId; + [Export ("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampleRand:sampled:replayId:")] + NativeHandle Constructor (SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampleRand, [NullAllowed] string sampled, [NullAllowed] string replayId); + // -(NSString * _Nonnull)toHTTPHeaderWithOriginalBaggage:(NSDictionary * _Nullable)originalBaggage; [Export ("toHTTPHeaderWithOriginalBaggage:")] string ToHTTPHeaderWithOriginalBaggage ([NullAllowed] NSDictionary originalBaggage); @@ -198,6 +207,10 @@ interface SentryBreadcrumb : SentrySerializable [NullAllowed, Export ("message")] string Message { get; set; } + // @property (copy, nonatomic) NSString * _Nullable origin; + [NullAllowed, Export ("origin")] + string Origin { get; set; } + // @property (nonatomic, strong) NSDictionary * _Nullable data; [NullAllowed, Export ("data", ArgumentSemantic.Strong)] NSDictionary Data { get; set; } @@ -269,10 +282,14 @@ interface SentryClient [Export ("captureMessage:withScope:")] SentryId CaptureMessage (string message, SentryScope scope); - // -(void)captureUserFeedback:(SentryUserFeedback * _Nonnull)userFeedback __attribute__((swift_name("capture(userFeedback:)"))); + // -(void)captureUserFeedback:(SentryUserFeedback * _Nonnull)userFeedback __attribute__((swift_name("capture(userFeedback:)"))) __attribute__((deprecated("Use -[SentryClient captureFeedback:withScope:]."))); [Export ("captureUserFeedback:")] void CaptureUserFeedback (SentryUserFeedback userFeedback); + // -(void)captureFeedback:(SentryFeedback * _Nonnull)feedback withScope:(SentryScope * _Nonnull)scope __attribute__((swift_name("capture(feedback:scope:)"))); + [Export ("captureFeedback:withScope:")] + void CaptureFeedback (SentryFeedback feedback, SentryScope scope); + // -(void)flush:(NSTimeInterval)timeout __attribute__((swift_name("flush(timeout:)"))); [Export ("flush:")] void Flush (double timeout); @@ -282,13 +299,6 @@ interface SentryClient void Close (); } -// @interface SentryCrashExceptionApplication : NSObject -[BaseType (typeof(NSObject))] -[Internal] -interface SentryCrashExceptionApplication -{ -} - // @interface SentryDebugImageProvider : NSObject [BaseType (typeof(NSObject))] [Internal] @@ -298,7 +308,7 @@ interface SentryDebugImageProvider [Export ("getDebugImagesForThreads:")] SentryDebugMeta[] GetDebugImagesForThreads (SentryThread[] threads); - // -(NSArray * _Nonnull)getDebugImagesForThreads:(NSArray * _Nonnull)threads isCrash:(BOOL)isCrash; + // -(NSArray * _Nonnull)getDebugImagesForThreads:(NSArray * _Nonnull)threads isCrash:(BOOL)isCrash __attribute__((deprecated("This method is slow and will be removed in a future version. Use -[getDebugImagesFromCacheForThreads:] instead."))); [Export ("getDebugImagesForThreads:isCrash:")] SentryDebugMeta[] GetDebugImagesForThreads (SentryThread[] threads, bool isCrash); @@ -306,7 +316,7 @@ interface SentryDebugImageProvider [Export ("getDebugImagesForFrames:")] SentryDebugMeta[] GetDebugImagesForFrames (SentryFrame[] frames); - // -(NSArray * _Nonnull)getDebugImagesForFrames:(NSArray * _Nonnull)frames isCrash:(BOOL)isCrash; + // -(NSArray * _Nonnull)getDebugImagesForFrames:(NSArray * _Nonnull)frames isCrash:(BOOL)isCrash __attribute__((deprecated("This method is slow and will be removed in a future version. Use -[getDebugImagesFromCacheForFrames:] instead."))); [Export ("getDebugImagesForFrames:isCrash:")] SentryDebugMeta[] GetDebugImagesForFrames (SentryFrame[] frames, bool isCrash); @@ -314,7 +324,7 @@ interface SentryDebugImageProvider [Export ("getDebugImages")] SentryDebugMeta[] DebugImages { get; } - // -(NSArray * _Nonnull)getDebugImagesCrashed:(BOOL)isCrash; + // -(NSArray * _Nonnull)getDebugImagesCrashed:(BOOL)isCrash __attribute__((deprecated("This method is slow and will be removed in a future version. Use -[getDebugImagesFromCache:] instead."))); [Export ("getDebugImagesCrashed:")] SentryDebugMeta[] GetDebugImagesCrashed (bool isCrash); } @@ -549,6 +559,13 @@ interface SentryEvent : SentrySerializable NativeHandle Constructor (NSError error); } +// @interface SentryEventDecodable : SentryEvent +[BaseType (typeof(SentryEvent))] +[Internal] +interface SentryEventDecodable +{ +} + // @interface SentryException : NSObject [BaseType (typeof(NSObject))] [DisableDefaultCtor] @@ -873,7 +890,7 @@ interface SentrySpan : SentrySerializable // @required -(NSString * _Nullable)baggageHttpHeader; [Abstract] [NullAllowed, Export ("baggageHttpHeader")] - string BaggageHttpHeader(); + string BaggageHttpHeader { get; } } // @interface SentryHub : NSObject @@ -954,10 +971,14 @@ interface SentryHub [Export ("captureMessage:withScope:")] SentryId CaptureMessage (string message, SentryScope scope); - // -(void)captureUserFeedback:(SentryUserFeedback * _Nonnull)userFeedback __attribute__((swift_name("capture(userFeedback:)"))); + // -(void)captureUserFeedback:(SentryUserFeedback * _Nonnull)userFeedback __attribute__((swift_name("capture(userFeedback:)"))) __attribute__((deprecated("Use -[SentryHub captureFeedback:]."))); [Export ("captureUserFeedback:")] void CaptureUserFeedback (SentryUserFeedback userFeedback); + // -(void)captureFeedback:(SentryFeedback * _Nonnull)feedback; + [Export ("captureFeedback:")] + void CaptureFeedback (SentryFeedback feedback); + // -(void)configureScope:(void (^ _Nonnull)(SentryScope * _Nonnull))callback; [Export ("configureScope:")] void ConfigureScope (Action callback); @@ -1397,6 +1418,10 @@ interface SentryOptions [Export ("enablePerformanceV2")] bool EnablePerformanceV2 { get; set; } + // @property (assign, nonatomic) BOOL enablePersistingTracesWhenCrashing; + [Export ("enablePersistingTracesWhenCrashing")] + bool EnablePersistingTracesWhenCrashing { get; set; } + // @property (nonatomic) SentryScope * _Nonnull (^ _Nonnull)(SentryScope * _Nonnull) initialScope; [Export ("initialScope", ArgumentSemantic.Assign)] Func InitialScope { get; set; } @@ -1429,6 +1454,10 @@ interface SentryOptions [Export ("enablePreWarmedAppStartTracing")] bool EnablePreWarmedAppStartTracing { get; set; } + // @property (nonatomic, strong) SentryReplayOptions * _Nonnull sessionReplay; + [Export ("sessionReplay", ArgumentSemantic.Strong)] + SentryReplayOptions SessionReplay { get; set; } + // @property (assign, nonatomic) BOOL enableNetworkTracking; [Export ("enableNetworkTracking")] bool EnableNetworkTracking { get; set; } @@ -1575,6 +1604,10 @@ interface SentryOptions // @property (copy, nonatomic) NSString * _Nonnull spotlightUrl; [Export ("spotlightUrl")] string SpotlightUrl { get; set; } + + // @property (copy, nonatomic) API_AVAILABLE(ios(13.0)) SentryUserFeedbackConfigurationBlock configureUserFeedback __attribute__((availability(ios, introduced=13.0))); + [Export ("configureUserFeedback", ArgumentSemantic.Copy)] + SentryUserFeedbackConfigurationBlock ConfigureUserFeedback { get; set; } } // @interface SentryReplayApi : NSObject @@ -1605,6 +1638,18 @@ interface SentryReplayApi // -(void)stop; [Export ("stop")] void Stop (); + + // -(void)showMaskPreview; + [Export ("showMaskPreview")] + void ShowMaskPreview (); + + // -(void)showMaskPreview:(CGFloat)opacity; + [Export ("showMaskPreview:")] + void ShowMaskPreview (nfloat opacity); + + // -(void)hideMaskPreview; + [Export ("hideMaskPreview")] + void HideMaskPreview (); } // @interface SentryRequest : NSObject @@ -1762,15 +1807,15 @@ interface SentrySDK [Export ("captureMessage:withScopeBlock:")] SentryId CaptureMessage (string message, Action block); - // +(void)captureUserFeedback:(SentryUserFeedback * _Nonnull)userFeedback __attribute__((swift_name("capture(userFeedback:)"))); + // +(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)showUserFeedbackForm; + // +(void)captureFeedback:(SentryFeedback * _Nonnull)feedback __attribute__((swift_name("capture(feedback:)"))); [Static] - [Export ("showUserFeedbackForm")] - void ShowUserFeedbackForm (); + [Export ("captureFeedback:")] + void CaptureFeedback (SentryFeedback feedback); // +(void)addBreadcrumb:(SentryBreadcrumb * _Nonnull)crumb __attribute__((swift_name("addBreadcrumb(_:)"))); [Static] @@ -1980,7 +2025,7 @@ partial interface SentryScope : SentrySerializable [Export ("clear")] void Clear (); - // -(void)useSpan:(SentrySpanCallback _Nonnull)callback; + // -(void)useSpan:(SentrySpanCallback _Nonnull)callback __attribute__((deprecated("This method was used to create an atomic block that could be used to mutate the current span. It is not atomic anymore and due to issues with memory safety in `NSBlock` it is now considered unsafe and deprecated. Use `span` instead."))); [Export ("useSpan:")] void UseSpan (SentrySpanCallback callback); } @@ -2103,6 +2148,10 @@ interface SentryTraceContext : SentrySerializable [NullAllowed, Export ("sampleRate")] string SampleRate { get; } + // @property (readonly, nonatomic) NSString * _Nullable sampleRand; + [NullAllowed, Export ("sampleRand")] + string SampleRand { get; } + // @property (readonly, nonatomic) NSString * _Nullable sampled; [NullAllowed, Export ("sampled")] string Sampled { get; } @@ -2115,6 +2164,10 @@ interface SentryTraceContext : SentrySerializable [Export ("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampled:replayId:")] NativeHandle Constructor (SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampled, [NullAllowed] string replayId); + // -(instancetype _Nonnull)initWithTraceId:(SentryId * _Nonnull)traceId publicKey:(NSString * _Nonnull)publicKey releaseName:(NSString * _Nullable)releaseName environment:(NSString * _Nullable)environment transaction:(NSString * _Nullable)transaction userSegment:(NSString * _Nullable)userSegment sampleRate:(NSString * _Nullable)sampleRate sampleRand:(NSString * _Nullable)sampleRand sampled:(NSString * _Nullable)sampled replayId:(NSString * _Nullable)replayId; + [Export ("initWithTraceId:publicKey:releaseName:environment:transaction:userSegment:sampleRate:sampleRand:sampled:replayId:")] + NativeHandle Constructor (SentryId traceId, string publicKey, [NullAllowed] string releaseName, [NullAllowed] string environment, [NullAllowed] string transaction, [NullAllowed] string userSegment, [NullAllowed] string sampleRate, [NullAllowed] string sampleRand, [NullAllowed] string sampled, [NullAllowed] string replayId); + // -(instancetype _Nullable)initWithScope:(SentryScope * _Nonnull)scope options:(SentryOptions * _Nonnull)options; [Export ("initWithScope:options:")] NativeHandle Constructor (SentryScope scope, SentryOptions options); @@ -2177,13 +2230,25 @@ interface SentryTransactionContext [Export ("nameSource")] SentryTransactionNameSource NameSource { get; } + // @property (nonatomic, strong) NSNumber * _Nullable sampleRate; + [NullAllowed, Export ("sampleRate", ArgumentSemantic.Strong)] + NSNumber SampleRate { get; set; } + + // @property (nonatomic, strong) NSNumber * _Nullable sampleRand; + [NullAllowed, Export ("sampleRand", ArgumentSemantic.Strong)] + NSNumber SampleRand { get; set; } + // @property (nonatomic) SentrySampleDecision parentSampled; [Export ("parentSampled", ArgumentSemantic.Assign)] SentrySampleDecision ParentSampled { get; set; } - // @property (nonatomic, strong) NSNumber * _Nullable sampleRate; - [NullAllowed, Export ("sampleRate", ArgumentSemantic.Strong)] - NSNumber SampleRate { get; set; } + // @property (nonatomic, strong) NSNumber * _Nullable parentSampleRate; + [NullAllowed, Export ("parentSampleRate", ArgumentSemantic.Strong)] + NSNumber ParentSampleRate { get; set; } + + // @property (nonatomic, strong) NSNumber * _Nullable parentSampleRand; + [NullAllowed, Export ("parentSampleRand", ArgumentSemantic.Strong)] + NSNumber ParentSampleRand { get; set; } // @property (assign, nonatomic) BOOL forNextAppLaunch; [Export ("forNextAppLaunch")] @@ -2193,13 +2258,21 @@ interface SentryTransactionContext [Export ("initWithName:operation:")] NativeHandle Constructor (string name, string operation); - // -(instancetype _Nonnull)initWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation sampled:(SentrySampleDecision)sampled; + // -(instancetype _Nonnull)initWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation sampled:(SentrySampleDecision)sampled __attribute__((deprecated("Use initWithName:operation:sampled:sampleRate:sampleRand instead"))); [Export ("initWithName:operation:sampled:")] NativeHandle Constructor (string name, string operation, SentrySampleDecision sampled); - // -(instancetype _Nonnull)initWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation traceId:(SentryId * _Nonnull)traceId spanId:(SentrySpanId * _Nonnull)spanId parentSpanId:(SentrySpanId * _Nullable)parentSpanId parentSampled:(SentrySampleDecision)parentSampled; + // -(instancetype _Nonnull)initWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation sampled:(SentrySampleDecision)sampled sampleRate:(NSNumber * _Nullable)sampleRate sampleRand:(NSNumber * _Nullable)sampleRand; + [Export ("initWithName:operation:sampled:sampleRate:sampleRand:")] + NativeHandle Constructor (string name, string operation, SentrySampleDecision sampled, [NullAllowed] NSNumber sampleRate, [NullAllowed] NSNumber sampleRand); + + // -(instancetype _Nonnull)initWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation traceId:(SentryId * _Nonnull)traceId spanId:(SentrySpanId * _Nonnull)spanId parentSpanId:(SentrySpanId * _Nullable)parentSpanId parentSampled:(SentrySampleDecision)parentSampled __attribute__((deprecated("Use initWithName:operation:traceId:spanId:parentSpanId:parentSampled:parentSampleRate:parentSampleRand instead"))); [Export ("initWithName:operation:traceId:spanId:parentSpanId:parentSampled:")] NativeHandle Constructor (string name, string operation, SentryId traceId, SentrySpanId spanId, [NullAllowed] SentrySpanId parentSpanId, SentrySampleDecision parentSampled); + + // -(instancetype _Nonnull)initWithName:(NSString * _Nonnull)name operation:(NSString * _Nonnull)operation traceId:(SentryId * _Nonnull)traceId spanId:(SentrySpanId * _Nonnull)spanId parentSpanId:(SentrySpanId * _Nullable)parentSpanId parentSampled:(SentrySampleDecision)parentSampled parentSampleRate:(NSNumber * _Nullable)parentSampleRate parentSampleRand:(NSNumber * _Nullable)parentSampleRand; + [Export ("initWithName:operation:traceId:spanId:parentSpanId:parentSampled:parentSampleRate:parentSampleRand:")] + NativeHandle Constructor (string name, string operation, SentryId traceId, SentrySpanId spanId, [NullAllowed] SentrySpanId parentSpanId, SentrySampleDecision parentSampled, [NullAllowed] NSNumber parentSampleRate, [NullAllowed] NSNumber parentSampleRand); } // @interface SentryUser : NSObject @@ -2353,6 +2426,11 @@ interface PrivateSentrySDKOnly [Export ("getSdkVersionString")] string SdkVersionString { get; } + // +(void)addSdkPackage:(NSString * _Nonnull)name version:(NSString * _Nonnull)version; + [Static] + [Export ("addSdkPackage:version:")] + void AddSdkPackage (string name, string version); + // +(NSDictionary * _Nonnull)getExtraContext; [Static] [Export ("getExtraContext")] @@ -2419,6 +2497,16 @@ interface PrivateSentrySDKOnly [Export ("setCurrentScreen:")] void SetCurrentScreen (string screenName); + // +(UIView * _Nonnull)sessionReplayMaskingOverlay:(id _Nonnull)options; + [Static] + [Export ("sessionReplayMaskingOverlay:")] + UIView SessionReplayMaskingOverlay (SentryRedactOptions options); + + // +(void)configureSessionReplayWith:(id _Nullable)breadcrumbConverter screenshotProvider:(id _Nullable)screenshotProvider; + [Static] + [Export ("configureSessionReplayWith:screenshotProvider:")] + void ConfigureSessionReplayWith ([NullAllowed] SentryReplayBreadcrumbConverter breadcrumbConverter, [NullAllowed] SentryViewScreenshotProvider screenshotProvider); + // +(void)captureReplay; [Static] [Export ("captureReplay")] @@ -2439,10 +2527,25 @@ interface PrivateSentrySDKOnly [Export ("addReplayRedactClasses:")] void AddReplayRedactClasses (Class[] classes); + // +(void)setIgnoreContainerClass:(Class _Nonnull)containerClass; + [Static] + [Export ("setIgnoreContainerClass:")] + void SetIgnoreContainerClass (Class containerClass); + + // +(void)setRedactContainerClass:(Class _Nonnull)containerClass; + [Static] + [Export ("setRedactContainerClass:")] + void SetRedactContainerClass (Class containerClass); + + // +(void)setReplayTags:(NSDictionary * _Nonnull)tags; + [Static] + [Export ("setReplayTags:")] + void SetReplayTags (NSDictionary tags); + // +(NSDictionary * _Nullable)appStartMeasurementWithSpans; [Static] [NullAllowed, Export ("appStartMeasurementWithSpans")] - NSDictionary AppStartMeasurementWithSpans(); + NSDictionary AppStartMeasurementWithSpans { get; } // +(SentryUser * _Nonnull)userWithDictionary:(NSDictionary * _Nonnull)dictionary; [Static] @@ -2454,32 +2557,3 @@ interface PrivateSentrySDKOnly [Export ("breadcrumbWithDictionary:")] SentryBreadcrumb BreadcrumbWithDictionary (NSDictionary dictionary); } - -// @interface SentryId : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry8SentryId")] -[Internal] -interface SentryId -{ - // @property (nonatomic, strong, class) SentryId * _Nonnull empty; - [Static] - [Export ("empty", ArgumentSemantic.Strong)] - SentryId Empty { get; set; } - - // @property (readonly, copy, nonatomic) NSString * _Nonnull sentryIdString; - [Export ("sentryIdString")] - string SentryIdString { get; } - - // -(instancetype _Nonnull)initWithUuid:(NSUUID * _Nonnull)uuid __attribute__((objc_designated_initializer)); - [Export ("initWithUuid:")] - [DesignatedInitializer] - NativeHandle Constructor (NSUuid uuid); - - // -(instancetype _Nonnull)initWithUUIDString:(NSString * _Nonnull)uuidString __attribute__((objc_designated_initializer)); - [Export ("initWithUUIDString:")] - [DesignatedInitializer] - NativeHandle Constructor (string uuidString); - - // @property (readonly, nonatomic) NSUInteger hash; - [Export ("hash")] - nuint Hash { get; } -} diff --git a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj index 5d175c990b..0409fadeba 100644 --- a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj +++ b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj @@ -33,7 +33,9 @@ + + diff --git a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs index 7fb471de9c..9735003cd1 100644 --- a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs +++ b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs @@ -66,25 +66,3 @@ internal enum SentrySpanStatus : ulong OutOfRange, DataLoss } - -[Native] -internal enum SentryLevel : ulong -{ - None = 0, - Debug = 1, - Info = 2, - Warning = 3, - Error = 4, - Fatal = 5 -} - -[Native] -internal enum SentryTransactionNameSource : long -{ - Custom = 0, - Url = 1, - Route = 2, - View = 3, - Component = 4, - Task = 5 -} diff --git a/src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs new file mode 100644 index 0000000000..61fa7556a0 --- /dev/null +++ b/src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs @@ -0,0 +1,405 @@ +/* + * This file defines iOS API contracts for the members we need from Sentry-Swift.h + * Note that we are **not** using Objective Sharpie to generate contracts (instead they're maintained manually). + */ +using System; +using Foundation; +using ObjCRuntime; +using UIKit; + +namespace Sentry.CocoaSdk; + +[BaseType(typeof(NSObject), Name = "_TtC6Sentry14SentryFeedback")] +[DisableDefaultCtor] // Marks the default constructor as unavailable +[Internal] +interface SentryFeedback +{ + [Export("name", ArgumentSemantic.Copy)] + string Name { get; set; } + + [Export("email", ArgumentSemantic.Copy)] + string Email { get; set; } + + [Export("message", ArgumentSemantic.Copy)] + string Message { get; set; } + + [Export("source")] + SentryFeedbackSource Source { get; set; } + + [Export("eventId", ArgumentSemantic.Strong)] + SentryId EventId { get; } + + [Export("associatedEventId", ArgumentSemantic.Strong)] + SentryId AssociatedEventId { get; set; } + + [Export("initWithMessage:name:email:source:associatedEventId:attachments:")] + [DesignatedInitializer] + IntPtr Constructor(string message, [NullAllowed] string name, [NullAllowed] string email, SentryFeedbackSource source, [NullAllowed] SentryId associatedEventId, [NullAllowed] NSData[] attachments); +} + +// @interface SentryId : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry8SentryId")] +[Internal] +interface SentryId +{ + // @property (nonatomic, strong, class) SentryId * _Nonnull empty; + [Static] + [Export ("empty", ArgumentSemantic.Strong)] + SentryId Empty { get; set; } + + // @property (readonly, copy, nonatomic) NSString * _Nonnull sentryIdString; + [Export ("sentryIdString")] + string SentryIdString { get; } + + // -(instancetype _Nonnull)initWithUuid:(NSUUID * _Nonnull)uuid __attribute__((objc_designated_initializer)); + [Export ("initWithUuid:")] + [DesignatedInitializer] + NativeHandle Constructor (NSUuid uuid); + + // -(instancetype _Nonnull)initWithUUIDString:(NSString * _Nonnull)uuidString __attribute__((objc_designated_initializer)); + [Export ("initWithUUIDString:")] + [DesignatedInitializer] + NativeHandle Constructor (string uuidString); + + // @property (readonly, nonatomic) NSUInteger hash; + [Export ("hash")] + nuint Hash { get; } +} + +// @interface SentrySessionReplayIntegration : SentryBaseIntegration +[BaseType (typeof(NSObject))] +[Internal] +interface SentrySessionReplayIntegration +{ + // -(instancetype _Nonnull)initForManualUse:(SentryOptions * _Nonnull)options; + [Export ("initForManualUse:")] + NativeHandle Constructor (SentryOptions options); + // -(BOOL)captureReplay; + [Export ("captureReplay")] + bool CaptureReplay(); + // -(void)configureReplayWith:(id _Nullable)breadcrumbConverter screenshotProvider:(id _Nullable)screenshotProvider; + [Export ("configureReplayWith:screenshotProvider:")] + void ConfigureReplayWith ([NullAllowed] SentryReplayBreadcrumbConverter breadcrumbConverter, [NullAllowed] SentryViewScreenshotProvider screenshotProvider); + // -(void)pause; + [Export ("pause")] + void Pause (); + // -(void)resume; + [Export ("resume")] + void Resume (); + // -(void)stop; + [Export ("stop")] + void Stop (); + // -(void)start; + [Export ("start")] + void Start (); + // +(id _Nonnull)createBreadcrumbwithTimestamp:(NSDate * _Nonnull)timestamp category:(NSString * _Nonnull)category message:(NSString * _Nullable)message level:(enum SentryLevel)level data:(NSDictionary * _Nullable)data; + [Static] + [Export ("createBreadcrumbwithTimestamp:category:message:level:data:")] + SentryRRWebEvent CreateBreadcrumbwithTimestamp (NSDate timestamp, string category, [NullAllowed] string message, SentryLevel level, [NullAllowed] NSDictionary data); + // +(id _Nonnull)createNetworkBreadcrumbWithTimestamp:(NSDate * _Nonnull)timestamp endTimestamp:(NSDate * _Nonnull)endTimestamp operation:(NSString * _Nonnull)operation description:(NSString * _Nonnull)description data:(NSDictionary * _Nonnull)data; + [Static] + [Export ("createNetworkBreadcrumbWithTimestamp:endTimestamp:operation:description:data:")] + SentryRRWebEvent CreateNetworkBreadcrumbWithTimestamp (NSDate timestamp, NSDate endTimestamp, string operation, string description, NSDictionary data); + // +(id _Nonnull)createDefaultBreadcrumbConverter; + [Static] + [Export ("createDefaultBreadcrumbConverter")] + SentryReplayBreadcrumbConverter CreateDefaultBreadcrumbConverter(); +} + +[Protocol(Name = "_TtP6Sentry19SentryRedactOptions_")] +[Model] +[BaseType(typeof(NSObject))] +[Internal] +internal interface SentryRedactOptions +{ + [Abstract] + [Export("maskAllText")] + bool MaskAllText { get; } + + [Abstract] + [Export("maskAllImages")] + bool MaskAllImages { get; } + + [Abstract] + [Export("maskedViewClasses", ArgumentSemantic.Copy)] + Class[] MaskedViewClasses { get; } + + [Abstract] + [Export("unmaskedViewClasses", ArgumentSemantic.Copy)] + Class[] UnmaskedViewClasses { get; } +} + +// @protocol SentryReplayBreadcrumbConverter +[Protocol (Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] +[BaseType (typeof(NSObject), Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] +[Model] +[Internal] +interface SentryReplayBreadcrumbConverter +{ + // @required -(id _Nullable)convertFrom:(SentryBreadcrumb * _Nonnull)breadcrumb __attribute__((warn_unused_result(""))); + [Abstract] + [Export ("convertFrom:")] + [return: NullAllowed] + SentryRRWebEvent ConvertFrom (SentryBreadcrumb breadcrumb); +} + +// @interface SentryReplayOptions : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry19SentryReplayOptions")] +[Internal] +interface SentryReplayOptions //: ISentryRedactOptions +{ + // @property (nonatomic) float sessionSampleRate; + [Export ("sessionSampleRate")] + float SessionSampleRate { get; set; } + // @property (nonatomic) float onErrorSampleRate; + [Export ("onErrorSampleRate")] + float OnErrorSampleRate { get; set; } + // @property (nonatomic) BOOL maskAllText; + [Export ("maskAllText")] + bool MaskAllText { get; set; } + // @property (nonatomic) BOOL maskAllImages; + [Export ("maskAllImages")] + bool MaskAllImages { get; set; } + // @property (nonatomic) enum SentryReplayQuality quality; + [Export ("quality", ArgumentSemantic.Assign)] + SentryReplayQuality Quality { get; set; } + /* + // @property (copy, nonatomic) NSArray * _Nonnull maskedViewClasses; + //[Export ("maskedViewClasses", ArgumentSemantic.Copy)] + //Class[] MaskedViewClasses { get; set; } + // @property (copy, nonatomic) NSArray * _Nonnull unmaskedViewClasses; + //[Export ("unmaskedViewClasses", ArgumentSemantic.Copy)] + //Class[] UnmaskedViewClasses { get; set; } + // @property (readonly, nonatomic) NSInteger replayBitRate; + [Export ("replayBitRate")] + nint ReplayBitRate { get; } + // @property (readonly, nonatomic) float sizeScale; + [Export ("sizeScale")] + float SizeScale { get; } + // @property (nonatomic) NSUInteger frameRate; + [Export ("frameRate")] + nuint FrameRate { get; set; } + // @property (readonly, nonatomic) NSTimeInterval errorReplayDuration; + [Export ("errorReplayDuration")] + double ErrorReplayDuration { get; } + // @property (readonly, nonatomic) NSTimeInterval sessionSegmentDuration; + [Export ("sessionSegmentDuration")] + double SessionSegmentDuration { get; } + // @property (readonly, nonatomic) NSTimeInterval maximumDuration; + [Export ("maximumDuration")] + double MaximumDuration { get; } + // -(instancetype _Nonnull)initWithSessionSampleRate:(float)sessionSampleRate onErrorSampleRate:(float)onErrorSampleRate maskAllText:(BOOL)maskAllText maskAllImages:(BOOL)maskAllImages __attribute__((objc_designated_initializer)); + [Export ("initWithSessionSampleRate:onErrorSampleRate:maskAllText:maskAllImages:")] + [DesignatedInitializer] + NativeHandle Constructor (float sessionSampleRate, float onErrorSampleRate, bool maskAllText, bool maskAllImages); + // -(instancetype _Nonnull)initWithDictionary:(NSDictionary * _Nonnull)dictionary; + [Export ("initWithDictionary:")] + NativeHandle Constructor (NSDictionary dictionary); + */ +} + +// @interface SentryRRWebEvent : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry16SentryRRWebEvent")] +[Protocol] +[Model] +[DisableDefaultCtor] +[Internal] +interface SentryRRWebEvent : SentrySerializable +{ + // @property (readonly, nonatomic) enum SentryRRWebEventType type; + [Export ("type")] + SentryRRWebEventType Type { get; } + // @property (readonly, copy, nonatomic) NSDate * _Nonnull timestamp; + [Export ("timestamp", ArgumentSemantic.Copy)] + NSDate Timestamp { get; } + // @property (readonly, copy, nonatomic) NSDictionary * _Nullable data; + [NullAllowed, Export ("data", ArgumentSemantic.Copy)] + NSDictionary Data { get; } + // -(instancetype _Nonnull)initWithType:(enum SentryRRWebEventType)type timestamp:(NSDate * _Nonnull)timestamp data:(NSDictionary * _Nullable)data __attribute__((objc_designated_initializer)); + [Export ("initWithType:timestamp:data:")] + [DesignatedInitializer] + NativeHandle Constructor (SentryRRWebEventType type, NSDate timestamp, [NullAllowed] NSDictionary data); + // -(NSDictionary * _Nonnull)serialize __attribute__((warn_unused_result(""))); + [Export ("serialize")] + new NSDictionary Serialize(); +} + +[BaseType(typeof(NSObject), Name = "_TtC6Sentry31SentryUserFeedbackConfiguration")] +[DisableDefaultCtor] +[Internal] +interface SentryUserFeedbackConfiguration +{ + [Export("animations")] + bool Animations { get; set; } + + [NullAllowed, Export("configureWidget", ArgumentSemantic.Copy)] + Action ConfigureWidget { get; set; } + + [Export("widgetConfig", ArgumentSemantic.Strong)] + SentryUserFeedbackWidgetConfiguration WidgetConfig { get; set; } + + [Export("useShakeGesture")] + bool UseShakeGesture { get; set; } + + [Export("showFormForScreenshots")] + bool ShowFormForScreenshots { get; set; } + + // [NullAllowed, Export("configureForm", ArgumentSemantic.Copy)] + // Action ConfigureForm { get; set; } + + // [Export("formConfig", ArgumentSemantic.Strong)] + // SentryUserFeedbackFormConfiguration FormConfig { get; set; } + + [NullAllowed, Export("tags", ArgumentSemantic.Copy)] + NSDictionary Tags { get; set; } + + [NullAllowed, Export("onFormOpen", ArgumentSemantic.Copy)] + Action OnFormOpen { get; set; } + + [NullAllowed, Export("onFormClose", ArgumentSemantic.Copy)] + Action OnFormClose { get; set; } + + [NullAllowed, Export("onSubmitSuccess", ArgumentSemantic.Copy)] + Action> OnSubmitSuccess { get; set; } + + [NullAllowed, Export("onSubmitError", ArgumentSemantic.Copy)] + Action OnSubmitError { get; set; } + + // [NullAllowed, Export("configureTheme", ArgumentSemantic.Copy)] + // Action ConfigureTheme { get; set; } + // + // [Export("theme", ArgumentSemantic.Strong)] + // SentryUserFeedbackThemeConfiguration Theme { get; set; } + // + // [NullAllowed, Export("configureDarkTheme", ArgumentSemantic.Copy)] + // Action ConfigureDarkTheme { get; set; } + // + // [Export("darkTheme", ArgumentSemantic.Strong)] + // SentryUserFeedbackThemeConfiguration DarkTheme { get; set; } + + [Export("textEffectiveHeightCenter")] + nfloat TextEffectiveHeightCenter { get; set; } + + [Export("scaleFactor")] + nfloat ScaleFactor { get; set; } + + [Export("calculateScaleFactor")] + nfloat CalculateScaleFactor(); + + [Export("paddingScaleFactor")] + nfloat PaddingScaleFactor { get; set; } + + [Export("calculatePaddingScaleFactor")] + nfloat CalculatePaddingScaleFactor(); + + [Export("recalculateScaleFactors")] + void RecalculateScaleFactors(); + + [Export("padding")] + nfloat Padding { get; } + + [Export("spacing")] + nfloat Spacing { get; } + + [Export("margin")] + nfloat Margin { get; } + + [Export("init")] + [DesignatedInitializer] + IntPtr Constructor(); +} + +// [BaseType(typeof(NSObject), Name = "_TtC6Sentry37SentryUserFeedbackThemeConfiguration")] +// [DisableDefaultCtor] +// [Internal] +// interface SentryUserFeedbackThemeConfiguration +// { +// [Export("backgroundColor", ArgumentSemantic.Strong)] +// UIColor BackgroundColor { get; set; } +// +// [Export("textColor", ArgumentSemantic.Strong)] +// UIColor TextColor { get; set; } +// +// [Export("buttonColor", ArgumentSemantic.Strong)] +// UIColor ButtonColor { get; set; } +// +// [Export("buttonTextColor", ArgumentSemantic.Strong)] +// UIColor ButtonTextColor { get; set; } +// +// [Export("init")] +// [DesignatedInitializer] +// IntPtr Constructor(); +// } + +[BaseType(typeof(NSObject), Name = "_TtC6Sentry37SentryUserFeedbackWidgetConfiguration")] +[DisableDefaultCtor] +[Internal] +interface SentryUserFeedbackWidgetConfiguration +{ + [Export("autoInject")] + bool AutoInject { get; set; } + + [Export("defaultLabelText", ArgumentSemantic.Copy)] + string DefaultLabelText { get; } + + [NullAllowed, Export("labelText", ArgumentSemantic.Copy)] + string LabelText { get; set; } + + [Export("showIcon")] + bool ShowIcon { get; set; } + + [NullAllowed, Export("widgetAccessibilityLabel", ArgumentSemantic.Copy)] + string WidgetAccessibilityLabel { get; set; } + + [Export("windowLevel")] + nfloat WindowLevel { get; set; } + + [Export("location")] + NSDirectionalRectEdge Location { get; set; } + + [Export("layoutUIOffset")] + UIOffset LayoutUIOffset { get; set; } + + [Export("init")] + [DesignatedInitializer] + IntPtr Constructor(); +} + + +// [BaseType(typeof(NSObject), Name = "_TtC6Sentry37SentryUserFeedbackFormConfiguration")] +// [DisableDefaultCtor] +// [Internal] +// interface SentryUserFeedbackFormConfiguration +// { +// [Export("title", ArgumentSemantic.Copy)] +// string Title { get; set; } +// +// [Export("subtitle", ArgumentSemantic.Copy)] +// string Subtitle { get; set; } +// +// [Export("submitButtonTitle", ArgumentSemantic.Copy)] +// string SubmitButtonTitle { get; set; } +// +// [Export("cancelButtonTitle", ArgumentSemantic.Copy)] +// string CancelButtonTitle { get; set; } +// +// [Export("thankYouMessage", ArgumentSemantic.Copy)] +// string ThankYouMessage { get; set; } +// +// [Export("init")] +// [DesignatedInitializer] +// IntPtr Constructor(); +// } + +// @protocol SentryViewScreenshotProvider +[Protocol (Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] +[Model] +[BaseType (typeof(NSObject), Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] +[Internal] +interface SentryViewScreenshotProvider +{ + // @required -(void)imageWithView:(UIView * _Nonnull)view onComplete:(void (^ _Nonnull)(UIImage * _Nonnull))onComplete; + [Abstract] + [Export ("imageWithView:onComplete:")] + void OnComplete (UIView view, Action onComplete); +} diff --git a/src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs new file mode 100644 index 0000000000..efd86efee2 --- /dev/null +++ b/src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs @@ -0,0 +1,65 @@ +/* + * This file defines iOS API contracts for enums we need from Sentry-Swift.h. + * Note that we are **not** using Objective Sharpie to generate these contracts (instead they're maintained manually). + */ +using System.Runtime.InteropServices; +using Foundation; +using ObjCRuntime; +using Sentry; + +namespace Sentry.CocoaSdk; + +[Native] +internal enum SentryFeedbackSource : long +{ + Unknown = 0, + User = 1, + System = 2, + Other = 3 +} + +[Native] +internal enum SentryLevel : ulong +{ + None = 0, + Debug = 1, + Info = 2, + Warning = 3, + Error = 4, + Fatal = 5 +} + +[Native] +internal enum SentryReplayQuality : long +{ + Low = 0, + Medium = 1, + High = 2 +} + +[Native] +internal enum SentryReplayType : long +{ + Session = 0, + Buffer = 1 +} + +[Native] +internal enum SentryRRWebEventType : long +{ + None = 0, + Touch = 3, + Meta = 4, + Custom = 5 +} + +[Native] +internal enum SentryTransactionNameSource : long +{ + Custom = 0, + Url = 1, + Route = 2, + View = 3, + Component = 4, + Task = 5 +} From 5a18f59489e8b5d96dfaebc621ff785b2ddb3bd3 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 14 Aug 2025 09:48:31 +1200 Subject: [PATCH 2/3] Reinstate changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d80becdc0f..207a6bd1ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -158,6 +158,11 @@ - .NET MAUI integration with CommunityToolkit.Mvvm Async Relay Commands can now be auto spanned with the new package Sentry.Maui.CommunityToolkit.Mvvm ([#4125](https://github.com/getsentry/sentry-dotnet/pull/4125)) +### Fixes + +- Revert "Bump Cocoa SDK from v8.39.0 to v8.46.0 (#4103)" ([#4202](https://github.com/getsentry/sentry-dotnet/pull/4202)) + - IMPORTANT: Fixes multiple issues running versions 5.6.x and 5.7.x of the Sentry SDK for .NET on iOS (initialising the SDK and sending data to Sentry) + ### Dependencies - Bump Native SDK from v0.8.4 to v0.8.5 ([#4189](https://github.com/getsentry/sentry-dotnet/pull/4189)) From 118bb0d1b18e40099cba7443c493a6ff152e8959 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Fri, 15 Aug 2025 10:22:21 +1200 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20edfbcbe2..3f7c02fb29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ - Remove `IDisposable` from `SentryStructuredLogger`. Disposal is intended through the owning `IHub` instance. ([#4424](https://github.com/getsentry/sentry-dotnet/pull/4424)) - Ensure all buffered logs are sent to Sentry when the application terminates unexpectedly. ([#4425](https://github.com/getsentry/sentry-dotnet/pull/4425)) +### 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) + ## 5.14.1 ### Fixes