@@ -300,7 +300,7 @@ - (NSDictionary *)constantsToExport
300
300
#pragma mark - fs.stat
301
301
RCT_EXPORT_METHOD (stat:(NSString *)target callback:(RCTResponseSenderBlock) callback)
302
302
{
303
-
303
+
304
304
[RNFetchBlobFS getPathFromUri: target completionHandler: ^(NSString *path, ALAssetRepresentation *asset) {
305
305
__block NSMutableArray * result;
306
306
if (path != nil )
@@ -309,14 +309,14 @@ - (NSDictionary *)constantsToExport
309
309
BOOL exist = nil ;
310
310
BOOL isDir = nil ;
311
311
NSError * error = nil ;
312
-
312
+
313
313
exist = [fm fileExistsAtPath: path isDirectory: &isDir];
314
314
if (exist == NO ) {
315
315
callback (@[[NSString stringWithFormat: @" failed to stat path `%@ ` for it is not exist or it is not exist" , path]]);
316
316
return ;
317
317
}
318
318
result = [RNFetchBlobFS stat: path error: &error];
319
-
319
+
320
320
if (error == nil )
321
321
callback (@[[NSNull null ], result]);
322
322
else
@@ -375,7 +375,7 @@ - (NSDictionary *)constantsToExport
375
375
#pragma mark - fs.cp
376
376
RCT_EXPORT_METHOD (cp:(NSString *)src toPath:(NSString *)dest callback:(RCTResponseSenderBlock) callback)
377
377
{
378
-
378
+
379
379
// path = [RNFetchBlobFS getPathOfAsset:path];
380
380
[RNFetchBlobFS getPathFromUri: src completionHandler: ^(NSString *path, ALAssetRepresentation *asset) {
381
381
NSError * error = nil ;
@@ -387,14 +387,14 @@ - (NSDictionary *)constantsToExport
387
387
else
388
388
{
389
389
BOOL result = [[NSFileManager defaultManager ] copyItemAtURL: [NSURL fileURLWithPath: path] toURL: [NSURL fileURLWithPath: dest] error: &error];
390
-
390
+
391
391
if (error == nil )
392
392
callback (@[[NSNull null ], @YES ]);
393
393
else
394
394
callback (@[[error localizedDescription ], @NO ]);
395
395
}
396
396
}];
397
-
397
+
398
398
}
399
399
400
400
@@ -456,7 +456,7 @@ - (NSDictionary *)constantsToExport
456
456
else
457
457
bufferSize = 4096 ;
458
458
}
459
-
459
+
460
460
dispatch_async (fsQueue, ^{
461
461
[RNFetchBlobFS readStream: path encoding: encoding bufferSize: bufferSize tick: tick streamId: streamId bridgeRef: _bridge];
462
462
});
@@ -482,7 +482,7 @@ - (NSDictionary *)constantsToExport
482
482
#pragma mark - net.enableProgressReport
483
483
RCT_EXPORT_METHOD (enableProgressReport:(NSString *)taskId interval:(nonnull NSNumber *)interval count:(nonnull NSNumber *)count)
484
484
{
485
-
485
+
486
486
RNFetchBlobProgress * cfg = [[RNFetchBlobProgress alloc ] initWithType: Download interval: interval count: count];
487
487
[RNFetchBlobNetwork enableProgressReport: taskId config: cfg];
488
488
}
@@ -509,9 +509,10 @@ - (NSDictionary *)constantsToExport
509
509
UIViewController *rootCtrl = [[[[UIApplication sharedApplication ] delegate ] window ] rootViewController ];
510
510
documentController.delegate = self;
511
511
if (scheme == nil || [[UIApplication sharedApplication ] canOpenURL: [NSURL URLWithString: scheme]]) {
512
- dispatch_sync (dispatch_get_main_queue (), ^{
513
- [documentController presentOptionsMenuFromRect: rootCtrl.view.bounds inView: rootCtrl.view animated: YES ];
514
- });
512
+ CGRect rect = CGRectMake (0.0 , 0.0 , 0.0 , 0.0 );
513
+ dispatch_sync (dispatch_get_main_queue (), ^{
514
+ [documentController presentOptionsMenuFromRect: rect inView: rootCtrl.view animated: YES ];
515
+ });
515
516
resolve (@[[NSNull null ]]);
516
517
} else {
517
518
reject (@" RNFetchBlob could not open document" , @" scheme is not supported" , nil );
@@ -527,7 +528,7 @@ - (NSDictionary *)constantsToExport
527
528
// NSURL * url = [[NSURL alloc] initWithString:uri];
528
529
documentController = [UIDocumentInteractionController interactionControllerWithURL: url];
529
530
documentController.delegate = self;
530
-
531
+
531
532
if (scheme == nil || [[UIApplication sharedApplication ] canOpenURL: [NSURL URLWithString: scheme]]) {
532
533
dispatch_sync (dispatch_get_main_queue (), ^{
533
534
[documentController presentPreviewAnimated: YES ];
@@ -550,7 +551,7 @@ - (NSDictionary *)constantsToExport
550
551
} else {
551
552
reject (@" RNFetchBlob could not open document" , [error description ], nil );
552
553
}
553
-
554
+
554
555
}
555
556
556
557
0 commit comments