Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

Commit

Permalink
iOS. Fetch update options object is now immutable.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikDemyankov committed Jun 8, 2016
1 parent fc8e543 commit 54cf76d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/ios/Updater/HCPFetchUpdateOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,22 @@
/**
* URL to the config file (chcp.json).
*/
@property (nonatomic, strong) NSURL *configFileURL;
@property (nonatomic, strong, readonly) NSURL *configFileURL;

/**
* Additional request headers.
*/
@property (nonatomic, strong) NSDictionary<NSString *, NSString *> *requestHeaders;
@property (nonatomic, strong, readonly) NSDictionary<NSString *, NSString *> *requestHeaders;

/**
* Constructor.
*
* @param configFileURL config file url
* @param requestHeaders request headers
*
* @return object instance
*/
- (instancetype)initWithConfigURL:(NSURL *)configFileURL requestHeaders:(NSDictionary<NSString *, NSString *> *)requestHeaders;

/**
* Constructor.
Expand Down
14 changes: 12 additions & 2 deletions src/ios/Updater/HCPFetchUpdateOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,21 @@

@implementation HCPFetchUpdateOptions

- (instancetype)initWithConfigURL:(NSURL *)configFileURL requestHeaders:(NSDictionary<NSString *, NSString *> *)requestHeaders {
self = [super init];
if (self) {
_configFileURL = configFileURL;
_requestHeaders = requestHeaders;
}

return self;
}

- (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];
_configFileURL = dictionary[CONFIG_URL_JSON_KEY] ? [NSURL URLWithString:dictionary[CONFIG_URL_JSON_KEY]] : nil;
_requestHeaders = dictionary[REQUEST_HEADERS_JSON_KEY];
}

return self;
Expand Down

0 comments on commit 54cf76d

Please sign in to comment.