mirror of
https://github.com/lampaa/com.lampa.startapp.git
synced 2026-05-20 00:01:31 +08:00
sending ios support
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
#import <Cordova/CDV.h>
|
||||
|
||||
@interface startApp : CDVPlugin
|
||||
|
||||
- (void)check:(CDVInvokedUrlCommand*)command;
|
||||
- (void)start:(CDVInvokedUrlCommand*)command;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,41 @@
|
||||
#import "startApp.h"
|
||||
#import <Cordova/CDV.h>
|
||||
|
||||
@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
|
||||
Reference in New Issue
Block a user