You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2012/09/21 05:15:05 UTC
[2/7] ios commit: Minor fixes to FileTransfer.abort.
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 <ag...@chromium.org>
Authored: Thu Sep 20 22:28:53 2012 -0400
Committer: Andrew Grieve <ag...@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;