From 623afc3ec7dc07a136c7a02b77d39c26d58ea247 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 e213a45a2..9d4e00b0d 100644 --- a/ios/RNFetchBlobFS.m +++ b/ios/RNFetchBlobFS.m @@ -758,8 +758,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]; @@ -767,11 +765,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."]);