introduce 'go' method for iOS to launch app without calling canOpenURL for unwhitelisted custom schemes

This commit is contained in:
Raymond Elferink 2016-05-20 10:21:27 +02:00
parent 116ad62b6d
commit cecbb1e821
2 changed files with 18 additions and 0 deletions

View File

@ -4,5 +4,6 @@
- (void)check:(CDVInvokedUrlCommand*)command;
- (void)start:(CDVInvokedUrlCommand*)command;
- (void)go:(CDVInvokedUrlCommand*)command;
@end

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