/********* de-core-plugin.m Cordova Plugin Implementation *******/
#import <Cordova/CDV.h>
#import <DEUtility/DESecurityUtils.h>
@interface DECoreSecurityPlugin : CDVPlugin {
// Member variables go here.
}
- (void)isVPNSet:(CDVInvokedUrlCommand*)command;
- (void)isProxySet:(CDVInvokedUrlCommand*)command;
- (void)isDeviceRooted:(CDVInvokedUrlCommand*)command;
@end
@implementation DECoreSecurityPlugin
- (void)isVPNSet:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = nil;
BOOL checkResult = [DESecurityUtils isVPNSet];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:checkResult];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)isProxySet:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = nil;
BOOL checkResult = [DESecurityUtils isProxySet];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:checkResult];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)isDeviceRooted:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = nil;
BOOL checkResult = [DESecurityUtils isJailbreakPresent];
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:checkResult];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
- (void)isConsoleLogDisabled:(CDVInvokedUrlCommand*)command
{
BOOL disabled = NO;
NSDictionary* settings = self.commandDelegate.settings;
NSString* valueStr = [settings valueForKey:@"de.security.disableconsolelog"];
if (valueStr && [valueStr caseInsensitiveCompare:@"TRUE"]==NSOrderedSame){
disabled = YES;
}
BOOL consoleLogDisabled = disabled;
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:consoleLogDisabled];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
/**
- (void)coolMethod:(CDVInvokedUrlCommand*)command
{
CDVPluginResult* pluginResult = nil;
NSString* echo = [command.arguments objectAtIndex:0];
if (echo != nil && [echo length] > 0) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo];
} else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
**/
@end