forked from genkido/TWRDownloadManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TWRDownloadObject.h
42 lines (34 loc) · 1.72 KB
/
TWRDownloadObject.h
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
//
// TWRDownloadObject.h
// DownloadManager
//
// Created by Michelangelo Chasseur on 26/07/14.
// Copyright (c) 2014 Touchware. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreGraphics/CGBase.h>
typedef void(^TWRDownloadRemainingTimeBlock)(NSString* url, NSUInteger seconds);
typedef void(^TWRDownloadProgressBlock)(NSString* url, CGFloat progress);
typedef void(^TWRDownloadCancelationBlock)(NSString* url);
typedef void(^TWRDownloadErrorBlock)(NSString* url);
typedef void(^TWRDownloadCompletionBlock)(NSString* url);
@interface TWRDownloadObject : NSObject
@property (copy, nonatomic) TWRDownloadProgressBlock progressBlock;
@property (copy, nonatomic) TWRDownloadCancelationBlock cancelationBlock;
@property (copy, nonatomic) TWRDownloadErrorBlock errorBlock;
@property (copy, nonatomic) TWRDownloadCompletionBlock completionBlock;
@property (copy, nonatomic) TWRDownloadRemainingTimeBlock remainingTimeBlock;
@property (strong, nonatomic) NSURLSessionTask *downloadTask;
@property (copy, nonatomic) NSString *fileName;
@property (copy, nonatomic) NSString *friendlyName;
@property (copy, nonatomic) NSString *directoryName;
@property (copy, nonatomic) NSDate *startDate;
@property (atomic) NSUInteger startBytes;
@property (atomic) BOOL isRedownload;
- (instancetype)initWithDownloadTask:(NSURLSessionTask *)downloadTask
progressBlock:(TWRDownloadProgressBlock)progressBlock
cancelBlock:(TWRDownloadCancelationBlock)cancelBlock
errorBlock:(TWRDownloadErrorBlock)errorBlock
remainingTime:(TWRDownloadRemainingTimeBlock)remainingTimeBlock
completionBlock:(TWRDownloadCompletionBlock)completionBlock;
@end