mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
6651abbc6f
The last core→engine inversions blocking the playback-core move live in the authStore settings/profile family: authServerProfileActions reads usePlayerStore.queueServerId + calls clearQueueServerForPlayback (on server delete), and authAudioSettingsActions calls usePlayerStore.updateReplayGainForCurrentTrack from ~8 ReplayGain/normalization setters. Both are re-exported through the authStore barrel, so a global store would depend on the (soon-to-move) engine. Add core seam store/playbackEngineBridge.ts: a registry exposing getQueueServerId / clearQueueServerForPlayback / updateReplayGainForCurrentTrack with no-op/null defaults. The engine registers its impls via store/playbackEngineBridgeRegister.ts (side-effect-imported by MainApp at boot). authStore actions now call the neutral delegators instead of importing the engine. Default is safe: the only callers are user-triggered settings/profile actions that fire long after boot (engine already registered); at boot there's no current track or queue binding, so the no-op would be correct anyway. authStore.servers.test imports the register module so removeServer's queue-clear runs through the real engine wiring. Prepares the playback-core move (Engine → features/playback): with this + keeping the 3 config-helper utils in utils/ + tolerating 2 type-only edges, the engine has no inbound core→feature inversions left. tsc 0, lint 0, suite 319/2353 green. Behavior-touching (server-delete queue clear, settings→gain refresh) → Frank QA.
14 lines
758 B
TypeScript
14 lines
758 B
TypeScript
// Engine-side registration for the playback-engine bridge. Side-effect module:
|
|
// importing it installs the engine's operations into @/store/playbackEngineBridge.
|
|
// MainApp side-effect-imports this at boot. Lives with the engine (moves into
|
|
// @/features/playback alongside playerStore); the bridge itself stays in core.
|
|
import { usePlayerStore } from './playerStore';
|
|
import { clearQueueServerForPlayback } from '../utils/playback/playbackServer';
|
|
import { registerPlaybackEngineBridge } from './playbackEngineBridge';
|
|
|
|
registerPlaybackEngineBridge({
|
|
getQueueServerId: () => usePlayerStore.getState().queueServerId,
|
|
clearQueueServerForPlayback,
|
|
updateReplayGainForCurrentTrack: () => usePlayerStore.getState().updateReplayGainForCurrentTrack(),
|
|
});
|