Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/sentry-cocoa.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = 8.39.0
version = 8.44.0
repo = https://github.com/getsentry/sentry-cocoa
12 changes: 9 additions & 3 deletions samples/Sentry.Samples.Maui/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Diagnostics;

namespace Sentry.Samples.Maui;

public static class MauiProgram
Expand All @@ -13,7 +11,7 @@
.UseSentry(options =>
{
// The DSN is the only required option.
options.Dsn = "https://eb18e953812b41c3aeb042e666fd3b5c@o447951.ingest.sentry.io/5428537";
options.Dsn = "https://ee8418ac652ffa7d1a7a97c7d8236175@o4507777248198656.ingest.us.sentry.io/4508439773577216";

// By default, we will send the last 100 breadcrumbs with each event.
// If you want to see everything we can capture from MAUI, you may wish to use a larger value.
Expand All @@ -32,6 +30,14 @@
// Return true to capture or false to prevent the capture
return true;
});

#if ANDROID || IOS
options.Native.SessionReplay.SessionSampleRate = 1.0f;

Check failure on line 35 in samples/Sentry.Samples.Maui/MauiProgram.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

'SentryMauiOptions' does not contain a definition for 'Native' and no accessible extension method 'Native' accepting a first argument of type 'SentryMauiOptions' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in samples/Sentry.Samples.Maui/MauiProgram.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

'SentryMauiOptions' does not contain a definition for 'Native' and no accessible extension method 'Native' accepting a first argument of type 'SentryMauiOptions' could be found (are you missing a using directive or an assembly reference?)
options.Native.SessionReplay.OnErrorSampleRate = 1.0f;

Check failure on line 36 in samples/Sentry.Samples.Maui/MauiProgram.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

'SentryMauiOptions' does not contain a definition for 'Native' and no accessible extension method 'Native' accepting a first argument of type 'SentryMauiOptions' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 36 in samples/Sentry.Samples.Maui/MauiProgram.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

'SentryMauiOptions' does not contain a definition for 'Native' and no accessible extension method 'Native' accepting a first argument of type 'SentryMauiOptions' could be found (are you missing a using directive or an assembly reference?)
options.Native.SessionReplay.MaskAllText = false;

Check failure on line 37 in samples/Sentry.Samples.Maui/MauiProgram.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

'SentryMauiOptions' does not contain a definition for 'Native' and no accessible extension method 'Native' accepting a first argument of type 'SentryMauiOptions' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 37 in samples/Sentry.Samples.Maui/MauiProgram.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

'SentryMauiOptions' does not contain a definition for 'Native' and no accessible extension method 'Native' accepting a first argument of type 'SentryMauiOptions' could be found (are you missing a using directive or an assembly reference?)
options.Native.SessionReplay.MaskAllImages = false;

Check failure on line 38 in samples/Sentry.Samples.Maui/MauiProgram.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

'SentryMauiOptions' does not contain a definition for 'Native' and no accessible extension method 'Native' accepting a first argument of type 'SentryMauiOptions' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 38 in samples/Sentry.Samples.Maui/MauiProgram.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

'SentryMauiOptions' does not contain a definition for 'Native' and no accessible extension method 'Native' accepting a first argument of type 'SentryMauiOptions' could be found (are you missing a using directive or an assembly reference?)
options.Native.SessionReplay.Quality = SentryReplayQuality.Low;

Check failure on line 39 in samples/Sentry.Samples.Maui/MauiProgram.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

'SentryMauiOptions' does not contain a definition for 'Native' and no accessible extension method 'Native' accepting a first argument of type 'SentryMauiOptions' could be found (are you missing a using directive or an assembly reference?)

Check failure on line 39 in samples/Sentry.Samples.Maui/MauiProgram.cs

View workflow job for this annotation

GitHub Actions / .NET (windows-latest)

'SentryMauiOptions' does not contain a definition for 'Native' and no accessible extension method 'Native' accepting a first argument of type 'SentryMauiOptions' could be found (are you missing a using directive or an assembly reference?)
#endif
})

.ConfigureFonts(fonts =>
Expand Down
263 changes: 260 additions & 3 deletions scripts/generate-cocoa-bindings.ps1
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -147,8 +149,52 @@ internal enum SentryTransactionNameSource : long
}
'@

# 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
$SentryReplayQuality = @'

[Native]
internal enum SentryReplayQuality : long
{
Low = 0,
Medium = 1,
High = 2
}
'@

# 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
$SentryReplayType = @'

[Native]
internal enum SentryReplayType : long
{
Session = 0,
Buffer = 1
}
'@

# 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
$SentryRRWebEventType = @'

[Native]
internal enum SentryRRWebEventType : long
{
None = 0,
Touch = 3,
Meta = 4,
Custom = 5
}
'@

$Text += "`n$SentryLevel"
$Text += "`n$SentryTransactionNameSource"
$Text += "`n$SentryReplayQuality"
$Text += "`n$SentryReplayType"
$Text += "`n$SentryRRWebEventType"



# Add header and output file
$Text = "$Header`n`n$Text"
Expand Down Expand Up @@ -221,7 +267,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
Expand All @@ -234,7 +280,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, '
Expand All @@ -247,7 +293,7 @@ $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', ''
#$Text = $Text -replace '\n.*SentryReplayBreadcrumbConverter.*?[\s\S]*?\);\n', ''

$propertiesToRemove = @(
'SentryAppStartMeasurement',
Expand Down Expand Up @@ -298,6 +344,217 @@ interface SentryId

$Text += "`n$SentryId"

# 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
$SentryReplayOptions = @'

// @interface SentryReplayOptions : NSObject <SentryRedactOptions>
[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<Class> * _Nonnull maskedViewClasses;
//[Export ("maskedViewClasses", ArgumentSemantic.Copy)]
//Class[] MaskedViewClasses { get; set; }

// @property (copy, nonatomic) NSArray<Class> * _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<NSString *,id> * _Nonnull)dictionary;
[Export ("initWithDictionary:")]
NativeHandle Constructor (NSDictionary<NSString, NSObject> dictionary);
*/
}
'@

$Text += "`n$SentryReplayOptions"

# 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
$SentryRRWebEvent = @'

// @interface SentryRRWebEvent : NSObject <SentryRRWebEvent>
[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<NSString *,id> * _Nullable data;
[NullAllowed, Export ("data", ArgumentSemantic.Copy)]
NSDictionary<NSString, NSObject> Data { get; }

// -(instancetype _Nonnull)initWithType:(enum SentryRRWebEventType)type timestamp:(NSDate * _Nonnull)timestamp data:(NSDictionary<NSString *,id> * _Nullable)data __attribute__((objc_designated_initializer));
[Export ("initWithType:timestamp:data:")]
[DesignatedInitializer]
NativeHandle Constructor (SentryRRWebEventType type, NSDate timestamp, [NullAllowed] NSDictionary<NSString, NSObject> data);

// -(NSDictionary<NSString *,id> * _Nonnull)serialize __attribute__((warn_unused_result("")));
[Export ("serialize")]
new NSDictionary<NSString, NSObject> Serialize();
}
'@

$Text += "`n$SentryRRWebEvent"

# 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
$SentryReplayBreadcrumbConverter = @'

// @protocol SentryReplayBreadcrumbConverter <NSObject>
[Protocol (Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")]
[BaseType (typeof(NSObject), Name = "_TtP6Sentry31SentryReplayBreadcrumbConverter_")]
[Model]
[Internal]
interface SentryReplayBreadcrumbConverter
{
// @required -(id<SentryRRWebEvent> _Nullable)convertFrom:(SentryBreadcrumb * _Nonnull)breadcrumb __attribute__((warn_unused_result("")));
[Abstract]
[Export ("convertFrom:")]
[return: NullAllowed]
SentryRRWebEvent ConvertFrom (SentryBreadcrumb breadcrumb);
}
'@

$Text += "`n$SentryReplayBreadcrumbConverter"

# 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
$SentryViewScreenshotProvider = @'

// @protocol SentryViewScreenshotProvider <NSObject>
[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<UIImage> onComplete);
}
'@

$Text += "`n$SentryViewScreenshotProvider"

# 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
$sentrySessionReplayIntegration = @'

// @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<SentryReplayBreadcrumbConverter> _Nullable)breadcrumbConverter screenshotProvider:(id<SentryViewScreenshotProvider> _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<SentryRRWebEvent> _Nonnull)createBreadcrumbwithTimestamp:(NSDate * _Nonnull)timestamp category:(NSString * _Nonnull)category message:(NSString * _Nullable)message level:(enum SentryLevel)level data:(NSDictionary<NSString *,id> * _Nullable)data;
[Static]
[Export ("createBreadcrumbwithTimestamp:category:message:level:data:")]
SentryRRWebEvent CreateBreadcrumbwithTimestamp (NSDate timestamp, string category, [NullAllowed] string message, SentryLevel level, [NullAllowed] NSDictionary<NSString, NSObject> data);

// +(id<SentryRRWebEvent> _Nonnull)createNetworkBreadcrumbWithTimestamp:(NSDate * _Nonnull)timestamp endTimestamp:(NSDate * _Nonnull)endTimestamp operation:(NSString * _Nonnull)operation description:(NSString * _Nonnull)description data:(NSDictionary<NSString *,id> * _Nonnull)data;
[Static]
[Export ("createNetworkBreadcrumbWithTimestamp:endTimestamp:operation:description:data:")]
SentryRRWebEvent CreateNetworkBreadcrumbWithTimestamp (NSDate timestamp, NSDate endTimestamp, string operation, string description, NSDictionary<NSString, NSObject> data);

// +(id<SentryReplayBreadcrumbConverter> _Nonnull)createDefaultBreadcrumbConverter;
[Static]
[Export ("createDefaultBreadcrumbConverter")]
SentryReplayBreadcrumbConverter CreateDefaultBreadcrumbConverter();
}
'@

$Text += "`n$sentrySessionReplayIntegration"

# Add header and output file
$Text = "$Header`n`n$Text"
$Text | Out-File "$BindingsPath/$File"
8 changes: 8 additions & 0 deletions src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@
<InternalsVisibleTo Include="Sentry.Testing" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Extensions.Logging.Tests" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Maui" PublicKey="$(SentryPublicKey)" />
<InternalsVisibleTo Include="Sentry.Maui.Tests" PublicKey="$(SentryPublicKey)" />
</ItemGroup>

<ItemGroup>
<AndroidLibrary Include="$(SentryAndroidSdkDirectory)sentry-$(SentryAndroidSdkVersion).jar" />
<AndroidLibrary Include="$(SentryAndroidSdkDirectory)sentry-android-core-$(SentryAndroidSdkVersion).aar" />
<AndroidLibrary Include="$(SentryAndroidSdkDirectory)sentry-android-ndk-$(SentryAndroidSdkVersion).aar" />
<AndroidLibrary Include="$(SentryAndroidSdkDirectory)sentry-android-replay-$(SentryAndroidSdkVersion).aar" />
<AndroidLibrary Include="..\..\lib\sentry-android-supplemental\bin\sentry-android-supplemental.jar" />
<AndroidNativeLibrary Include="..\..\lib\sentrysupplemental\bin\arm64-v8a\libsentrysupplemental.so" Abi="arm64-v8a" />
<AndroidNativeLibrary Include="..\..\lib\sentrysupplemental\bin\armeabi-v7a\libsentrysupplemental.so" Abi="armeabi-v7a" />
Expand All @@ -53,6 +55,12 @@
Condition="!Exists('$(SentryAndroidSdkDirectory)sentry-android-ndk-$(SentryAndroidSdkVersion).aar')"
Retries="3"
/>
<DownloadFile
SourceUrl="https://repo1.maven.org/maven2/io/sentry/sentry-android-replay/$(SentryAndroidSdkVersion)/sentry-android-replay-$(SentryAndroidSdkVersion).aar"
DestinationFolder="$(SentryAndroidSdkDirectory)"
Condition="!Exists('$(SentryAndroidSdkDirectory)sentry-android-replay-$(SentryAndroidSdkVersion).aar')"
Retries="3"
/>
<DownloadFile
SourceUrl="https://repo1.maven.org/maven2/io/sentry/sentry/$(SentryAndroidSdkVersion)/sentry-$(SentryAndroidSdkVersion).jar"
DestinationFolder="$(SentryAndroidSdkDirectory)"
Expand Down
4 changes: 3 additions & 1 deletion src/Sentry.Bindings.Android/Transforms/Metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@
<remove-node path="/api/package[@name='io.sentry.android.core']/class[@name='TempSensorBreadcrumbsIntegration']" />
<remove-node path="/api/package[@name='io.sentry.android.core.internal.gestures']" />
<remove-node path="/api/package[@name='io.sentry.android.core.performance']" />
<remove-node path="/api/package[@name='io.sentry.android.replay.viewhierarchy']" />
<remove-node path="/api/package[@name='io.sentry.android.replay.util']" />

<remove-node path="/api/package[starts-with(@name,'io.sentry')]/*/method[@name='clone' and count(parameter)=0]" />
<remove-node path="/api/package[starts-with(@name,'io.sentry')]/class/implements[@name='io.sentry.JsonDeserializer']" />
<remove-node path="/api/package[@name='io.sentry.vendor.gson.stream']/class[@name='JsonToken']/field[@name='NAME']" />>
<remove-node path="/api/package[@name='io.sentry.vendor.gson.stream']/class[@name='JsonToken']/field[@name='NAME']" />

<remove-node path="/api/package[@name='io.sentry.exception']/class[@name='ExceptionMechanismException']" />
<remove-node path="/api/package[@name='io.sentry.exception']/class[@name='InvalidSentryTraceHeaderException']" />
Expand Down
Loading
Loading