Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add SentrySession
  • Loading branch information
jpnurmi committed Sep 16, 2025
commit ac37eb792256df3401efd2ae61484471f3b0b587
7 changes: 0 additions & 7 deletions src/Sentry.Bindings.Cocoa/PrivateApiDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ partial interface SentryScope
// The following types are type-forwarded in various public headers, but have no headers of their own.
// Generate stub classes so the APIs that use them can still operate.

[Internal]
[DisableDefaultCtor]
[BaseType (typeof(NSObject))]
interface SentrySession
{
}

[Internal]
[DisableDefaultCtor]
[BaseType (typeof(NSObject))]
Expand Down
97 changes: 97 additions & 0 deletions src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,103 @@
void ClearLogger ();
}

// @interface SentrySession : NSObject <NSCopying>
[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<NSString *,id> * _Nonnull)jsonObject __attribute__((objc_designated_initializer));
[Export ("initWithJSONObject:")]
[DesignatedInitializer]
NativeHandle Constructor (NSDictionary<NSString, NSObject> 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<NSString *,id> * _Nonnull)serialize __attribute__((warn_unused_result("")));
[Export ("serialize")]
new NSDictionary<NSString, NSObject> Serialize();

Check warning on line 645 in src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs

View workflow job for this annotation

GitHub Actions / ios-tests

The member 'SentrySession.Serialize()' does not hide an accessible member. The new keyword is not required.

Check warning on line 645 in src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs

View workflow job for this annotation

GitHub Actions / ios-tests

The member 'SentrySession.Serialize()' does not hide an accessible member. The new keyword is not required.

Check warning on line 645 in src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The member 'SentrySession.Serialize()' does not hide an accessible member. The new keyword is not required.

Check warning on line 645 in src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The member 'SentrySession.Serialize()' does not hide an accessible member. The new keyword is not required.

Check warning on line 645 in src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The member 'SentrySession.Serialize()' does not hide an accessible member. The new keyword is not required.

Check warning on line 645 in src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs

View workflow job for this annotation

GitHub Actions / .NET (macos)

The member 'SentrySession.Serialize()' does not hide an accessible member. The new keyword is not required.

// -(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 <SentrySerializable>
[BaseType(typeof(NSObject))]
[DisableDefaultCtor]
Expand Down
9 changes: 9 additions & 0 deletions src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ internal enum SentryRRWebEventType : long
Custom = 5
}

[Native]
internal enum SentrySessionStatus : ulong
{
Ok = 0,
Exited = 1,
Crashed = 2,
Abnormal = 3
}

[Native]
internal enum SentryTransactionNameSource : long
{
Expand Down
Loading