-
-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
543 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#import "SentryReplayEnvelopeItemHeader.h" | ||
#import "SentryEnvelopeItemType.h" | ||
|
||
@implementation SentryReplayEnvelopeItemHeader | ||
|
||
- (instancetype)initWithType:(NSString *)type | ||
segmentId:(NSInteger)segmentId | ||
length:(NSUInteger)length | ||
{ | ||
if (self = [super initWithType:type length:length]) { | ||
self.segmentId = segmentId; | ||
} | ||
return self; | ||
} | ||
|
||
+ (instancetype)replayRecordingHeaderWithSegmentId:(NSInteger)segmentId length:(NSUInteger)length | ||
{ | ||
return [[self alloc] initWithType:SentryEnvelopeItemTypeReplayRecording | ||
segmentId:segmentId | ||
length:length]; | ||
} | ||
|
||
+ (instancetype)replayVideoHeaderWithSegmentId:(NSInteger)segmentId length:(NSUInteger)length | ||
{ | ||
return [[self alloc] initWithType:SentryEnvelopeItemTypeReplayVideo | ||
segmentId:segmentId | ||
length:length]; | ||
} | ||
|
||
- (NSDictionary *)serialize | ||
{ | ||
return @{ @"type" : self.type, @"length" : @(self.length), @"segment_id" : @(self.segmentId) }; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#import "SentryReplayEvent.h" | ||
#import "SentryDateUtil.h" | ||
#import "SentryId.h" | ||
|
||
@implementation SentryReplayEvent | ||
|
||
- (NSDictionary *)serialize | ||
{ | ||
NSMutableDictionary *result = [[super serialize] mutableCopy]; | ||
|
||
NSMutableArray *trace_ids = [NSMutableArray array]; | ||
|
||
for (SentryId *traceId in self.traceIds) { | ||
[trace_ids addObject:traceId.sentryIdString]; | ||
} | ||
|
||
result[@"urls"] = self.urls; | ||
result[@"replay_start_timestamp"] = | ||
@([SentryDateUtil javascriptDate:self.replayStartTimestamp]); | ||
result[@"trace_ids"] = trace_ids; | ||
result[@"replay_id"] = self.replayId.sentryIdString; | ||
result[@"segment_id"] = @(self.segmentId); | ||
result[@"replay_type"] = @"buffer"; | ||
|
||
return result; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#import "SentryReplayRecording.h" | ||
#import "SentryDateUtil.h" | ||
|
||
@implementation SentryReplayRecording | ||
|
||
- (instancetype)initWithSegmentId:(NSInteger)segmentId | ||
size:(NSInteger)size | ||
start:(NSDate *)start | ||
duration:(NSTimeInterval)duration | ||
frameCount:(NSInteger)frameCount | ||
frameRate:(NSInteger)frameRate | ||
height:(NSInteger)height | ||
width:(NSInteger)width | ||
{ | ||
if (self = [super init]) { | ||
self.segmentId = segmentId; | ||
self.size = size; | ||
self.start = start; | ||
self.duration = duration; | ||
self.frameCount = frameCount; | ||
self.frameRate = frameRate; | ||
self.height = height; | ||
self.width = width; | ||
} | ||
return self; | ||
} | ||
|
||
- (nonnull NSArray<NSDictionary<NSString *, id> *> *)serialize | ||
{ | ||
|
||
long timestamp = [SentryDateUtil javascriptDate:self.start]; | ||
|
||
NSDictionary *metaInfo = @{ | ||
@"type" : @4, | ||
@"timestamp" : @(timestamp), | ||
@"data" : @ { @"href" : @"", @"height" : @(self.height), @"width" : @(self.width) } | ||
}; | ||
|
||
NSDictionary *recordingInfo = @{ | ||
@"type" : @5, | ||
@"timestamp" : @(timestamp), | ||
@"data" : @ { | ||
@"tag" : @"video", | ||
@"payload" : @ { | ||
@"segmentId" : @(self.segmentId), | ||
@"size" : @(self.size), | ||
@"duration" : @(self.duration), | ||
@"encoding" : @"h264", | ||
@"container" : @"mp4", | ||
@"height" : @(self.height), | ||
@"width" : @(self.width), | ||
@"frameCount" : @(self.frameCount), | ||
@"frameRateType" : @"constant", | ||
@"frameRate" : @(self.frameRate), | ||
@"left" : @0, | ||
@"top" : @0, | ||
} | ||
} | ||
}; | ||
|
||
return @[ metaInfo, recordingInfo ]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#import "SentryEnvelopeItemHeader.h" | ||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface SentryReplayEnvelopeItemHeader : SentryEnvelopeItemHeader | ||
|
||
@property (nonatomic) NSInteger segmentId; | ||
|
||
- (instancetype)initWithType:(NSString *)type | ||
segmentId:(NSInteger)segmentId | ||
length:(NSUInteger)length; | ||
|
||
+ (instancetype)replayRecordingHeaderWithSegmentId:(NSInteger)segmentId length:(NSUInteger)length; | ||
|
||
+ (instancetype)replayVideoHeaderWithSegmentId:(NSInteger)segmentId length:(NSUInteger)length; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.