This repository has been archived by the owner on Oct 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added fetch update options property to the plugin. You can use it to …
…define default download preferences from the native side. #153
- Loading branch information
1 parent
1770c4b
commit 64e0f24
Showing
4 changed files
with
83 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// HCPFetchUpdateOptions.h | ||
// | ||
// Created by Nikolay Demyankov on 24.05.16. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
/** | ||
* Model for fetch update options. | ||
*/ | ||
@interface HCPFetchUpdateOptions : NSObject | ||
|
||
/** | ||
* URL to the config file (chcp.json). | ||
*/ | ||
@property (nonatomic, strong) NSURL *configFileURL; | ||
|
||
/** | ||
* Additional request headers. | ||
*/ | ||
@property (nonatomic, strong) NSDictionary<NSString *, NSString *> *requestHeaders; | ||
|
||
/** | ||
* Constructor. | ||
* Used internally in the plugin. | ||
* | ||
* @param dictionary dictionary with options from the JS side | ||
* | ||
* @return object instance | ||
*/ | ||
- (instancetype)initWithDictionary:(NSDictionary *)dictionary; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// HCPFetchUpdateOptions.m | ||
// | ||
// Created by Nikolay Demyankov on 24.05.16. | ||
// | ||
|
||
#import "HCPFetchUpdateOptions.h" | ||
|
||
static NSString *const CONFIG_URL_JSON_KEY = @"config-file"; | ||
static NSString *const REQUEST_HEADERS_JSON_KEY = @"request-headers"; | ||
|
||
@implementation HCPFetchUpdateOptions | ||
|
||
- (instancetype)initWithDictionary:(NSDictionary *)dictionary { | ||
self = [super init]; | ||
if (self) { | ||
self.configFileURL = dictionary[CONFIG_URL_JSON_KEY] ? [NSURL URLWithString:dictionary[CONFIG_URL_JSON_KEY]] : nil; | ||
self.requestHeaders = dictionary[REQUEST_HEADERS_JSON_KEY]; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
@end |