You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2013/01/18 18:31:12 UTC
ios commit: Separate the echoArrayBuffer call from normal echo
Updated Branches:
refs/heads/master 25390650f -> 27ab0659e
Separate the echoArrayBuffer call from normal echo
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/27ab0659
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/27ab0659
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/27ab0659
Branch: refs/heads/master
Commit: 27ab0659ee2e9b8fae4978b04cc783d08eea705d
Parents: 2539065
Author: Braden Shepherdson <br...@chromium.org>
Authored: Fri Jan 18 12:27:31 2013 -0500
Committer: Braden Shepherdson <br...@chromium.org>
Committed: Fri Jan 18 12:27:31 2013 -0500
----------------------------------------------------------------------
CordovaLib/Classes/CDVEcho.m | 28 ++++++++++++----------------
1 files changed, 12 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/27ab0659/CordovaLib/Classes/CDVEcho.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVEcho.m b/CordovaLib/Classes/CDVEcho.m
index 75e6c10..916e315 100644
--- a/CordovaLib/Classes/CDVEcho.m
+++ b/CordovaLib/Classes/CDVEcho.m
@@ -22,23 +22,10 @@
@implementation CDVEcho
-- (CDVPluginResult*)createEchoPluginResult:(CDVInvokedUrlCommand*)command
-{
- id message = [command.arguments objectAtIndex:0];
- CDVPluginResult* pluginResult = nil;
-
- if ([message isKindOfClass:[NSData class]]) {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArrayBuffer:message];
- } else {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
- }
-
- return pluginResult;
-}
-
- (void)echo:(CDVInvokedUrlCommand*)command
{
- CDVPluginResult* pluginResult = [self createEchoPluginResult:command];
+ id message = [command.arguments objectAtIndex:0];
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
@@ -50,9 +37,18 @@
- (void)echoAsync:(CDVInvokedUrlCommand*)command
{
- CDVPluginResult* pluginResult = [self createEchoPluginResult:command];
+ id message = [command.arguments objectAtIndex:0];
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
[self performSelector:@selector(echoAsyncHelper:) withObject:[NSArray arrayWithObjects:pluginResult, command.callbackId, nil] afterDelay:0];
}
+- (void)echoArrayBuffer:(CDVInvokedUrlCommand*)command
+{
+ id message = [command.arguments objectAtIndex:0];
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArrayBuffer:message];
+
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
@end