bring over relevant desktop settings

This commit is contained in:
Boof2015
2026-07-14 01:14:16 -04:00
parent c9d065e662
commit 7b35e01fe0
36 changed files with 1646 additions and 126 deletions
+22 -1
View File
@@ -47,6 +47,8 @@ import { useOnboardingStore } from '@/stores/onboardingStore';
import { OnboardingFlow } from '@/components/onboarding/OnboardingFlow';
import { useTheme } from '@/theme/themed';
import { SessionLifecycle } from '@/session/SessionLifecycle';
import { useLyricsSettingsStore } from '@/stores/lyricsSettingsStore';
import { useSleepTimerStore } from '@/stores/sleepTimerStore';
// Anchor the root stack at the tabs so a deep link straight to a top-level route
// (the widget's `recently-played`, the notification-click redirect) builds
@@ -81,6 +83,17 @@ function ThemeSystemSync() {
return null;
}
function SleepTimerLifecycle() {
useEffect(() => {
void useSleepTimerStore.getState().hydrate();
const subscription = AppState.addEventListener('change', (state) => {
if (state === 'active') void useSleepTimerStore.getState().reconcile();
});
return () => subscription.remove();
}, []);
return null;
}
/** Owns the visualizer on/off gate (foreground + playing + motion). Renders nothing. */
function ScopeLifecycle() {
useScopeLifecycle();
@@ -110,7 +123,10 @@ function PlaybackTargetSync() {
}, [loadTarget]);
useEffect(() => {
if (target === 'desktop') void initDesktopRemote();
if (target === 'desktop') {
if (useSleepTimerStore.getState().timer) void useSleepTimerStore.getState().cancel();
void initDesktopRemote();
}
}, [target, initDesktopRemote]);
return null;
@@ -346,6 +362,10 @@ export default function RootLayout() {
.getState()
.load()
.catch((err) => console.error('[audioSettings] load failed', err));
useLyricsSettingsStore
.getState()
.load()
.catch((err) => console.error('[lyricsSettings] load failed', err));
// Remote sources: load server rows + hydrate the URL registry from cached
// config/token (no network on launch). Runs after library init reads first.
useRemoteSourcesStore
@@ -373,6 +393,7 @@ export default function RootLayout() {
{onboardingComplete ? (
<>
<ThemeSystemSync />
<SleepTimerLifecycle />
<PlaybackSync />
<ScopeLifecycle />
<NormalizationSync />