You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/04/06 00:48:55 UTC

ios commit: Fixed CB-433 - CDVFileTransfer.m methods - convert use of "options" object into "arguments" array

Updated Branches:
  refs/heads/master bedabe479 -> 2bac46cef


Fixed CB-433 - CDVFileTransfer.m methods - convert use of "options" object into "arguments" array


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/2bac46ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/2bac46ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/2bac46ce

Branch: refs/heads/master
Commit: 2bac46cefe647ed14d50dce819df6cb3cdd4837f
Parents: bedabe4
Author: Shazron Abdullah <sh...@apache.org>
Authored: Tue Apr 3 16:53:13 2012 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Apr 5 15:45:03 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVFileTransfer.m |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/2bac46ce/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m b/CordovaLib/Classes/CDVFileTransfer.m
index 97b510c..f367657 100644
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -25,12 +25,21 @@
 
 - (void) upload:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options {
     NSString* callbackId = [arguments objectAtIndex:0];
-    NSString* fileKey = (NSString*)[options objectForKey:@"fileKey"];
-    NSString* fileName = (NSString*)[options objectForKey:@"fileName"];
-    NSString* mimeType = (NSString*)[options objectForKey:@"mimeType"];
-    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithDictionary:(NSDictionary*)[options objectForKey:@"params"]];
-    NSString* filePath = (NSString*)[options objectForKey:@"filePath"];
-    NSString* server = (NSString*)[options objectForKey:@"server"];
+    
+    // arguments order from js: [filePath, server, fileKey, fileName, mimeType, params, debug, chunkedMode]
+    // however, params is a JavaScript object and during marshalling is put into the options dict, 
+    // thus debug and chunkedMode are the 6th and 7th arguments
+    
+    NSString* filePath = (NSString*)[arguments objectAtIndex:1];
+    NSString* server = (NSString*)[arguments objectAtIndex:2];
+    NSString* fileKey = (NSString*)[arguments objectAtIndex:3];
+    NSString* fileName = (NSString*)[arguments objectAtIndex:4];
+    NSString* mimeType = (NSString*)[arguments objectAtIndex:5];
+//  NSString* trustAllHosts = (NSString*)[arguments objectAtIndex:6]; // allow self-signed certs
+//  NSString* chunkedMode = (NSString*)[arguments objectAtIndex:7]; // currently unused
+    
+    NSMutableDictionary* params = options;
+    
     CDVPluginResult* result = nil;
     CDVFileTransferError errorCode = 0;