mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-04-28 00:02:49 +08:00
[CB-5175] CDVFileTransfer asynchronous download (Fixes #24)
Since download can take time, for it to be non-blocking, moved the call to a separate thread.
This commit is contained in:
@@ -430,8 +430,12 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
|
||||
@synchronized (activeTransfers) {
|
||||
activeTransfers[delegate.objectId] = delegate;
|
||||
}
|
||||
|
||||
[delegate.connection start];
|
||||
// Downloads can take time
|
||||
// sending this to a new thread calling the download_async method
|
||||
dispatch_async(
|
||||
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, (unsigned long)NULL),
|
||||
^(void) { [delegate.connection start];}
|
||||
);
|
||||
}
|
||||
|
||||
- (NSMutableDictionary*)createFileTransferError:(int)code AndSource:(NSString*)source AndTarget:(NSString*)target
|
||||
|
||||
Reference in New Issue
Block a user