Skip to content

Commit ac37eb7

Browse files
committed
Add SentrySession
1 parent 0847a67 commit ac37eb7

File tree

3 files changed

+106
-7
lines changed

3 files changed

+106
-7
lines changed

src/Sentry.Bindings.Cocoa/PrivateApiDefinitions.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@ partial interface SentryScope
1717
// The following types are type-forwarded in various public headers, but have no headers of their own.
1818
// Generate stub classes so the APIs that use them can still operate.
1919

20-
[Internal]
21-
[DisableDefaultCtor]
22-
[BaseType (typeof(NSObject))]
23-
interface SentrySession
24-
{
25-
}
26-
2720
[Internal]
2821
[DisableDefaultCtor]
2922
[BaseType (typeof(NSObject))]

src/Sentry.Bindings.Cocoa/SwiftApiDefinitions.cs

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,103 @@ interface SentrySDK
556556
void ClearLogger ();
557557
}
558558

559+
// @interface SentrySession : NSObject <NSCopying>
560+
[BaseType (typeof(NSObject), Name = "_TtC6Sentry13SentrySession")]
561+
[DisableDefaultCtor]
562+
[Internal]
563+
interface SentrySession
564+
{
565+
// -(instancetype _Nonnull)initWithReleaseName:(NSString * _Nonnull)releaseName distinctId:(NSString * _Nonnull)distinctId __attribute__((objc_designated_initializer));
566+
[Export ("initWithReleaseName:distinctId:")]
567+
[DesignatedInitializer]
568+
NativeHandle Constructor (string releaseName, string distinctId);
569+
570+
// -(instancetype _Nullable)initWithJSONObject:(NSDictionary<NSString *,id> * _Nonnull)jsonObject __attribute__((objc_designated_initializer));
571+
[Export ("initWithJSONObject:")]
572+
[DesignatedInitializer]
573+
NativeHandle Constructor (NSDictionary<NSString, NSObject> jsonObject);
574+
575+
// -(void)endSessionExitedWithTimestamp:(NSDate * _Nonnull)timestamp;
576+
[Export ("endSessionExitedWithTimestamp:")]
577+
void EndSessionExitedWithTimestamp (NSDate timestamp);
578+
579+
// -(void)endSessionCrashedWithTimestamp:(NSDate * _Nonnull)timestamp;
580+
[Export ("endSessionCrashedWithTimestamp:")]
581+
void EndSessionCrashedWithTimestamp (NSDate timestamp);
582+
583+
// -(void)endSessionAbnormalWithTimestamp:(NSDate * _Nonnull)timestamp;
584+
[Export ("endSessionAbnormalWithTimestamp:")]
585+
void EndSessionAbnormalWithTimestamp (NSDate timestamp);
586+
587+
// -(void)incrementErrors;
588+
[Export ("incrementErrors")]
589+
void IncrementErrors ();
590+
591+
// @property (readonly, copy, nonatomic) NSUUID * _Nonnull sessionId;
592+
[Export ("sessionId", ArgumentSemantic.Copy)]
593+
NSUuid SessionId { get; }
594+
595+
// @property (readonly, copy, nonatomic) NSDate * _Nonnull started;
596+
[Export ("started", ArgumentSemantic.Copy)]
597+
NSDate Started { get; }
598+
599+
// @property (readonly, nonatomic) enum SentrySessionStatus status;
600+
[Export ("status")]
601+
SentrySessionStatus Status { get; }
602+
603+
// @property (nonatomic) NSUInteger errors;
604+
[Export ("errors")]
605+
nuint Errors { get; set; }
606+
607+
// @property (readonly, nonatomic) NSUInteger sequence;
608+
[Export ("sequence")]
609+
nuint Sequence { get; }
610+
611+
// @property (readonly, copy, nonatomic) NSString * _Nonnull distinctId;
612+
[Export ("distinctId")]
613+
string DistinctId { get; }
614+
615+
// @property (readonly, nonatomic, strong) NSNumber * _Nullable flagInit;
616+
[NullAllowed, Export ("flagInit", ArgumentSemantic.Strong)]
617+
NSNumber FlagInit { get; }
618+
619+
// @property (readonly, copy, nonatomic) NSDate * _Nullable timestamp;
620+
[NullAllowed, Export ("timestamp", ArgumentSemantic.Copy)]
621+
NSDate Timestamp { get; }
622+
623+
// @property (readonly, nonatomic, strong) NSNumber * _Nullable duration;
624+
[NullAllowed, Export ("duration", ArgumentSemantic.Strong)]
625+
NSNumber Duration { get; }
626+
627+
// @property (readonly, copy, nonatomic) NSString * _Nullable releaseName;
628+
[NullAllowed, Export ("releaseName")]
629+
string ReleaseName { get; }
630+
631+
// @property (copy, nonatomic) NSString * _Nullable environment;
632+
[NullAllowed, Export ("environment")]
633+
string Environment { get; set; }
634+
635+
// @property (nonatomic, strong) SentryUser * _Nullable user;
636+
[NullAllowed, Export ("user", ArgumentSemantic.Strong)]
637+
SentryUser User { get; set; }
638+
639+
// @property (copy, nonatomic) NSString * _Nullable abnormalMechanism;
640+
[NullAllowed, Export ("abnormalMechanism")]
641+
string AbnormalMechanism { get; set; }
642+
643+
// -(NSDictionary<NSString *,id> * _Nonnull)serialize __attribute__((warn_unused_result("")));
644+
[Export ("serialize")]
645+
new NSDictionary<NSString, NSObject> Serialize();
646+
647+
// -(void)setFlagInit;
648+
[Export ("setFlagInit")]
649+
void SetFlagInit ();
650+
651+
// -(id _Nonnull)copyWithZone:(struct _NSZone * _Nullable)zone __attribute__((warn_unused_result("")));
652+
// [Export ("copyWithZone:")]
653+
// unsafe NSObject CopyWithZone ([NullAllowed] _NSZone* zone);
654+
}
655+
559656
// @interface SentryUserFeedback : NSObject <SentrySerializable>
560657
[BaseType(typeof(NSObject))]
561658
[DisableDefaultCtor]

src/Sentry.Bindings.Cocoa/SwiftStructsAndEnums.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ internal enum SentryRRWebEventType : long
6969
Custom = 5
7070
}
7171

72+
[Native]
73+
internal enum SentrySessionStatus : ulong
74+
{
75+
Ok = 0,
76+
Exited = 1,
77+
Crashed = 2,
78+
Abnormal = 3
79+
}
80+
7281
[Native]
7382
internal enum SentryTransactionNameSource : long
7483
{

0 commit comments

Comments
 (0)