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

Commit

Permalink
Added new config.xml preference: native-interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikDemyankov committed Feb 29, 2016
1 parent 687719f commit 101ce32
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/ios/Config/HCPXmlConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
*/
@property (nonatomic, getter=isUpdatesAutoInstallationAllowed) BOOL allowUpdatesAutoInstallation;

/**
* Current native interface version of the application.
*/
@property (nonatomic) NSUInteger nativeInterfaceVersion;

/**
* Apply and save options that has been send from the web page.
* Using this we can change plugin config from JavaScript.
Expand Down
1 change: 1 addition & 0 deletions src/ios/Config/HCPXmlConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ - (instancetype)init {
_allowUpdatesAutoDownload = YES;
_allowUpdatesAutoInstallation = YES;
_configUrl = nil;
_nativeInterfaceVersion = 1;
}

return self;
Expand Down
6 changes: 6 additions & 0 deletions src/ios/Config/HCPXmlConfigParser.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName nam
[self parseAutoDownloadOptions:attributeDict];
} else if ([elementName isEqualToString:kHCPAutoInstallXmlTag]) {
[self parseAutoInstallOptions:attributeDict];
} else if ([elementName isEqualToString:kHCPNativeInterfaceXmlTag]) {
[self parseNativeInterfaceOptions:attributeDict];
}
}

Expand Down Expand Up @@ -92,4 +94,8 @@ - (void)parseAutoInstallOptions:(NSDictionary *)attributeDict {
_xmlConfig.allowUpdatesAutoInstallation = [(NSNumber *)attributeDict[kHCPAutoInstallEnabledXmlAttribute] boolValue];
}

- (void)parseNativeInterfaceOptions:(NSDictionary *)attributeDict {
_xmlConfig.nativeInterfaceVersion = [(NSString *)attributeDict[kHCPNativeInterfaceVersionXmlAttribute] integerValue];
}

@end
3 changes: 3 additions & 0 deletions src/ios/Config/HCPXmlTags.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ extern NSString *const kHCPAutoDownloadEnabledXmlAttribute;
extern NSString *const kHCPAutoInstallXmlTag;
extern NSString *const kHCPAutoInstallEnabledXmlAttribute;

extern NSString *const kHCPNativeInterfaceXmlTag;
extern NSString *const kHCPNativeInterfaceVersionXmlAttribute;

@interface HCPXmlTags : NSObject

@end
6 changes: 4 additions & 2 deletions src/ios/Config/HCPXmlTags.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
//
// HCPXmlTags.m
// TestProject
//
// Created by Nikolay Demyankov on 03.09.15.
//
//

#import "HCPXmlTags.h"

Expand All @@ -22,6 +20,10 @@
NSString *const kHCPAutoInstallXmlTag = @"auto-install";
NSString *const kHCPAutoInstallEnabledXmlAttribute = @"enabled";

// Keys for processing native interface version
NSString *const kHCPNativeInterfaceXmlTag = @"native-interface";
NSString *const kHCPNativeInterfaceVersionXmlAttribute = @"version";

@implementation HCPXmlTags

@end

0 comments on commit 101ce32

Please sign in to comment.