mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.6 KiB
C
59 lines
1.6 KiB
C
|
9 years ago
|
//
|
||
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||
|
|
//
|
||
|
10 years ago
|
|
||
|
|
#import "TSAttachment.h"
|
||
|
|
#if TARGET_OS_IPHONE
|
||
|
|
#import <UIKit/UIKit.h>
|
||
|
|
#endif
|
||
|
|
|
||
|
9 years ago
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
|
||
|
9 years ago
|
@class TSAttachmentPointer;
|
||
|
9 years ago
|
@class YapDatabaseReadWriteTransaction;
|
||
|
9 years ago
|
|
||
|
9 years ago
|
@interface TSAttachmentStream : TSAttachment
|
||
|
10 years ago
|
|
||
|
9 years ago
|
- (instancetype)init NS_UNAVAILABLE;
|
||
|
9 years ago
|
- (instancetype)initWithContentType:(NSString *)contentType
|
||
|
9 years ago
|
sourceFilename:(nullable NSString *)sourceFilename NS_DESIGNATED_INITIALIZER;
|
||
|
9 years ago
|
- (instancetype)initWithPointer:(TSAttachmentPointer *)pointer NS_DESIGNATED_INITIALIZER;
|
||
|
9 years ago
|
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
|
||
|
10 years ago
|
|
||
|
9 years ago
|
// Though now required, `digest` may be null for pre-existing records or from
|
||
|
|
// messages received from other clients
|
||
|
|
@property (nullable, nonatomic) NSData *digest;
|
||
|
|
|
||
|
9 years ago
|
// This only applies for attachments being uploaded.
|
||
|
|
@property (atomic) BOOL isUploaded;
|
||
|
|
|
||
|
8 years ago
|
@property (nonatomic, readonly) NSDate *creationTimestamp;
|
||
|
|
|
||
|
10 years ago
|
#if TARGET_OS_IPHONE
|
||
|
9 years ago
|
- (nullable UIImage *)image;
|
||
|
10 years ago
|
#endif
|
||
|
|
|
||
|
|
- (BOOL)isAnimated;
|
||
|
|
- (BOOL)isImage;
|
||
|
|
- (BOOL)isVideo;
|
||
|
9 years ago
|
- (BOOL)isAudio;
|
||
|
9 years ago
|
- (nullable NSURL *)mediaURL;
|
||
|
9 years ago
|
|
||
|
9 years ago
|
- (nullable NSString *)filePath;
|
||
|
9 years ago
|
|
||
|
9 years ago
|
- (nullable NSData *)readDataFromFileWithError:(NSError **)error;
|
||
|
|
- (BOOL)writeData:(NSData *)data error:(NSError **)error;
|
||
|
10 years ago
|
|
||
|
|
+ (void)deleteAttachments;
|
||
|
|
+ (NSString *)attachmentsFolder;
|
||
|
|
|
||
|
9 years ago
|
- (CGSize)imageSizeWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||
|
|
- (CGSize)imageSizeWithoutTransaction;
|
||
|
9 years ago
|
|
||
|
9 years ago
|
- (CGFloat)audioDurationSecondsWithTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||
|
|
- (CGFloat)audioDurationSecondsWithoutTransaction;
|
||
|
9 years ago
|
|
||
|
10 years ago
|
@end
|
||
|
9 years ago
|
|
||
|
|
NS_ASSUME_NONNULL_END
|