Newer
Older
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
43
44
45
46
47
//
// HCPUpdateLoader.h
//
// Created by Nikolay Demyankov on 11.08.15.
//
#import <Foundation/Foundation.h>
#import "HCPUpdateRequest.h"
/**
* Utility class to perform update download.
* It only schedules the download and executes it as soon as possible.
*
* Queue consists from 1 task, because we don't need to store 100 tasks for download request,
* we need only the last one.
*
* Class is a singleton.
*
* @see HCPUpdateLoaderWorker
*/
@interface HCPUpdateLoader : NSObject
/**
* Get shared instance of the object.
*
* @return instance of the object
*/
+ (HCPUpdateLoader *)sharedInstance;
/**
* Add update download task to queue. It will be executed as fast as possible.
*
* @param request update download parameters
* @param error error object reference; filled with data when we failed to launch the update task
*
* @return YES if download task is launched; NO - otherwise
*/
- (BOOL)executeDownloadRequest:(HCPUpdateRequest *)request error:(NSError **)error;
/**
* Flag to check if we are doing any downloads at the moment.
*
* @return <code>YES</code> if download is running, <code>NO</code> otherwise.
*/
@property (nonatomic, readonly, getter=isDownloadInProgress) BOOL isDownloadInProgress;
@end