session-ios/src/Messages/Attachments/TSAttachmentStream.h
Michael Kirk 3e5af16dc3 Don't explode when attachment support revoked.
Also, more nullability annotations.

NSURL can't be given a nil filepath. This can occur when a previously
supported attachment was downloaded, and then viewed after that
attachment was no longer supported (e.g. when installing back and forth
across versions)

// FREEBIE
2016-09-11 12:10:08 -04:00

37 lines
859 B
Objective-C

// Created by Frederic Jacobs on 17/12/14.
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
#import "TSAttachment.h"
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#endif
NS_ASSUME_NONNULL_BEGIN
@interface TSAttachmentStream : TSAttachment
@property (nonatomic) BOOL isDownloaded;
- (instancetype)initWithIdentifier:(NSString *)identifier
data:(NSData *)data
key:(NSData *)key
contentType:(NSString *)contentType NS_DESIGNATED_INITIALIZER;
#if TARGET_OS_IPHONE
- (nullable UIImage *)image;
#endif
- (BOOL)isAnimated;
- (BOOL)isImage;
- (BOOL)isVideo;
- (nullable NSString *)filePath;
- (nullable NSURL *)mediaURL;
+ (void)deleteAttachments;
+ (NSString *)attachmentsFolder;
+ (NSUInteger)numberOfItemsInAttachmentsFolder;
@end
NS_ASSUME_NONNULL_END