mirror of
https://github.com/lampaa/com.lampa.startapp.git
synced 2026-04-12 00:00:30 +08:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
|
||||
- (void)check:(CDVInvokedUrlCommand*)command;
|
||||
- (void)start:(CDVInvokedUrlCommand*)command;
|
||||
- (void)go:(CDVInvokedUrlCommand*)command;
|
||||
|
||||
@end
|
||||
@@ -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
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user