@@ -511,21 +511,24 @@ + (BOOL)requiresMainQueueSetup
511
511
};
512
512
513
513
params.beginCallback = ^(NSNumber * statusCode, NSNumber * contentLength, NSDictionary * headers) {
514
- [self sendEventWithName: @" DownloadBegin" body: @{@" jobId" : jobId,
514
+ if (self.bridge != nil )
515
+ [self sendEventWithName: @" DownloadBegin" body: @{@" jobId" : jobId,
515
516
@" statusCode" : statusCode,
516
517
@" contentLength" : contentLength,
517
518
@" headers" : headers ?: [NSNull null ]}];
518
519
};
519
520
520
521
params.progressCallback = ^(NSNumber * contentLength, NSNumber * bytesWritten) {
521
- [self sendEventWithName: @" DownloadProgress"
522
+ if (self.bridge != nil )
523
+ [self sendEventWithName: @" DownloadProgress"
522
524
body: @{@" jobId" : jobId,
523
525
@" contentLength" : contentLength,
524
526
@" bytesWritten" : bytesWritten}];
525
527
};
526
528
527
529
params.resumableCallback = ^() {
528
- [self sendEventWithName: @" DownloadResumable" body: nil ];
530
+ if (self.bridge != nil )
531
+ [self sendEventWithName: @" DownloadResumable" body: nil ];
529
532
};
530
533
531
534
if (!self.downloaders ) self.downloaders = [[NSMutableDictionary alloc ] init ];
@@ -623,12 +626,14 @@ + (BOOL)requiresMainQueueSetup
623
626
};
624
627
625
628
params.beginCallback = ^() {
626
- [self sendEventWithName: @" UploadBegin"
629
+ if (self.bridge != nil )
630
+ [self sendEventWithName: @" UploadBegin"
627
631
body: @{@" jobId" : jobId}];
628
632
};
629
633
630
634
params.progressCallback = ^(NSNumber * totalBytesExpectedToSend, NSNumber * totalBytesSent) {
631
- [self sendEventWithName: @" UploadProgress"
635
+ if (self.bridge != nil )
636
+ [self sendEventWithName: @" UploadProgress"
632
637
body: @{@" jobId" : jobId,
633
638
@" totalBytesExpectedToSend" : totalBytesExpectedToSend,
634
639
@" totalBytesSent" : totalBytesSent}];
0 commit comments