incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/7] ios commit: Minor fixes to FileTransfer.abort.
Date Fri, 21 Sep 2012 03:15:05 GMT
Minor fixes to FileTransfer.abort.

- Guard against no active transfer
- Fix command.callbackId -> delegate.callbackId
- Update param # of callbackId within download (merge conflict)


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

Branch: refs/heads/master
Commit: 56602c020ef50ae6d62c3a1532719df5ccf46518
Parents: 31f894c
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Sep 20 22:28:53 2012 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Sep 20 22:35:32 2012 -0400

----------------------------------------------------------------------
 CordovaLib/Classes/CDVFileTransfer.m |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/56602c02/CordovaLib/Classes/CDVFileTransfer.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFileTransfer.m b/CordovaLib/Classes/CDVFileTransfer.m
index 055b66c..d6be705 100755
--- a/CordovaLib/Classes/CDVFileTransfer.m
+++ b/CordovaLib/Classes/CDVFileTransfer.m
@@ -287,20 +287,22 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
{
     NSString* objectId = [command.arguments objectAtIndex:0];
     
     CDVFileTransferDelegate *delegate = [activeTransfers objectForKey:objectId];
-    [delegate.connection cancel];
-    [activeTransfers removeObjectForKey:objectId];
-    
-    CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:
[self createFileTransferError:CONNECTION_ABORTED AndSource:delegate.source AndTarget:delegate.target]];
-    
-    [self writeJavascript:[result toErrorCallbackString:command.callbackId]];
-
+    if (delegate != nil) {
+        [delegate.connection cancel];
+        [activeTransfers removeObjectForKey:objectId];
+        
+        CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:
[self createFileTransferError:CONNECTION_ABORTED AndSource:delegate.source AndTarget:delegate.target]];
+        
+        [self writeJavascript:[result toErrorCallbackString:delegate.callbackId]];
+    }
 }
 
 - (void) download:(CDVInvokedUrlCommand*)command {
     DLog(@"File Transfer downloading file...");
     NSString * sourceUrl = [command.arguments objectAtIndex:0];
     NSString * filePath = [command.arguments objectAtIndex:1];
-    NSString * objectId = [command.arguments objectAtIndex:2];
+//  NSString* trustAllHosts = (NSString*)[arguments objectAtIndex:6]; // allow self-signed
certs
+    NSString * objectId = [command.arguments objectAtIndex:3];
     CDVPluginResult *result = nil;
     CDVFileTransferError errorCode = 0;
 


Mime
View raw message