incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject ios commit: Fixed CB-475 - FileTransfer js callbacks not working in 1.6.0
Date Tue, 10 Apr 2012 19:15:22 GMT
Updated Branches:
  refs/heads/master 953c3c246 -> 0bb76edfd


Fixed CB-475 - FileTransfer js callbacks not working in 1.6.0


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/0bb76edf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/0bb76edf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/0bb76edf

Branch: refs/heads/master
Commit: 0bb76edfd6ca13d0c355ad2099e7f1e95155131d
Parents: 953c3c2
Author: Shazron Abdullah <shazron@apache.org>
Authored: Tue Apr 10 12:15:14 2012 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Tue Apr 10 12:15:14 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVFileTransfer.h |    4 ++--
 CordovaLib/Classes/CDVFileTransfer.m |    9 ++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/0bb76edf/CordovaLib/Classes/CDVFileTransfer.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.h b/CordovaLib/Classes/CDVFileTransfer.h
index 1535ed9..fb2719f 100644
--- a/CordovaLib/Classes/CDVFileTransfer.h
+++ b/CordovaLib/Classes/CDVFileTransfer.h
@@ -48,13 +48,13 @@ typedef int CDVFileTransferDirection;
 @interface CDVFileTransferDelegate : NSObject {
 }
 
-@property (nonatomic, retain) NSMutableData* responseData;
+@property (atomic, retain) NSMutableData* responseData;
 @property (nonatomic, retain) CDVFileTransfer* command;
 @property (nonatomic, assign) CDVFileTransferDirection direction;
 @property (nonatomic, copy) NSString* callbackId;
 @property (nonatomic, copy) NSString* source;
 @property (nonatomic, copy) NSString* target;
-@property (nonatomic, assign) int responseCode;
+@property (atomic, assign) int responseCode;
 @property (nonatomic, assign) NSInteger bytesWritten;
 
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/0bb76edf/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m b/CordovaLib/Classes/CDVFileTransfer.m
index a166038..98df466 100644
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -82,8 +82,6 @@
     }
     
     if(errorCode > 0) {
-        //result = [PluginResult resultWithStatus: CDVCommandStatus_OK messageAsInt: INVALID_URL_ERR
cast: @"navigator.fileTransfer._castTransferError"];
-        
         result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:
[self createFileTransferError:[NSString stringWithFormat:@"%d", errorCode] AndSource:filePath
AndTarget:server]];
         
         [self writeJavascript:[result toErrorCallbackString:callbackId]];
@@ -153,6 +151,7 @@
 	
 	CDVFileTransferDelegate* delegate = [[[CDVFileTransferDelegate alloc] init] autorelease];
 	delegate.command = self;
+    delegate.direction = CDV_TRANSFER_UPLOAD;
     delegate.callbackId = callbackId;
     delegate.source = server;
     delegate.target = filePath;
@@ -244,8 +243,8 @@
             [uploadResult setObject: [uploadResponse stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
forKey: @"response"];
         }
         [uploadResult setObject:[NSNumber numberWithInt: self.bytesWritten] forKey:@"bytesSent"];
-        [uploadResult setObject:[NSNull null] forKey: @"responseCode"];
-        result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsDictionary:
uploadResult cast: @"navigator.fileTransfer._castUploadResult"];
+        [uploadResult setObject:[NSNumber numberWithInt:self.responseCode] forKey: @"responseCode"];
+        result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsDictionary:
uploadResult];
     }
     if(self.direction == CDV_TRANSFER_DOWNLOAD)
     {
@@ -271,7 +270,7 @@
                     
                     file = [[[CDVFile alloc] init] autorelease];
                     
-                    result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsDictionary:
[file getDirectoryEntry: target isDirectory: bDirRequest] cast: @"window.localFileSystem._castEntry"];
+                    result = [CDVPluginResult resultWithStatus: CDVCommandStatus_OK messageAsDictionary:
[file getDirectoryEntry: target isDirectory: bDirRequest]];
                 }
             }
             @catch (id exception) {


Mime
View raw message