mirror of
https://github.com/Boof2015/astra-mobile.git
synced 2026-08-20 04:30:54 +02:00
bring over relevant desktop settings
This commit is contained in:
+22
-1
@@ -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 />
|
||||
|
||||
Reference in New Issue
Block a user