From a0aab26bdc67d258e084d8d78576d69d7f53aa6b Mon Sep 17 00:00:00 2001 From: zher52 Date: Tue, 28 Sep 2021 18:36:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96ios=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugin.xml | 77 +++++++++++++++++++++++------------------ src/ios/CapturePlugin.m | 28 +++++++++++++++ 2 files changed, 71 insertions(+), 34 deletions(-) create mode 100644 src/ios/CapturePlugin.m diff --git a/plugin.xml b/plugin.xml index 4b7aaef..449e38d 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,35 +1,44 @@ - - Capture Plugin - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + Capture Plugin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ios/CapturePlugin.m b/src/ios/CapturePlugin.m new file mode 100644 index 0000000..6b1a628 --- /dev/null +++ b/src/ios/CapturePlugin.m @@ -0,0 +1,28 @@ +/********* Capture Plugin.m Cordova Plugin Implementation *******/ + +#import + +@interface CapturePlugin : CDVPlugin { + // Member variables go here. +} + +- (void)capture:(CDVInvokedUrlCommand*)command; +@end + +@implementation CapturePlugin + +- (void)capture:(CDVInvokedUrlCommand*)command +{ + CDVPluginResult* pluginResult = nil; + NSString* echo = [command.arguments objectAtIndex:0]; + + if (echo != nil && [echo length] > 0) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:echo]; + } else { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR]; + } + + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; +} + +@end