Use a fork of react-native-bg-downloader

This commit is contained in:
Zoe Roux 2024-01-28 00:58:14 +01:00
parent 3a125263b7
commit 2d8bd207ed
5 changed files with 12 additions and 12 deletions

View File

@ -18,7 +18,7 @@
"@formatjs/intl-displaynames": "^6.6.6", "@formatjs/intl-displaynames": "^6.6.6",
"@formatjs/intl-locale": "^3.4.5", "@formatjs/intl-locale": "^3.4.5",
"@gorhom/portal": "^1.0.14", "@gorhom/portal": "^1.0.14",
"@kesha-antonov/react-native-background-downloader": "^3.0.1", "@kesha-antonov/react-native-background-downloader": "git+https://github.com/zoriya/react-native-background-downloader.git",
"@kyoo/ui": "workspace:^", "@kyoo/ui": "workspace:^",
"@material-symbols/svg-400": "^0.14.6", "@material-symbols/svg-400": "^0.14.6",
"@react-native-community/netinfo": "11.1.0", "@react-native-community/netinfo": "11.1.0",

View File

@ -33,7 +33,7 @@
"yoshiki": "*" "yoshiki": "*"
}, },
"optionalDependencies": { "optionalDependencies": {
"@kesha-antonov/react-native-background-downloader": "^3.0.1", "@kesha-antonov/react-native-background-downloader": "git+https://github.com/zoriya/react-native-background-downloader.git",
"expo-file-system": "^16.0.5", "expo-file-system": "^16.0.5",
"expo-router": "^3.4.6" "expo-router": "^3.4.6"
}, },

View File

@ -26,7 +26,6 @@ import {
H6, H6,
IconButton, IconButton,
ImageBackground, ImageBackground,
Link,
Menu, Menu,
P, P,
PressableFeedback, PressableFeedback,
@ -132,9 +131,9 @@ const DownloadedItem = ({
</H6> </H6>
{status === "FAILED" && <P>{t("downloads.error", { error: error ?? "Unknow error" })}</P>} {status === "FAILED" && <P>{t("downloads.error", { error: error ?? "Unknow error" })}</P>}
{runtime && status === "DONE" && <SubP>{displayRuntime(runtime)}</SubP>} {runtime && status === "DONE" && <SubP>{displayRuntime(runtime)}</SubP>}
{progress !== 100 && ( {progress !== 100 && progress !== null && (
<View {...css({ flexDirection: "row", alignItems: "center" })}> <View {...css({ flexDirection: "row", alignItems: "center" })}>
<SubP {...css({ flexShrink: 0 })}>{progress}%</SubP> <SubP {...css({ flexShrink: 0 })}>{Math.round(progress)}%</SubP>
<View <View
{...css({ {...css({
flexGrow: 1, flexGrow: 1,

View File

@ -45,7 +45,7 @@ import { z } from "zod";
export type State = { export type State = {
status: "DOWNLOADING" | "PAUSED" | "DONE" | "FAILED" | "STOPPED"; status: "DOWNLOADING" | "PAUSED" | "DONE" | "FAILED" | "STOPPED";
progress: number; progress: number | null;
size: number; size: number;
availableSize: number; availableSize: number;
error?: string; error?: string;
@ -88,7 +88,7 @@ const setupDownloadTask = (
if (!stateAtom) stateAtom = atom({} as State); if (!stateAtom) stateAtom = atom({} as State);
store.set(stateAtom, { store.set(stateAtom, {
status: task.state, status: task.state,
progress: (task.bytesDownloaded / task.bytesTotal) * 100, progress: task.bytesTotal ? (task.bytesDownloaded / task.bytesTotal) * 100 : null,
size: task.bytesTotal, size: task.bytesTotal,
availableSize: task.bytesDownloaded, availableSize: task.bytesDownloaded,
pause: () => { pause: () => {
@ -190,6 +190,7 @@ const download = (
headers: { headers: {
Authorization: account.token.access_token, Authorization: account.token.access_token,
}, },
showNotification: true,
// TODO: Implement only wifi // TODO: Implement only wifi
// network: Network.ALL, // network: Network.ALL,
}); });

View File

@ -2509,12 +2509,12 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@kesha-antonov/react-native-background-downloader@npm:^3.0.1": "@kesha-antonov/react-native-background-downloader@git+https://github.com/zoriya/react-native-background-downloader.git":
version: 3.0.1 version: 3.0.1
resolution: "@kesha-antonov/react-native-background-downloader@npm:3.0.1" resolution: "@kesha-antonov/react-native-background-downloader@https://github.com/zoriya/react-native-background-downloader.git#commit=3c1b703c80f82418936ee17b2e90e6ae49fc8310"
peerDependencies: peerDependencies:
react-native: ">=0.57.0" react-native: ">=0.57.0"
checksum: f369689009b74add987e667746bd80409646ad2ebb51f9a4831242b365e898975d89759b7effd4169156d74ff4cc89d84318f1ab5a854dcd72bcba91081ba3a0 checksum: 05b84e0fe11db3f818ab81bca5e36e1648ce7532335c35d2b65efb24b9241233f6755ee14c77affc765d4d24b0576f87a5951d347948fe532c515ff6322ea3f4
languageName: node languageName: node
linkType: hard linkType: hard
@ -2603,7 +2603,7 @@ __metadata:
resolution: "@kyoo/ui@workspace:packages/ui" resolution: "@kyoo/ui@workspace:packages/ui"
dependencies: dependencies:
"@gorhom/portal": ^1.0.14 "@gorhom/portal": ^1.0.14
"@kesha-antonov/react-native-background-downloader": ^3.0.1 "@kesha-antonov/react-native-background-downloader": "git+https://github.com/zoriya/react-native-background-downloader.git"
"@kyoo/models": "workspace:^" "@kyoo/models": "workspace:^"
"@kyoo/primitives": "workspace:^" "@kyoo/primitives": "workspace:^"
"@shopify/flash-list": ^1.6.3 "@shopify/flash-list": ^1.6.3
@ -10409,7 +10409,7 @@ __metadata:
"@formatjs/intl-displaynames": ^6.6.6 "@formatjs/intl-displaynames": ^6.6.6
"@formatjs/intl-locale": ^3.4.5 "@formatjs/intl-locale": ^3.4.5
"@gorhom/portal": ^1.0.14 "@gorhom/portal": ^1.0.14
"@kesha-antonov/react-native-background-downloader": ^3.0.1 "@kesha-antonov/react-native-background-downloader": "git+https://github.com/zoriya/react-native-background-downloader.git"
"@kyoo/ui": "workspace:^" "@kyoo/ui": "workspace:^"
"@material-symbols/svg-400": ^0.14.6 "@material-symbols/svg-400": ^0.14.6
"@react-native-community/netinfo": 11.1.0 "@react-native-community/netinfo": 11.1.0