// // Created by Tikhonenko Pavel on 23/05/2014. // Copyright (c) 2014 Coub. All rights reserved. // #import #import "CBCoubAsset.h" @protocol CBDownloadOperationDelegate; typedef NS_ENUM(NSInteger, CBDownloadProcessType) { CBDownloadProcessTypeCoub, CBDownloadProcessTypeChunks, }; @interface CBAssetDownloadManager : NSObject - (void)downloadCoubWithoutChunks:(id)coub tag:(NSInteger)tag withDelegate:(id)delegate downloadSucces:(void (^)(id coub, NSInteger tag))success downloadFailure:(void (^)(id coub, NSInteger tag, NSError *error))failure; - (void)downloadCoub:(id)coub tag:(NSInteger)tag withDelegate:(id)delegate withChunks:(BOOL)withChunks downloadSucces:(void (^)(id coub, NSInteger tag))success downloadFailure:(void (^)(id coub, NSInteger tag, NSError *error))failure; #pragma mark - #pragma mark Downloading video and first chunk //- (void)downloadCoub:(id)coub // tag:(NSInteger)tag // withDelegate:(id)delegate // downloadSucces:(void (^)(id coub, NSInteger tag))success downloadFailure:(void (^)(id coub, NSInteger tag, NSError *error))failure; - (void)downloadNextCoub:(id)coub tag:(NSInteger)tag downloadSucces:(void (^)(id coub, NSInteger tag))success downloadFailure:(void (^)(id coub, NSInteger tag, NSError *error))failure; - (void)cancelDownloadingForCoub:(id)coub; #pragma mark - #pragma mark Downloading remaining chunks - (void)downloadChunkWithCoub:(id)coub tag:(NSInteger)tag chunkIdx:(NSInteger)chunkIdx downloadSucces:(void (^)(id coub, NSInteger tag))success downloadFailure:(void (^)(id coub, NSInteger tag, NSError *error))failure; - (void)downloadNextChunkWithCoub:(id)coub downloadSucces:(void (^)(id coub, NSInteger tag))success downloadFailure:(void (^)(id coub, NSInteger tag, NSError *error))failure; //- (void)downloadRemainingChunksWithCoub:(id)coub // tag:(NSInteger)tag // downloadChunkSucces:(void (^)(id coub, NSInteger tag, NSInteger chunkIdx))chunkDownloaded // downloadSucces:(void (^)(id coub, NSInteger tag))success // downloadFailure:(void (^)(id coub, NSInteger tag, NSError *error))failure; - (void)stopAllDownloads; + (instancetype)sharedManager; @end