|
@@ -758,8 +758,6 @@ NSMutableDictionary *fileStreams = nil;
|
758
|
758
|
|
759
|
759
|
+(void) df:(RCTResponseSenderBlock)callback
|
760
|
760
|
{
|
761
|
|
- uint64_t totalSpace = 0;
|
762
|
|
- uint64_t totalFreeSpace = 0;
|
763
|
761
|
NSError *error = nil;
|
764
|
762
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
765
|
763
|
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
|
|
@@ -767,11 +765,10 @@ NSMutableDictionary *fileStreams = nil;
|
767
|
765
|
if (dictionary) {
|
768
|
766
|
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
|
769
|
767
|
NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
|
770
|
|
- totalSpace = [fileSystemSizeInBytes unsignedLongLongValue];
|
771
|
|
- totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
|
|
768
|
+
|
772
|
769
|
callback(@[[NSNull null], @{
|
773
|
|
- @"free" : [NSNumber numberWithUnsignedLongLong: totalFreeSpace],
|
774
|
|
- @"total" : [NSNumber numberWithUnsignedLongLong: totalSpace],
|
|
770
|
+ @"free" : freeFileSystemSizeInBytes,
|
|
771
|
+ @"total" : fileSystemSizeInBytes,
|
775
|
772
|
}]);
|
776
|
773
|
} else {
|
777
|
774
|
callback(@[@"failed to get storage usage."]);
|