File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -541,5 +541,27 @@ - (void) URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPe
541541 }
542542}
543543
544+ // NSURLSessionDownloadTask delegates
545+
546+ #pragma mark NSURLSessionDownloadTask delegate methods
547+
548+ - (void )URLSession : (NSURLSession *)session downloadTask : (NSURLSessionDownloadTask *)downloadTask didWriteData : (int64_t )bytesWritten totalBytesWritten : (int64_t )totalBytesWritten totalBytesExpectedToWrite : (int64_t )totalBytesExpectedToWrite {
549+ if (totalBytesExpectedToWrite == 0 ) {
550+ return ;
551+ }
552+
553+ NSNumber * now =[NSNumber numberWithFloat: ((float )totalBytesWritten/(float )totalBytesExpectedToWrite)];
554+ if ([self .progressConfig shouldReport: now]) {
555+ [self .bridge.eventDispatcher
556+ sendDeviceEventWithName: EVENT_PROGRESS
557+ body: @{
558+ @" taskId" : taskId,
559+ @" written" : [NSString stringWithFormat: @" %lld " , (long long ) totalBytesWritten],
560+ @" total" : [NSString stringWithFormat: @" %lld " , (long long ) totalBytesExpectedToWrite]
561+ }
562+ ];
563+ }
564+ }
565+
544566
545567@end
You can’t perform that action at this time.
0 commit comments