From a2f03908f649099328d0532415f2b82fda29ee12 Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Wed, 19 Feb 2025 14:44:39 +0100 Subject: [PATCH] fix: remove splashscreen provider and handle loading in jellyfinprovider --- app/_layout.tsx | 46 +++++----- app/login.tsx | 1 - bun.lock | 2 +- components/settings/SettingsIndex.tsx | 12 +-- components/settings/SettingsIndex.tv.tsx | 12 +-- package.json | 2 +- providers/.JellyfinProvider.tsx.swp | Bin 0 -> 16384 bytes providers/JellyfinProvider.tsx | 105 +++++++++++------------ providers/SplashScreenProvider.tsx | 103 ---------------------- utils/atoms/settings.ts | 2 + 10 files changed, 76 insertions(+), 209 deletions(-) create mode 100644 providers/.JellyfinProvider.tsx.swp delete mode 100644 providers/SplashScreenProvider.tsx diff --git a/app/_layout.tsx b/app/_layout.tsx index 55652930..dddfe2a1 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -10,10 +10,6 @@ import { } from "@/providers/JellyfinProvider"; import { JobQueueProvider } from "@/providers/JobQueueProvider"; import { PlaySettingsProvider } from "@/providers/PlaySettingsProvider"; -import { - SplashScreenProvider, - useSplashScreenLoading, -} from "@/providers/SplashScreenProvider"; import { WebSocketProvider } from "@/providers/WebSocketProvider"; import { Settings, useSettings } from "@/utils/atoms/settings"; import { BACKGROUND_FETCH_TASK } from "@/utils/background-tasks"; @@ -36,6 +32,7 @@ import { useFonts } from "expo-font"; import { useKeepAwake } from "expo-keep-awake"; const Notifications = !Platform.isTV ? require("expo-notifications") : null; import { router, Stack } from "expo-router"; +import * as SplashScreen from "expo-splash-screen"; import * as ScreenOrientation from "@/packages/expo-screen-orientation"; const TaskManager = !Platform.isTV ? require("expo-task-manager") : null; import { getLocales } from "expo-localization"; @@ -58,6 +55,15 @@ if (!Platform.isTV) { }); } +// Keep the splash screen visible while we fetch resources +SplashScreen.preventAutoHideAsync(); + +// Set the animation options. This is optional. +SplashScreen.setOptions({ + duration: 500, + fade: true, +}); + function useNotificationObserver() { if (Platform.isTV) return; @@ -224,17 +230,15 @@ export default function RootLayout() { Appearance.setColorScheme("dark"); return ( - - - - - - - - - - - + + + + + + + + + ); } @@ -303,16 +307,6 @@ function Layout() { }, []); } - const [loaded] = useFonts({ - SpaceMono: require("../assets/fonts/SpaceMono-Regular.ttf"), - }); - - useSplashScreenLoading(!loaded); - - if (!loaded) { - return null; - } - return ( @@ -324,7 +318,7 @@ function Layout() {