From 2191a6f6d66c4e291f84717b55dff43aa8890514 Mon Sep 17 00:00:00 2001 From: Ben Hsieh Date: Wed, 5 Apr 2017 23:41:44 +0800 Subject: [PATCH] Apply fix to #302 IOS fs.df issue --- ios/RNFetchBlobFS.m | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ios/RNFetchBlobFS.m b/ios/RNFetchBlobFS.m index a525d4c2d..4f9ebf0e7 100644 --- a/ios/RNFetchBlobFS.m +++ b/ios/RNFetchBlobFS.m @@ -748,8 +748,6 @@ + (void) getPathFromUri:(NSString *)uri completionHandler:(void(^)(NSString * pa +(void) df:(RCTResponseSenderBlock)callback { - uint64_t totalSpace = 0; - uint64_t totalFreeSpace = 0; NSError *error = nil; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error]; @@ -757,11 +755,10 @@ +(void) df:(RCTResponseSenderBlock)callback if (dictionary) { NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize]; NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize]; - totalSpace = [fileSystemSizeInBytes unsignedLongLongValue]; - totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue]; + callback(@[[NSNull null], @{ - @"free" : [NSNumber numberWithUnsignedLongLong: totalFreeSpace], - @"total" : [NSNumber numberWithUnsignedLongLong: totalSpace], + @"free" : freeFileSystemSizeInBytes, + @"total" : fileSystemSizeInBytes, }]); } else { callback(@[@"failed to get storage usage."]);