This commit is contained in:
Fredrik Burmester
2024-09-28 20:24:39 +02:00
parent ddcb410df6
commit ff88c45d43
11 changed files with 26 additions and 111 deletions

View File

@@ -29,6 +29,7 @@ import { Loader } from "./Loader";
import { MediaSourceSelector } from "./MediaSourceSelector";
import ProgressCircle from "./ProgressCircle";
import { SubtitleTrackSelector } from "./SubtitleTrackSelector";
import { toast } from "sonner-native";
interface DownloadProps extends ViewProps {
item: BaseItemDto;
@@ -65,9 +66,7 @@ export const DownloadItem: React.FC<DownloadProps> = ({ item, ...props }) => {
bottomSheetModalRef.current?.present();
}, []);
const handleSheetChanges = useCallback((index: number) => {
console.log("handleSheetChanges", index);
}, []);
const handleSheetChanges = useCallback((index: number) => {}, []);
const closeModal = useCallback(() => {
bottomSheetModalRef.current?.dismiss();
@@ -286,22 +285,19 @@ export const DownloadItem: React.FC<DownloadProps> = ({ item, ...props }) => {
onPress={() => {
if (userCanDownload === true) {
if (!item.Id) {
Alert.alert("Error", "Item ID is undefined.");
return;
throw new Error("No item id");
}
closeModal();
queueActions.enqueue(queue, setQueue, {
id: item.Id,
execute: async () => {
await initiateDownload();
},
item,
});
initiateDownload();
// Remove for now
// queueActions.enqueue(queue, setQueue, {
// id: item.Id,
// execute: async () => {
// },
// item,
// });
} else {
Alert.alert(
"Disabled",
"This user is not allowed to download files."
);
toast.error("You are not allowed to download files.");
}
}}
color="purple"

View File

@@ -118,8 +118,6 @@ export const ItemContent: React.FC<{ id: string }> = React.memo(({ id }) => {
itemId: id,
});
console.log("itemID", res?.Id);
return res;
},
enabled: !!id && !!api,

View File

@@ -163,7 +163,6 @@ export const PlayButton: React.FC<Props> = ({ item, url, ...props }) => {
});
break;
case 1:
console.log("Device");
setCurrentlyPlayingState({ item, url });
router.push("/play");
break;

View File

@@ -76,7 +76,6 @@ export const ActiveDownload: React.FC<Props> = ({ ...props }) => {
<View className="p-4 flex flex-row items-center justify-between w-full">
<View>
<Text className="font-semibold">{process.item.Name}</Text>
<Text className="text-xs opacity-50">{process.item.Id}</Text>
<Text className="text-xs opacity-50">{process.item.Type}</Text>
<View className="flex flex-row items-center space-x-2 mt-1 text-purple-600">
<Text className="text-xs">{process.progress.toFixed(0)}%</Text>