From ce2e5e0fb88c0208936186a997987cf12b96de2b Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Sun, 15 Sep 2024 17:07:30 +0200 Subject: [PATCH] wip --- .../(home,libraries,search)/items/page.tsx | 16 ++++--- app/_layout.tsx | 7 ++- bun.lockb | Bin 586349 -> 586349 bytes components/CurrentlyPlayingBar.tsx | 40 ++++++++++++------ components/ItemContent.tsx | 2 +- providers/PlaybackProvider.tsx | 6 ++- 6 files changed, 47 insertions(+), 24 deletions(-) diff --git a/app/(auth)/(tabs)/(home,libraries,search)/items/page.tsx b/app/(auth)/(tabs)/(home,libraries,search)/items/page.tsx index fa358ddf..9eca5928 100644 --- a/app/(auth)/(tabs)/(home,libraries,search)/items/page.tsx +++ b/app/(auth)/(tabs)/(home,libraries,search)/items/page.tsx @@ -1,13 +1,17 @@ +import { CurrentlyPlayingBar } from "@/components/CurrentlyPlayingBar"; import { ItemContent } from "@/components/ItemContent"; -import { useLocalSearchParams } from "expo-router"; -import React, { useMemo } from "react"; +import { Stack, useLocalSearchParams } from "expo-router"; +import React from "react"; const Page: React.FC = () => { const { id } = useLocalSearchParams() as { id: string }; - const memoizedContent = useMemo(() => , [id]); - - return memoizedContent; + return ( + <> + + + + ); }; -export default React.memo(Page); +export default Page; diff --git a/app/_layout.tsx b/app/_layout.tsx index ad48c4e3..1f4d5131 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -107,7 +107,12 @@ function Layout() { - + }47PduzF3T^b;>c{vh zV{*k*gY6laj6HIU7Lz}QYfo3`U=)EcCoc%&XwT?i+@8_FWct_^`)4Go-tg-? zxLw}i{GC2K%hxwjY$Q|dR+ygIP_cMz!>!u)c}jK{BLdToZ|DBs5~QG0>dvrzuP3|L zvS|X_@76MNXw`elvYjc-c&+o$eDBJ+5-9>94l<`j7Ekj(!xQgw`pS_Y=1{$9U$%)X zUwJ*c{ElpR!o^9cpSptN&n2&1kw1IEr7%VY21bT|{QrRTaTW$RU}@_5;?n!yeb&|R z3h~~bU`>HQ&+gE*I&sjdbNQpyXdca%`-svfGI0Uzc d%;ET;3RdTSh$D&7Y3@uj*!H=-f>SW(G@HCJMtizK2crmtIe9@CM|(yGzT z#*|yNTAzLU-CAZ2t$MG=N)IMP?C%fRmND_vijT=#56tn+I~bU`>HQ&+gE*I&sjdb$(CJVdca%`-svfGI0Uzc d%;ET;3RdTSh$D&7WV)g?htl>lhd37M0|1t6wmSd- diff --git a/components/CurrentlyPlayingBar.tsx b/components/CurrentlyPlayingBar.tsx index 2d4dcb50..f0c26173 100644 --- a/components/CurrentlyPlayingBar.tsx +++ b/components/CurrentlyPlayingBar.tsx @@ -3,16 +3,19 @@ import { usePlayback } from "@/providers/PlaybackProvider"; import { getBackdropUrl } from "@/utils/jellyfin/image/getBackdropUrl"; import { getAuthHeaders } from "@/utils/jellyfin/jellyfin"; import { writeToLog } from "@/utils/log"; -import { runtimeTicksToMinutes, runtimeTicksToSeconds } from "@/utils/time"; +import { runtimeTicksToSeconds } from "@/utils/time"; import { Ionicons } from "@expo/vector-icons"; -import { BlurView } from "expo-blur"; +import { Api } from "@jellyfin/sdk"; +import { getItemsApi } from "@jellyfin/sdk/lib/utils/api"; +import { useQuery } from "@tanstack/react-query"; +import { Image } from "expo-image"; import { useRouter, useSegments } from "expo-router"; import { useAtom } from "jotai"; -import { useCallback, useEffect, useMemo, useRef, useState } from "react"; +import { useEffect, useMemo, useRef, useState } from "react"; import { - ActivityIndicator, Alert, Dimensions, + Platform, Pressable, TouchableOpacity, View, @@ -22,19 +25,15 @@ import "react-native-gesture-handler"; import Animated, { SharedValue, useAnimatedStyle, - useDerivedValue, useSharedValue, withTiming, } from "react-native-reanimated"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import Video from "react-native-video"; import { Text } from "./common/Text"; -import { Loader } from "./Loader"; -import { Image } from "expo-image"; -import { Api } from "@jellyfin/sdk"; -import { useQuery } from "@tanstack/react-query"; -import { getItemsApi } from "@jellyfin/sdk/lib/utils/api"; import { itemRouter } from "./common/TouchableItemRouter"; +import { Loader } from "./Loader"; +import * as NavigationBar from "expo-navigation-bar"; export const CurrentlyPlayingBar: React.FC = () => { const { @@ -344,6 +343,19 @@ export const CurrentlyPlayingBar: React.FC = () => { return !!nextItem; }, [nextItem]); + useEffect(() => { + if (Platform.OS === "android") { + if (currentlyPlaying) NavigationBar.setVisibilityAsync("hidden"); + else NavigationBar.setVisibilityAsync("visible"); + } + + return () => { + if (Platform.OS === "android") { + NavigationBar.setVisibilityAsync("visible"); + } + }; + }, [currentlyPlaying]); + if (!api || !currentlyPlaying) return null; return ( @@ -619,8 +631,8 @@ export const CurrentlyPlayingBar: React.FC = () => { } const { x, y, url } = trickPlayUrl; - const tileWidth = 200; - const tileHeight = 200 / trickplayInfo.aspectRatio!; + const tileWidth = 150; + const tileHeight = 150 / trickplayInfo.aspectRatio!; return ( { > = ({ ); const stopPlayback = useCallback(async () => { + const id = currentlyPlaying?.item?.Id; + setCurrentlyPlayingState(null); + await reportPlaybackStopped({ api, - itemId: currentlyPlaying?.item?.Id, + itemId: id, sessionId: session?.PlaySessionId, positionTicks: progressTicks ? progressTicks : 0, }); - setCurrentlyPlayingState(null); }, [currentlyPlaying?.item.Id, session?.PlaySessionId, progressTicks, api]); const setIsPlaying = useCallback(