From f2c632697caadc04335cb70cf4d7c3f921bc3ba9 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Jul 2014 15:41:03 -0300 Subject: [PATCH 1/3] sending ios support --- plugin.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plugin.xml b/plugin.xml index 1ba1be3..c7dbfcc 100644 --- a/plugin.xml +++ b/plugin.xml @@ -24,4 +24,18 @@ + + + + + + + + + + + + + + From 543515bb3cc78fc057333b305b1f66093b625ccb Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 10 Jul 2014 15:42:11 -0300 Subject: [PATCH 2/3] sending ios support --- src/ios/startApp.h | 8 ++++++++ src/ios/startApp.m | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 src/ios/startApp.h create mode 100644 src/ios/startApp.m diff --git a/src/ios/startApp.h b/src/ios/startApp.h new file mode 100644 index 0000000..a835f9a --- /dev/null +++ b/src/ios/startApp.h @@ -0,0 +1,8 @@ +#import + +@interface startApp : CDVPlugin + +- (void)check:(CDVInvokedUrlCommand*)command; +- (void)start:(CDVInvokedUrlCommand*)command; + +@end \ No newline at end of file diff --git a/src/ios/startApp.m b/src/ios/startApp.m new file mode 100644 index 0000000..b851344 --- /dev/null +++ b/src/ios/startApp.m @@ -0,0 +1,41 @@ +#import "startApp.h" +#import + +@implementation startApp + +- (void)check:(CDVInvokedUrlCommand*)command { + + CDVPluginResult* pluginResult = nil; + + NSString* scheme = [command.arguments objectAtIndex:0]; + + if ([[UIApplication sharedApplication] canOpenURL:[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]; + +} + +- (void)start:(CDVInvokedUrlCommand*)command { + + CDVPluginResult* pluginResult = nil; + + NSString* scheme = [command.arguments objectAtIndex:0]; + + if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:scheme]]) { + [[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 From 75428471af863c6f4cfde24bbaf800e4e064ac8f Mon Sep 17 00:00:00 2001 From: Vitor Gomes Date: Thu, 10 Jul 2014 15:50:39 -0300 Subject: [PATCH 3/3] Update README.md --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c1353c0..6673893 100644 --- a/README.md +++ b/README.md @@ -46,4 +46,17 @@ navigator.startApp.start([ function(error) { /* error */ console.log('47', error); }); -``` \ No newline at end of file +``` + + + +**Start application in iOS** + +```js +navigator.startApp.start("twitter://", function(message) { /* success */ + console.log(message); // => OK +}, +function(error) { /* error */ + console.log('47', error); +}); +```