mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 15:48:05 +00:00
fix: storage calculation
This commit is contained in:
@@ -6,6 +6,7 @@ import { File, Paths } from "expo-file-system";
|
||||
import type { MutableRefObject } from "react";
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import DeviceInfo from "react-native-device-info";
|
||||
import { toast } from "sonner-native";
|
||||
import type { Bitrate } from "@/components/BitrateSelector";
|
||||
import useImageStorage from "@/hooks/useImageStorage";
|
||||
@@ -286,11 +287,25 @@ export function useDownloadOperations({
|
||||
const appSizeUsage = useCallback(async () => {
|
||||
const totalSize = calculateTotalDownloadedSize();
|
||||
|
||||
return {
|
||||
total: 0,
|
||||
remaining: 0,
|
||||
appSize: totalSize,
|
||||
};
|
||||
try {
|
||||
const [freeDiskStorage, totalDiskCapacity] = await Promise.all([
|
||||
DeviceInfo.getFreeDiskStorage(),
|
||||
DeviceInfo.getTotalDiskCapacity(),
|
||||
]);
|
||||
|
||||
return {
|
||||
total: totalDiskCapacity,
|
||||
remaining: freeDiskStorage,
|
||||
appSize: totalSize,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Failed to get disk storage info:", error);
|
||||
return {
|
||||
total: 0,
|
||||
remaining: 0,
|
||||
appSize: totalSize,
|
||||
};
|
||||
}
|
||||
}, []);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user