-
-
Notifications
You must be signed in to change notification settings - Fork 324
/
SentryAttachment.m
52 lines (41 loc) · 1.23 KB
/
SentryAttachment.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#import "SentryAttachment.h"
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
NSString *const DefaultContentType = @"application/octet-stream";
@implementation SentryAttachment
- (instancetype)initWithData:(NSData *)data filename:(NSString *)filename
{
return [self initWithData:data filename:filename contentType:DefaultContentType];
}
- (instancetype)initWithData:(NSData *)data
filename:(NSString *)filename
contentType:(NSString *)contentType
{
if (self = [super init]) {
_data = data;
_filename = filename;
_contentType = contentType;
}
return self;
}
- (instancetype)initWithPath:(NSString *)path
{
return [self initWithPath:path filename:[path lastPathComponent]];
}
- (instancetype)initWithPath:(NSString *)path filename:(NSString *)filename
{
return [self initWithPath:path filename:filename contentType:DefaultContentType];
}
- (instancetype)initWithPath:(NSString *)path
filename:(NSString *)filename
contentType:(NSString *)contentType
{
if (self = [super init]) {
_path = path;
_filename = filename;
_contentType = contentType;
}
return self;
}
@end
NS_ASSUME_NONNULL_END