diff --git a/src/ios/Updater/HCPFetchUpdateOptions.h b/src/ios/Updater/HCPFetchUpdateOptions.h index db161503..5daac422 100644 --- a/src/ios/Updater/HCPFetchUpdateOptions.h +++ b/src/ios/Updater/HCPFetchUpdateOptions.h @@ -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 *requestHeaders; +@property (nonatomic, strong, readonly) NSDictionary *requestHeaders; + +/** + * Constructor. + * + * @param configFileURL config file url + * @param requestHeaders request headers + * + * @return object instance + */ +- (instancetype)initWithConfigURL:(NSURL *)configFileURL requestHeaders:(NSDictionary *)requestHeaders; /** * Constructor. diff --git a/src/ios/Updater/HCPFetchUpdateOptions.m b/src/ios/Updater/HCPFetchUpdateOptions.m index 210d99d6..4e12c838 100644 --- a/src/ios/Updater/HCPFetchUpdateOptions.m +++ b/src/ios/Updater/HCPFetchUpdateOptions.m @@ -11,11 +11,21 @@ @implementation HCPFetchUpdateOptions +- (instancetype)initWithConfigURL:(NSURL *)configFileURL requestHeaders:(NSDictionary *)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;