From cecbb1e821861768d61986200fd3fbdd6bd2f225 Mon Sep 17 00:00:00 2001 From: Raymond Elferink Date: Fri, 20 May 2016 10:21:27 +0200 Subject: [PATCH] introduce 'go' method for iOS to launch app without calling canOpenURL for unwhitelisted custom schemes --- src/ios/startApp.h | 1 + src/ios/startApp.m | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/ios/startApp.h b/src/ios/startApp.h index a835f9a..b80637b 100644 --- a/src/ios/startApp.h +++ b/src/ios/startApp.h @@ -4,5 +4,6 @@ - (void)check:(CDVInvokedUrlCommand*)command; - (void)start:(CDVInvokedUrlCommand*)command; +- (void)go:(CDVInvokedUrlCommand*)command; @end \ No newline at end of file diff --git a/src/ios/startApp.m b/src/ios/startApp.m index b851344..a2f7345 100644 --- a/src/ios/startApp.m +++ b/src/ios/startApp.m @@ -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 \ No newline at end of file