diff --git a/.gitignore b/.gitignore index 23c230d87a..ce13a6a8b0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,7 +24,7 @@ docs/docfx.zip mono_crash.*.json test_output/ test/**/*.apk -/tools/ +/tools/sentry-cli/ *.log .sentry-native **/EnvironmentVariables.g.cs diff --git a/scripts/generate-cocoa-bindings.ps1 b/scripts/generate-cocoa-bindings.ps1 index f91b32f4c7..2faea90a52 100644 --- a/scripts/generate-cocoa-bindings.ps1 +++ b/scripts/generate-cocoa-bindings.ps1 @@ -103,7 +103,8 @@ if (!(Test-Path '/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/ } # Get iPhone SDK version -$iPhoneSdkVersion = sharpie xcode -sdks | grep -o -m 1 'iphoneos\S*' +$XcodePath = (xcode-select -p) -replace '/Contents/Developer$', '' +$iPhoneSdkVersion = sharpie xcode -xcode $XcodePath -sdks | grep -o -m 1 'iphoneos\S*' Write-Output "iPhoneSdkVersion: $iPhoneSdkVersion" ## Imports in the various header files are provided in the "new" style of: @@ -141,12 +142,30 @@ else { Write-Host "File not found: $privateHeaderFile" } +$swiftHeaderFile = "$HeadersPath/Sentry-Swift.h" +if (Test-Path $swiftHeaderFile) +{ + $content = Get-Content -Path $swiftHeaderFile -Raw + # Replace module @imports with traditional #includes + $content = $content -replace '(?m)^#if\s+(__has_feature\(objc_modules\))', '#if 1 // $1' + $content = $content -replace '(?m)^@import\s+ObjectiveC;\s*\n', '' + $content = $content -replace '(?m)^@import\s+(\w+);', '#include <$1/$1.h>' + $content = $content -replace '(?m)^#import\s+"Sentry.h"\s*\n', '' + + Set-Content -Path $swiftHeaderFile -Value $content + Write-Host "Patched includes: $swiftHeaderFile" +} +else +{ + Write-Host "File not found: $swiftHeaderFile" +} # Generate bindings Write-Output 'Generating bindings with Objective Sharpie.' sharpie bind -sdk $iPhoneSdkVersion ` -scope "$CocoaSdkPath" ` "$HeadersPath/Sentry.h" ` + "$HeadersPath/Sentry-Swift.h" ` "$PrivateHeadersPath/PrivateSentrySDKOnly.h" ` -o $BindingsPath ` -c -Wno-objc-property-no-attribute @@ -214,8 +233,9 @@ $Text = $Text -replace 'using .+;\n\n', "$&namespace Sentry.CocoaSdk;`n`n" # Set Internal attributes on interfaces and delegates $Text = $Text -replace '(?m)^(partial interface|interface|delegate)\b', "[Internal]`n$&" -# Fix ISentrySerializable usage +# Fix interface usage $Text = $Text -replace '\bISentrySerializable\b', 'SentrySerializable' +$Text = $Text -replace '\bISentryRedactOptions\b', 'SentryRedactOptions' # Remove INSCopying due to https://github.com/xamarin/xamarin-macios/issues/17130 $Text = $Text -replace ': INSCopying,', ':' -replace '\s?[:,] INSCopying', '' @@ -235,16 +255,21 @@ $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' +$Text = $Text -replace '(SentryProfileOptions) arg\d', '$1 options' # 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$&" +# Rename SentryRRWebEvent protocol +$Text = $Text -replace 'interface (SentryRRWebEvent) : SentrySerializable', 'interface I$1 : SentrySerializable' + # Adjust protocols (some are models) $Text = $Text -replace '(?ms)(@protocol.+?)/\*.+?\*/', '$1' $Text = $Text -replace '(?ms)@protocol (SentrySerializable|SentrySpan).+?\[Protocol\]', "`$&`n[Model]" +$Text = $Text -replace '(?ms)@protocol (SentryRedactOptions).+?\[Protocol \(Name = \"\w+\"\)\]', "`$&`n[Model]" -# Adjust SentrySpan base type -$Text = $Text -replace 'interface SentrySpan\b', "[BaseType (typeof(NSObject))]`n`$&" +# Adjust base types +$Text = $Text -replace 'interface (SentrySpan|SentryRedactOptions)\b', "[BaseType (typeof(NSObject))]`n`$&" # Fix string constants $Text = $Text -replace '(?m)(.*\n){2}^\s{4}NSString k.+?\n\n?', '' @@ -279,9 +304,6 @@ $Text = $Text -replace '\s*\[Verify \(StronglyTypedNSArray\)\]\n', '' $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', '' - # Replace obsolete platform availability attributes $Text = $Text -replace '([\[,] )MacCatalyst \(', '$1Introduced (PlatformName.MacCatalyst, ' $Text = $Text -replace '([\[,] )Mac \(', '$1Introduced (PlatformName.MacOSX, ' @@ -290,24 +312,15 @@ $Text = $Text -replace '([\[,] )iOS \(', '$1Introduced (PlatformName.iOS, ' # Make interface partial if we need to access private APIs. Other parts will be defined in PrivateApiDefinitions.cs $Text = $Text -replace '(?m)^interface SentryScope', 'partial $&' -$Text = $Text -replace '.*SentryEnvelope .*?[\s\S]*?\n\n', '' $Text = $Text -replace '.*typedef.*SentryOnAppStartMeasurementAvailable.*?[\s\S]*?\n\n', '' - -$propertiesToRemove = @( - 'SentryAppStartMeasurement', - 'SentryOnAppStartMeasurementAvailable', - 'SentryMetricsAPI', - 'SentryExperimentalOptions', - 'description', - 'enableMetricKitRawPayload' -) - -foreach ($property in $propertiesToRemove) -{ - $Text = $Text -replace "\n.*property.*$property.*?[\s\S]*?\}\n", '' -} - +$Text = $Text -replace 'NSDictionary', 'NSDictionary' # Add header and output file $Text = "$Header`n`n$Text" $Text | Out-File "$BindingsPath/$File" + +################################################################################ +# Post-process ApiDefinitions.cs +################################################################################ +Write-Output "Post-processing $BindingsPath/$File" +& dotnet run --project "$RootPath/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj" -- "$BindingsPath/$File" | ForEach-Object { Write-Host $_ } diff --git a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs index 2c076ddf1a..4ef7a50273 100644 --- a/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs +++ b/src/Sentry.Bindings.Cocoa/ApiDefinitions.cs @@ -5,7 +5,9 @@ // ----------------------------------------------------------------------------- using System; +using CoreFoundation; using Foundation; +using MetricKit; using ObjCRuntime; using Sentry; using UIKit; @@ -63,10 +65,6 @@ namespace Sentry.CocoaSdk; [Internal] delegate void SentrySpanCallback (SentrySpan span); -// typedef void (^SentryUserFeedbackConfigurationBlock)(SentryUserFeedbackConfiguration * _Nonnull); -[Internal] -delegate void SentryUserFeedbackConfigurationBlock (SentryUserFeedbackConfiguration arg0); - // @interface SentryAttachment : NSObject [BaseType (typeof(NSObject))] [DisableDefaultCtor] @@ -286,10 +284,6 @@ interface SentryClient [Export ("captureMessage:withScope:")] SentryId CaptureMessage (string message, SentryScope scope); - // -(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); @@ -397,54 +391,6 @@ interface SentryDsn NSUrl EnvelopeEndpoint { get; } } -// @interface SentryEnvelopeItemHeader : NSObject -[BaseType (typeof(NSObject))] -[DisableDefaultCtor] -[Internal] -interface SentryEnvelopeItemHeader : SentrySerializable -{ - // -(instancetype _Nonnull)initWithType:(NSString * _Nonnull)type length:(NSUInteger)length __attribute__((objc_designated_initializer)); - [Export ("initWithType:length:")] - [DesignatedInitializer] - NativeHandle Constructor (string type, nuint length); - - // -(instancetype _Nonnull)initWithType:(NSString * _Nonnull)type length:(NSUInteger)length contentType:(NSString * _Nonnull)contentType; - [Export ("initWithType:length:contentType:")] - NativeHandle Constructor (string type, nuint length, string contentType); - - // -(instancetype _Nonnull)initWithType:(NSString * _Nonnull)type length:(NSUInteger)length filenname:(NSString * _Nonnull)filename contentType:(NSString * _Nonnull)contentType; - [Export ("initWithType:length:filenname:contentType:")] - NativeHandle Constructor (string type, nuint length, string filename, string contentType); - - // -(instancetype _Nonnull)initWithType:(NSString * _Nonnull)type length:(NSUInteger)length contentType:(NSString * _Nullable)contentType itemCount:(NSNumber * _Nonnull)itemCount; - [Export ("initWithType:length:contentType:itemCount:")] - NativeHandle Constructor (string type, nuint length, [NullAllowed] string contentType, NSNumber itemCount); - - // @property (readonly, copy, nonatomic) NSString * _Nonnull type; - [Export ("type")] - string Type { get; } - - // @property (readonly, nonatomic) NSUInteger length; - [Export ("length")] - nuint Length { get; } - - // @property (readonly, copy, nonatomic) NSString * _Nullable filename; - [NullAllowed, Export ("filename")] - string Filename { get; } - - // @property (readonly, copy, nonatomic) NSString * _Nullable contentType; - [NullAllowed, Export ("contentType")] - string ContentType { get; } - - // @property (readonly, copy, nonatomic) NSNumber * _Nullable itemCount; - [NullAllowed, Export ("itemCount", ArgumentSemantic.Copy)] - NSNumber ItemCount { get; } - - // @property (copy, nonatomic) NSString * _Nullable platform; - [NullAllowed, Export ("platform")] - string Platform { get; set; } -} - partial interface Constants { // extern NSString *const _Nonnull SentryErrorDomain __attribute__((visibility("default"))); @@ -1015,10 +961,6 @@ interface SentryHub [Export ("captureMessage:withScope:")] SentryId CaptureMessage (string message, SentryScope scope); - // -(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); @@ -1681,15 +1623,11 @@ interface SentryOptions // @property (readonly, nonatomic) NSObject * _Nonnull _swiftExperimentalOptions; [Export ("_swiftExperimentalOptions")] NSObject _swiftExperimentalOptions { get; } - - // @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; } } // typedef void (^SentryProfilingConfigurationBlock)(SentryProfileOptions * _Nonnull); [Internal] -delegate void SentryProfilingConfigurationBlock (SentryProfileOptions arg0); +delegate void SentryProfilingConfigurationBlock (SentryProfileOptions options); // @interface SentryReplayApi : NSObject [BaseType (typeof(NSObject))] @@ -2199,6 +2137,652 @@ interface SentryUser : SentrySerializable nuint Hash { get; } } +// @interface SentryFeedback : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry14SentryFeedback")] +[DisableDefaultCtor] +[Internal] +interface SentryFeedback +{ + // @property (readonly, nonatomic, strong) SentryId * _Nonnull eventId; + [Export ("eventId", ArgumentSemantic.Strong)] + SentryId EventId { get; } + + // -(instancetype _Nonnull)initWithMessage:(NSString * _Nonnull)message name:(NSString * _Nullable)name email:(NSString * _Nullable)email source:(enum SentryFeedbackSource)source associatedEventId:(SentryId * _Nullable)associatedEventId attachments:(NSArray * _Nullable)attachments __attribute__((objc_designated_initializer)); + [Export ("initWithMessage:name:email:source:associatedEventId:attachments:")] + [DesignatedInitializer] + NativeHandle 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 (readonly, nonatomic, strong, class) SentryId * _Nonnull empty; + [Static] + [Export ("empty", ArgumentSemantic.Strong)] + SentryId Empty { get; } + + // @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 SentryLog : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry9SentryLog")] +[DisableDefaultCtor] +[Internal] +interface SentryLog +{ + // @property (copy, nonatomic) NSDate * _Nonnull timestamp; + [Export ("timestamp", ArgumentSemantic.Copy)] + NSDate Timestamp { get; set; } + + // @property (nonatomic, strong) SentryId * _Nonnull traceId; + [Export ("traceId", ArgumentSemantic.Strong)] + SentryId TraceId { get; set; } + + // @property (nonatomic) enum SentryStructuredLogLevel level; + [Export ("level", ArgumentSemantic.Assign)] + SentryStructuredLogLevel Level { get; set; } + + // @property (copy, nonatomic) NSString * _Nonnull body; + [Export ("body")] + string Body { get; set; } + + // @property (copy, nonatomic) NSDictionary * _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")] +[Internal] +interface SentryProfileOptions +{ + // @property (nonatomic) enum SentryProfileLifecycle lifecycle; + [Export ("lifecycle", ArgumentSemantic.Assign)] + SentryProfileLifecycle Lifecycle { get; set; } + + // @property (nonatomic) float sessionSampleRate; + [Export ("sessionSampleRate")] + float SessionSampleRate { get; set; } + + // @property (nonatomic) BOOL profileAppStarts; + [Export ("profileAppStarts")] + bool ProfileAppStarts { get; set; } +} + +// @protocol SentryRRWebEvent +[Protocol] +[Internal] +interface ISentryRRWebEvent : SentrySerializable +{ +} + +// @interface SentryRRWebEvent : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry16SentryRRWebEvent")] +[DisableDefaultCtor] +[Internal] +interface SentryRRWebEvent : ISentryRRWebEvent +{ + // @property (readonly, copy, nonatomic) NSDictionary * _Nullable data; + [NullAllowed, Export ("data", ArgumentSemantic.Copy)] + NSDictionary Data { get; } + + // -(NSDictionary * _Nonnull)serialize __attribute__((warn_unused_result(""))); + [Export ("serialize")] + NSDictionary Serialize(); +} + +// @protocol SentryRedactOptions +[Protocol (Name = "_TtP6Sentry19SentryRedactOptions_")] +[Model] +[Internal] +[BaseType (typeof(NSObject))] +interface SentryRedactOptions +{ + // @required @property (readonly, nonatomic) BOOL maskAllText; + [Abstract] + [Export ("maskAllText")] + bool MaskAllText { get; } + + // @required @property (readonly, nonatomic) BOOL maskAllImages; + [Abstract] + [Export ("maskAllImages")] + bool MaskAllImages { get; } + + // @required @property (readonly, copy, nonatomic) NSArray * _Nonnull maskedViewClasses; + [Abstract] + [Export ("maskedViewClasses", ArgumentSemantic.Copy)] + Class[] MaskedViewClasses { get; } + + // @required @property (readonly, copy, nonatomic) NSArray * _Nonnull unmaskedViewClasses; + [Abstract] + [Export ("unmaskedViewClasses", ArgumentSemantic.Copy)] + Class[] UnmaskedViewClasses { get; } +} + +// @protocol SentryReplayBreadcrumbConverter +[Protocol (Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] +[BaseType (typeof(NSObject), Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")] +[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 : SentryRedactOptions +{ + // @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 (nonatomic) BOOL enableExperimentalViewRenderer __attribute__((deprecated("", "enableViewRendererV2"))); + [Export ("enableExperimentalViewRenderer")] + bool EnableExperimentalViewRenderer { get; set; } + + // @property (nonatomic) BOOL enableViewRendererV2; + [Export ("enableViewRendererV2")] + bool EnableViewRendererV2 { get; set; } + + // @property (nonatomic) BOOL enableFastViewRendering; + [Export ("enableFastViewRendering")] + bool EnableFastViewRendering { 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 (nonatomic) NSTimeInterval errorReplayDuration; + [Export ("errorReplayDuration")] + double ErrorReplayDuration { get; set; } + + // @property (nonatomic) NSTimeInterval sessionSegmentDuration; + [Export ("sessionSegmentDuration")] + double SessionSegmentDuration { get; set; } + + // @property (nonatomic) NSTimeInterval maximumDuration; + [Export ("maximumDuration")] + double MaximumDuration { get; set; } + + // -(instancetype _Nonnull)initWithDictionary:(NSDictionary * _Nonnull)dictionary; + [Export ("initWithDictionary:")] + NativeHandle Constructor (NSDictionary dictionary); + + // -(instancetype _Nonnull)initWithSessionSampleRate:(float)sessionSampleRate onErrorSampleRate:(float)onErrorSampleRate maskAllText:(BOOL)maskAllText maskAllImages:(BOOL)maskAllImages enableViewRendererV2:(BOOL)enableViewRendererV2 enableFastViewRendering:(BOOL)enableFastViewRendering; + [Export ("initWithSessionSampleRate:onErrorSampleRate:maskAllText:maskAllImages:enableViewRendererV2:enableFastViewRendering:")] + NativeHandle Constructor (float sessionSampleRate, float onErrorSampleRate, bool maskAllText, bool maskAllImages, bool enableViewRendererV2, bool enableFastViewRendering); +} + +// @interface SentrySDK : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry9SentrySDK")] +[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)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 SentrySession : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry13SentrySession")] +[DisableDefaultCtor] +[Internal] +interface SentrySession +{ + // -(instancetype _Nonnull)initWithReleaseName:(NSString * _Nonnull)releaseName distinctId:(NSString * _Nonnull)distinctId __attribute__((objc_designated_initializer)); + [Export ("initWithReleaseName:distinctId:")] + [DesignatedInitializer] + NativeHandle Constructor (string releaseName, string distinctId); + + // -(instancetype _Nullable)initWithJSONObject:(NSDictionary * _Nonnull)jsonObject __attribute__((objc_designated_initializer)); + [Export ("initWithJSONObject:")] + [DesignatedInitializer] + NativeHandle Constructor (NSDictionary jsonObject); + + // -(void)endSessionExitedWithTimestamp:(NSDate * _Nonnull)timestamp; + [Export ("endSessionExitedWithTimestamp:")] + void EndSessionExitedWithTimestamp (NSDate timestamp); + + // -(void)endSessionCrashedWithTimestamp:(NSDate * _Nonnull)timestamp; + [Export ("endSessionCrashedWithTimestamp:")] + void EndSessionCrashedWithTimestamp (NSDate timestamp); + + // -(void)endSessionAbnormalWithTimestamp:(NSDate * _Nonnull)timestamp; + [Export ("endSessionAbnormalWithTimestamp:")] + void EndSessionAbnormalWithTimestamp (NSDate timestamp); + + // -(void)incrementErrors; + [Export ("incrementErrors")] + void IncrementErrors (); + + // @property (readonly, copy, nonatomic) NSUUID * _Nonnull sessionId; + [Export ("sessionId", ArgumentSemantic.Copy)] + NSUuid SessionId { get; } + + // @property (readonly, copy, nonatomic) NSDate * _Nonnull started; + [Export ("started", ArgumentSemantic.Copy)] + NSDate Started { get; } + + // @property (readonly, nonatomic) enum SentrySessionStatus status; + [Export ("status")] + SentrySessionStatus Status { get; } + + // @property (nonatomic) NSUInteger errors; + [Export ("errors")] + nuint Errors { get; set; } + + // @property (readonly, nonatomic) NSUInteger sequence; + [Export ("sequence")] + nuint Sequence { get; } + + // @property (readonly, copy, nonatomic) NSString * _Nonnull distinctId; + [Export ("distinctId")] + string DistinctId { get; } + + // @property (readonly, nonatomic, strong) NSNumber * _Nullable flagInit; + [NullAllowed, Export ("flagInit", ArgumentSemantic.Strong)] + NSNumber FlagInit { get; } + + // @property (readonly, copy, nonatomic) NSDate * _Nullable timestamp; + [NullAllowed, Export ("timestamp", ArgumentSemantic.Copy)] + NSDate Timestamp { get; } + + // @property (readonly, nonatomic, strong) NSNumber * _Nullable duration; + [NullAllowed, Export ("duration", ArgumentSemantic.Strong)] + NSNumber Duration { get; } + + // @property (readonly, copy, nonatomic) NSString * _Nullable releaseName; + [NullAllowed, Export ("releaseName")] + string ReleaseName { get; } + + // @property (copy, nonatomic) NSString * _Nullable environment; + [NullAllowed, Export ("environment")] + string Environment { get; set; } + + // @property (nonatomic, strong) SentryUser * _Nullable user; + [NullAllowed, Export ("user", ArgumentSemantic.Strong)] + SentryUser User { get; set; } + + // @property (copy, nonatomic) NSString * _Nullable abnormalMechanism; + [NullAllowed, Export ("abnormalMechanism")] + string AbnormalMechanism { get; set; } + + // -(NSDictionary * _Nonnull)serialize __attribute__((warn_unused_result(""))); + [Export ("serialize")] + NSDictionary Serialize(); + + // -(void)setFlagInit; + [Export ("setFlagInit")] + void SetFlagInit (); +} + +// @protocol SentryViewScreenshotProvider +[Protocol (Name = "_TtP6Sentry28SentryViewScreenshotProvider_")] +[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); +} + +// @interface SentryViewScreenshotOptions : NSObject +[BaseType (typeof(NSObject), Name = "_TtC6Sentry27SentryViewScreenshotOptions")] +[Internal] +interface SentryViewScreenshotOptions : SentryRedactOptions +{ + // @property (nonatomic) BOOL enableViewRendererV2; + [Export ("enableViewRendererV2")] + bool EnableViewRendererV2 { get; set; } + + // @property (nonatomic) BOOL enableFastViewRendering; + [Export ("enableFastViewRendering")] + bool EnableFastViewRendering { get; set; } + + // @property (nonatomic) BOOL maskAllImages; + [Export ("maskAllImages")] + bool MaskAllImages { get; set; } + + // @property (nonatomic) BOOL maskAllText; + [Export ("maskAllText")] + bool MaskAllText { 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; } + + // -(instancetype _Nonnull)initWithEnableViewRendererV2:(BOOL)enableViewRendererV2 enableFastViewRendering:(BOOL)enableFastViewRendering maskAllText:(BOOL)maskAllText maskAllImages:(BOOL)maskAllImages maskedViewClasses:(NSArray * _Nonnull)maskedViewClasses unmaskedViewClasses:(NSArray * _Nonnull)unmaskedViewClasses __attribute__((objc_designated_initializer)); + [Export ("initWithEnableViewRendererV2:enableFastViewRendering:maskAllText:maskAllImages:maskedViewClasses:unmaskedViewClasses:")] + [DesignatedInitializer] + NativeHandle Constructor (bool enableViewRendererV2, bool enableFastViewRendering, bool maskAllText, bool maskAllImages, Class[] maskedViewClasses, Class[] unmaskedViewClasses); +} + // @interface SentryScreenFrames : NSObject [BaseType (typeof(NSObject))] [DisableDefaultCtor] @@ -2243,6 +2827,7 @@ interface SentryScreenFrames [Internal] interface PrivateSentrySDKOnly { + // +(NSArray * _Nonnull)getDebugImages; [Static] [Export ("getDebugImages")] diff --git a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj index 0881063924..86fc625bd8 100644 --- a/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj +++ b/src/Sentry.Bindings.Cocoa/Sentry.Bindings.Cocoa.csproj @@ -42,9 +42,7 @@ - - diff --git a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs index 9735003cd1..f1813ab486 100644 --- a/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs +++ b/src/Sentry.Bindings.Cocoa/StructsAndEnums.cs @@ -66,3 +66,84 @@ internal enum SentrySpanStatus : ulong OutOfRange, DataLoss } + +[Native] +internal enum SentryANRType : long +{ + FatalFullyBlocking = 0, + FatalNonFullyBlocking = 1, + FullyBlocking = 2, + NonFullyBlocking = 3, + Unknown = 4 +} + +[Native] +internal enum SentryFeedbackSource : long +{ + Widget = 0, + Custom = 1 +} + +[Native] +internal enum SentryLevel : ulong +{ + None = 0, + Debug = 1, + Info = 2, + Warning = 3, + Error = 4, + Fatal = 5 +} + +[Native] +internal enum SentryStructuredLogLevel : long +{ + Trace = 0, + Debug = 1, + Info = 2, + Warn = 3, + Error = 4, + Fatal = 5 +} + +[Native] +internal enum SentryProfileLifecycle : long +{ + Manual = 0, + Trace = 1 +} + +[Native] +internal enum SentryReplayQuality : long +{ + Low = 0, + Medium = 1, + High = 2 +} + +[Native] +internal enum SentryReplayType : long +{ + Session = 0, + Buffer = 1 +} + +[Native] +internal enum SentrySessionStatus : ulong +{ + Ok = 0, + Exited = 1, + Crashed = 2, + Abnormal = 3 +} + +[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 deleted file mode 100644 index 1bf7b8ded4..0000000000 --- a/src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs +++ /dev/null @@ -1,893 +0,0 @@ -/* - * 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 SentryLog : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry9SentryLog")] -[DisableDefaultCtor] -[Internal] -interface SentryLog -{ - // @property (copy, nonatomic) NSDate * _Nonnull timestamp; - [Export ("timestamp", ArgumentSemantic.Copy)] - NSDate Timestamp { get; set; } - - // @property (nonatomic, strong) SentryId * _Nonnull traceId; - [Export ("traceId", ArgumentSemantic.Strong)] - SentryId TraceId { get; set; } - - // @property (nonatomic) enum SentryStructuredLogLevel level; - [Export ("level", ArgumentSemantic.Assign)] - SentryStructuredLogLevel Level { get; set; } - - // @property (copy, nonatomic) NSString * _Nonnull body; - [Export ("body")] - string Body { get; set; } - - // @property (copy, nonatomic) NSDictionary * _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] -[Internal] -interface SentryProfileOptions -{ - // @property(nonatomic) enum SentryProfileLifecycle lifecycle; - [Export("lifecycle", ArgumentSemantic.Assign)] - SentryProfileLifecycle Lifecycle { get; set; } - - // @property(nonatomic) float sessionSampleRate; - [Export("sessionSampleRate")] - float SessionSampleRate { get; set; } - - // @property(nonatomic) BOOL profileAppStarts; - [Export("profileAppStarts")] - bool ProfileAppStarts { get; set; } - - // - (nonnull instancetype) init OBJC_DESIGNATED_INITIALIZER; - [Export("init")] - [DesignatedInitializer] - NativeHandle Constructor(); -} - -// @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); -} - -// @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 SentrySession : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry13SentrySession")] -[DisableDefaultCtor] -[Internal] -interface SentrySession -{ - // -(instancetype _Nonnull)initWithReleaseName:(NSString * _Nonnull)releaseName distinctId:(NSString * _Nonnull)distinctId __attribute__((objc_designated_initializer)); - [Export ("initWithReleaseName:distinctId:")] - [DesignatedInitializer] - NativeHandle Constructor (string releaseName, string distinctId); - - // -(instancetype _Nullable)initWithJSONObject:(NSDictionary * _Nonnull)jsonObject __attribute__((objc_designated_initializer)); - [Export ("initWithJSONObject:")] - [DesignatedInitializer] - NativeHandle Constructor (NSDictionary jsonObject); - - // -(void)endSessionExitedWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export ("endSessionExitedWithTimestamp:")] - void EndSessionExitedWithTimestamp (NSDate timestamp); - - // -(void)endSessionCrashedWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export ("endSessionCrashedWithTimestamp:")] - void EndSessionCrashedWithTimestamp (NSDate timestamp); - - // -(void)endSessionAbnormalWithTimestamp:(NSDate * _Nonnull)timestamp; - [Export ("endSessionAbnormalWithTimestamp:")] - void EndSessionAbnormalWithTimestamp (NSDate timestamp); - - // -(void)incrementErrors; - [Export ("incrementErrors")] - void IncrementErrors (); - - // @property (readonly, copy, nonatomic) NSUUID * _Nonnull sessionId; - [Export ("sessionId", ArgumentSemantic.Copy)] - NSUuid SessionId { get; } - - // @property (readonly, copy, nonatomic) NSDate * _Nonnull started; - [Export ("started", ArgumentSemantic.Copy)] - NSDate Started { get; } - - // @property (readonly, nonatomic) enum SentrySessionStatus status; - [Export ("status")] - SentrySessionStatus Status { get; } - - // @property (nonatomic) NSUInteger errors; - [Export ("errors")] - nuint Errors { get; set; } - - // @property (readonly, nonatomic) NSUInteger sequence; - [Export ("sequence")] - nuint Sequence { get; } - - // @property (readonly, copy, nonatomic) NSString * _Nonnull distinctId; - [Export ("distinctId")] - string DistinctId { get; } - - // @property (readonly, nonatomic, strong) NSNumber * _Nullable flagInit; - [NullAllowed, Export ("flagInit", ArgumentSemantic.Strong)] - NSNumber FlagInit { get; } - - // @property (readonly, copy, nonatomic) NSDate * _Nullable timestamp; - [NullAllowed, Export ("timestamp", ArgumentSemantic.Copy)] - NSDate Timestamp { get; } - - // @property (readonly, nonatomic, strong) NSNumber * _Nullable duration; - [NullAllowed, Export ("duration", ArgumentSemantic.Strong)] - NSNumber Duration { get; } - - // @property (readonly, copy, nonatomic) NSString * _Nullable releaseName; - [NullAllowed, Export ("releaseName")] - string ReleaseName { get; } - - // @property (copy, nonatomic) NSString * _Nullable environment; - [NullAllowed, Export ("environment")] - string Environment { get; set; } - - // @property (nonatomic, strong) SentryUser * _Nullable user; - [NullAllowed, Export ("user", ArgumentSemantic.Strong)] - SentryUser User { get; set; } - - // @property (copy, nonatomic) NSString * _Nullable abnormalMechanism; - [NullAllowed, Export ("abnormalMechanism")] - string AbnormalMechanism { get; set; } - - // -(NSDictionary * _Nonnull)serialize __attribute__((warn_unused_result(""))); - [Export ("serialize")] - NSDictionary Serialize(); - - // -(void)setFlagInit; - [Export ("setFlagInit")] - void SetFlagInit (); - - // -(id _Nonnull)copyWithZone:(struct _NSZone * _Nullable)zone __attribute__((warn_unused_result(""))); - // [Export ("copyWithZone:")] - // unsafe NSObject CopyWithZone ([NullAllowed] _NSZone* zone); -} - -// @interface SentryUserFeedback : NSObject -[BaseType(typeof(NSObject))] -[DisableDefaultCtor] -[Internal] -interface SentryUserFeedback : SentrySerializable -{ - // @property (nonatomic, readonly, strong) SentryId * _Nonnull eventId; - [Export("eventId", ArgumentSemantic.Strong)] - SentryId EventId { get; } - - // @property (nonatomic, copy) NSString * _Nonnull name; - [Export("name")] - string Name { get; set; } - - // @property (nonatomic, copy) NSString * _Nonnull email; - [Export("email")] - string Email { get; set; } - - // @property (nonatomic, copy) NSString * _Nonnull comments; - [Export("comments")] - string Comments { get; set; } - - // - (nonnull instancetype)initWithEventId:(SentryId * _Nonnull)eventId OBJC_DESIGNATED_INITIALIZER; - [Export("initWithEventId:")] - NativeHandle Constructor(SentryId eventId); -} - -[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(); -// } - -// @interface SentryViewScreenshotOptions : NSObject -[BaseType (typeof(NSObject), Name = "_TtC6Sentry27SentryViewScreenshotOptions")] -[Internal] -interface SentryViewScreenshotOptions //: ISentryRedactOptions -{ - // @property (nonatomic) BOOL enableViewRendererV2; - [Export ("enableViewRendererV2")] - bool EnableViewRendererV2 { get; set; } - - // @property (nonatomic) BOOL enableFastViewRendering; - [Export ("enableFastViewRendering")] - bool EnableFastViewRendering { get; set; } - - // @property (nonatomic) BOOL maskAllImages; - [Export ("maskAllImages")] - bool MaskAllImages { get; set; } - - // @property (nonatomic) BOOL maskAllText; - [Export ("maskAllText")] - bool MaskAllText { 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; } - - // -(instancetype _Nonnull)initWithEnableViewRendererV2:(BOOL)enableViewRendererV2 enableFastViewRendering:(BOOL)enableFastViewRendering maskAllText:(BOOL)maskAllText maskAllImages:(BOOL)maskAllImages maskedViewClasses:(NSArray * _Nonnull)maskedViewClasses unmaskedViewClasses:(NSArray * _Nonnull)unmaskedViewClasses __attribute__((objc_designated_initializer)); - [Export ("initWithEnableViewRendererV2:enableFastViewRendering:maskAllText:maskAllImages:maskedViewClasses:unmaskedViewClasses:")] - [DesignatedInitializer] - NativeHandle Constructor (bool enableViewRendererV2, bool enableFastViewRendering, bool maskAllText, bool maskAllImages, Class[] maskedViewClasses, Class[] unmaskedViewClasses); -} - -// @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 deleted file mode 100644 index 1453151744..0000000000 --- a/src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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 -{ - Widget = 0, - Custom = 1 -} - -[Native] -internal enum SentryLevel : ulong -{ - None = 0, - Debug = 1, - Info = 2, - Warning = 3, - Error = 4, - Fatal = 5 -} - -[Native] -internal enum SentryStructuredLogLevel : long -{ - Trace = 0, - Debug = 1, - Info = 2, - Warn = 3, - Error = 4, - Fatal = 5 -} - -[Native] -internal enum SentryProfileLifecycle : long -{ - Manual = 0, - Trace = 1 -} - -[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 SentrySessionStatus : ulong -{ - Ok = 0, - Exited = 1, - Crashed = 2, - Abnormal = 3 -} - -[Native] -internal enum SentryTransactionNameSource : long -{ - Custom = 0, - Url = 1, - Route = 2, - View = 3, - Component = 4, - Task = 5 -} diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs new file mode 100644 index 0000000000..53dfb78d00 --- /dev/null +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Program.cs @@ -0,0 +1,132 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; + +if (args.Length != 1) +{ + Console.Error.WriteLine("Usage: Sentry.Bindings.Cocoa.PostProcessor "); + return; +} + +var code = File.ReadAllText(args[0]); +var tree = CSharpSyntaxTree.ParseText(code); +var nodes = tree.GetCompilationUnitRoot() + .Blacklist( + // NSObject + "IsEqual", + "CopyWithZone", + // PrivateSentrySDKOnly + "StoreEnvelope", + "CaptureEnvelope", + "EnvelopeWithData", + // SentryOptions + "CaptureUserFeedback" + ) + .Blacklist( + "SentryUserFeedbackConfigurationBlock" + ) + .Blacklist( + "ConfigureUserFeedback", + "Description", + "EnableMetricKitRawPayload", + "AppStartMeasurement", + "AppStartMeasurementTimeoutInterval", + "OnAppStartMeasurementAvailable", + "SentryExperimentalOptions", + "SpanDescription" + ) + .Whitelist( + "Constants", + "ISentryRRWebEvent", + "PrivateSentrySDKOnly", + "SentryAttachment", + "SentryBaggage", + "SentryBreadcrumb", + "SentryClient", + "SentryDebugImageProvider", + "SentryDebugMeta", + "SentryDsn", + "SentryEvent", + "SentryException", + "SentryFeedback", + "SentryFeedbackAPI", + "SentryFrame", + "SentryGeo", + "SentryHttpStatusCodeRange", + "SentryHub", + "SentryId", + "SentryIntegrationProtocol", + "SentryLog", + "SentryLogger", + "SentryMeasurementUnit", + "SentryMeasurementUnitDuration", + "SentryMeasurementUnitFraction", + "SentryMeasurementUnitInformation", + "SentryMechanism", + "SentryMechanismMeta", + "SentryMessage", + "SentryNSError", + "SentryOptions", + "SentryProfileOptions", + "SentryRedactOptions", + "SentryReplayApi", + "SentryReplayBreadcrumbConverter", + "SentryReplayOptions", + "SentryRequest", + "SentryRRWebEvent", + "SentrySamplingContext", + "SentryScope", + "SentryScreenFrames", + "SentrySDK", + "SentrySerializable", + "SentrySession", + "SentrySpan", + "SentrySpanContext", + "SentrySpanId", + "SentryStacktrace", + "SentryThread", + "SentryTraceContext", + "SentryTraceHeader", + "SentryTransactionContext", + "SentryUser", + "SentryViewScreenshotOptions", + "SentryViewScreenshotProvider" + ); +File.WriteAllText(args[0], nodes.ToFullString()); + +internal static class FilterExtensions +{ + private static string GetIdentifier(SyntaxNode node) + { + return node switch + { + TypeDeclarationSyntax type => type.Identifier.Text, + DelegateDeclarationSyntax del => del.Identifier.Text, + MethodDeclarationSyntax method => method.Identifier.Text, + PropertyDeclarationSyntax property => property.Identifier.Text, + _ => throw new NotSupportedException(node.GetType().Name) + }; + } + + public static CompilationUnitSyntax Blacklist( + this CompilationUnitSyntax root, + params string[] names) where T : SyntaxNode + { + var nameSet = new HashSet(names); + var nodesToRemove = root.DescendantNodes() + .OfType() + .Where(node => nameSet.Contains(GetIdentifier(node))); + return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; + } + + public static CompilationUnitSyntax Whitelist( + this CompilationUnitSyntax root, + params string[] names) where T : SyntaxNode + { + var nameSet = new HashSet(names); + var nodesToRemove = root.DescendantNodes() + .OfType() + .Where(node => !nameSet.Contains(GetIdentifier(node))); + return root.RemoveNodes(nodesToRemove, SyntaxRemoveOptions.KeepNoTrivia)!; + } +} diff --git a/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj b/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj new file mode 100644 index 0000000000..cd9e9995be --- /dev/null +++ b/tools/Sentry.Bindings.Cocoa.PostProcessor/Sentry.Bindings.Cocoa.PostProcessor.csproj @@ -0,0 +1,14 @@ + + + + Exe + net9.0 + enable + enable + + + + + + +