cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bra...@apache.org
Subject ios commit: Separate the echoArrayBuffer call from normal echo
Date Fri, 18 Jan 2013 17:31:12 GMT
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 <braden@chromium.org>
Authored: Fri Jan 18 12:27:31 2013 -0500
Committer: Braden Shepherdson <braden@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


Mime
View raw message