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.
		
		
		
		
		
			
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Objective-C
		
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Objective-C
		
	
| //
 | |
| //  Copyright (c) 2018 Open Whisper Systems. All rights reserved.
 | |
| //
 | |
| 
 | |
| #import <Foundation/Foundation.h>
 | |
| 
 | |
| NS_ASSUME_NONNULL_BEGIN
 | |
| 
 | |
| extern NSString *const kAttachmentDownloadProgressNotification;
 | |
| extern NSString *const kAttachmentDownloadProgressKey;
 | |
| extern NSString *const kAttachmentDownloadAttachmentIDKey;
 | |
| 
 | |
| @class SNProtoAttachmentPointer;
 | |
| @class TSAttachment;
 | |
| @class TSAttachmentPointer;
 | |
| @class TSAttachmentStream;
 | |
| @class TSMessage;
 | |
| @class YapDatabaseReadTransaction;
 | |
| @class YapDatabaseReadWriteTransaction;
 | |
| 
 | |
| #pragma mark -
 | |
| 
 | |
| /**
 | |
|  * Given incoming attachment protos, determines which we support.
 | |
|  * It can download those that we support and notifies threads when it receives unsupported attachments.
 | |
|  */
 | |
| @interface OWSAttachmentDownloads : NSObject
 | |
| 
 | |
| - (nullable NSNumber *)downloadProgressForAttachmentId:(NSString *)attachmentId;
 | |
| 
 | |
| // This will try to download all un-downloaded attachments for a given message.
 | |
| // Any attachments for the message which are already downloaded are skipped BUT
 | |
| // they are included in the success callback.
 | |
| //
 | |
| // success/failure are always called on a worker queue.
 | |
| - (void)downloadAttachmentsForMessage:(TSMessage *)message
 | |
|                           transaction:(YapDatabaseReadTransaction *)transaction
 | |
|                               success:(void (^)(NSArray<TSAttachmentStream *> *attachmentStreams))success
 | |
|                               failure:(void (^)(NSError *error))failure;
 | |
| 
 | |
| // This will try to download a single attachment.
 | |
| //
 | |
| // success/failure are always called on a worker queue.
 | |
| - (void)downloadAttachmentPointer:(TSAttachmentPointer *)attachmentPointer
 | |
|                           success:(void (^)(NSArray<TSAttachmentStream *> *attachmentStreams))success
 | |
|                           failure:(void (^)(NSError *error))failure;
 | |
| 
 | |
| - (void)continueDownloadIfPossible;
 | |
| 
 | |
| @end
 | |
| 
 | |
| NS_ASSUME_NONNULL_END
 |