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

Commit

Permalink
Added category to parse fetchUpdate options.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikDemyankov committed May 9, 2016
1 parent f43df20 commit 41e08db
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@
<source-file src="src/ios/Utils/HCPAssetsFolderHelper.m" target-dir="Utils/"/>
<header-file src="src/ios/Utils/HCPAssetsFolderHelper.h" target-dir="Utils/"/>

<source-file src="src/ios/Utils/NSDictionary+HCPFetchUpdateOptions.m" target-dir="Utils/"/>
<header-file src="src/ios/Utils/NSDictionary+HCPFetchUpdateOptions.h" target-dir="Utils/"/>

<!-- sources for WKWebViewFix folder -->
<source-file src="src/ios/WKWebViewFix/CDVWKWebViewEngine+HCPPlugin_ReadAccessURL.m" target-dir="WKWebViewFix/"/>
<header-file src="src/ios/WKWebViewFix/CDVWKWebViewEngine+HCPPlugin_ReadAccessURL.h" target-dir="WKWebViewFix/"/>
Expand Down
13 changes: 13 additions & 0 deletions src/ios/Utils/NSDictionary+HCPFetchUpdateOptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// NSDictionary+HCPFetchUpdateOptions.h
//

#import <Foundation/Foundation.h>

@interface NSDictionary (HCPFetchUpdateOptions)

- (NSURL *)configURL;

- (NSDictionary<NSString *, NSString *> *)requestHeaders;

@end
23 changes: 23 additions & 0 deletions src/ios/Utils/NSDictionary+HCPFetchUpdateOptions.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// NSDictionary+HCPFetchUpdateOptions.m
//

#import "NSDictionary+HCPFetchUpdateOptions.h"

static NSString *const CONFIG_URL_JSON_KEY = @"config-url";
static NSString *const REQUEST_HEADERS_JSON_KEY = @"request-headers";

@implementation NSDictionary (HCPFetchUpdateOptions)

- (NSURL *)configURL {
NSString *configPath = self[CONFIG_URL_JSON_KEY];

return configPath ? [NSURL URLWithString:configPath] :nil;
}

- (NSDictionary<NSString *, NSString *> *)requestHeaders {
return self[REQUEST_HEADERS_JSON_KEY];
}


@end

0 comments on commit 41e08db

Please sign in to comment.