Merge pull request #53 from raymondelferink/master

Added new method go() to allow opening of non-whitelisted apps in iOS
This commit is contained in:
Лампуша
2016-08-11 17:53:28 +03:00
committed by GitHub
5 changed files with 44 additions and 11 deletions
+14 -11
View File
@@ -44,17 +44,20 @@ public class startApp extends CordovaPlugin {
if (action.equals("start")) {
this.start(args, callbackContext);
}
else if(action.equals("check")) {
this.check(args, callbackContext);
}
else if(action.equals("getExtras")) {
this.getExtras(callbackContext);
}
else if(action.equals("getExtra")) {
this.getExtra(args, callbackContext);
}
return true;
else if(action.equals("go")) {
this.start(args, callbackContext);
}
else if(action.equals("check")) {
this.check(args, callbackContext);
}
else if(action.equals("getExtras")) {
this.getExtras(callbackContext);
}
else if(action.equals("getExtra")) {
this.getExtra(args, callbackContext);
}
return true;
}
+1
View File
@@ -4,5 +4,6 @@
- (void)check:(CDVInvokedUrlCommand*)command;
- (void)start:(CDVInvokedUrlCommand*)command;
- (void)go:(CDVInvokedUrlCommand*)command;
@end
+17
View File
@@ -38,4 +38,21 @@
}
- (void)go:(CDVInvokedUrlCommand*)command {
CDVPluginResult* pluginResult = nil;
NSString* scheme = [command.arguments objectAtIndex:0];
if ([[UIApplication sharedApplication] openURL:[NSURL URLWithString:scheme]]) {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:(true)];
}
else {
pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsBool:(false)];
}
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@end
+6
View File
@@ -40,6 +40,12 @@ module.exports = {
errorCallback = errorCallback || function() {};
exec(completeCallback, errorCallback, "startApp", "check", output);
},
go: function(completeCallback, errorCallback) {
completeCallback = completeCallback || function() {};
errorCallback = errorCallback || function() {};
exec(completeCallback, errorCallback, "startApp", "go", output);
}
}
},
+6
View File
@@ -41,6 +41,12 @@ module.exports = {
errorCallback = errorCallback || function() {};
exec(completeCallback, errorCallback, "startApp", "check", output);
},
go: function(completeCallback, errorCallback) {
completeCallback = completeCallback || function() {};
errorCallback = errorCallback || function() {};
exec(completeCallback, errorCallback, "startApp", "go", output);
}
}
},