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