|
@@ -748,8 +748,6 @@ NSMutableDictionary *fileStreams = nil;
|
748
|
748
|
|
749
|
749
|
+(void) df:(RCTResponseSenderBlock)callback
|
750
|
750
|
{
|
751
|
|
- uint64_t totalSpace = 0;
|
752
|
|
- uint64_t totalFreeSpace = 0;
|
753
|
751
|
NSError *error = nil;
|
754
|
752
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
755
|
753
|
NSDictionary *dictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[paths lastObject] error: &error];
|
|
@@ -757,11 +755,10 @@ NSMutableDictionary *fileStreams = nil;
|
757
|
755
|
if (dictionary) {
|
758
|
756
|
NSNumber *fileSystemSizeInBytes = [dictionary objectForKey: NSFileSystemSize];
|
759
|
757
|
NSNumber *freeFileSystemSizeInBytes = [dictionary objectForKey:NSFileSystemFreeSize];
|
760
|
|
- totalSpace = [fileSystemSizeInBytes unsignedLongLongValue];
|
761
|
|
- totalFreeSpace = [freeFileSystemSizeInBytes unsignedLongLongValue];
|
|
758
|
+
|
762
|
759
|
callback(@[[NSNull null], @{
|
763
|
|
- @"free" : [NSNumber numberWithUnsignedLongLong: totalFreeSpace],
|
764
|
|
- @"total" : [NSNumber numberWithUnsignedLongLong: totalSpace],
|
|
760
|
+ @"free" : freeFileSystemSizeInBytes,
|
|
761
|
+ @"total" : fileSystemSizeInBytes,
|
765
|
762
|
}]);
|
766
|
763
|
} else {
|
767
|
764
|
callback(@[@"failed to get storage usage."]);
|