fix(player): related marks survive, Restart restarts, and refused pages offer nothing to click
- Every state and Watch-later write goes through features/video/videoWrites, which marks the never-refetched lists (related lists, live searches) once the server has it; a contract test holds it. The Notification Center's undo, the feed's reset and the Watch-later toggles skipped it before. - Confirmed marks are also kept apart (qk.videoMarks) and laid over the related rows: a Show more page landing later rebuilt them from the pages it read when it started, and dropped a mark made meanwhile. - Restart on a related video starts at 0 (the session's stored position won before), and on the one already playing it seeks. - The watched toggle remembers each video's mark: Back showed the opened video's launch-time state after a related one was marked. - The help sheet leaves out the player's keys while a layer above it has them waiting. - After a refusal a retry cannot answer, neither Show more (related) nor Load more (live search) is offered; a failed live-search page keeps the results already read and says why under them. - The related cap message counts requests, as the cap does.
This commit is contained in:
@@ -488,17 +488,31 @@ export const setListInTopLayerProbe = (probe: () => boolean): void => {
|
||||
listInTopLayer = probe;
|
||||
};
|
||||
|
||||
// A surface whose keys wait while a layer sits above it (the YouTube player under its related
|
||||
// drawer or a dialog: every key but Escape is the layer's then). Its rows would promise keys that do
|
||||
// nothing, so the sheet leaves the scope out — asked at the same moment as `helpOverLayer`.
|
||||
const coveredProbes = new Map<KeyScope, () => boolean>();
|
||||
export const setScopeCoveredProbe = (scope: KeyScope, probe: (() => boolean) | null): void => {
|
||||
if (probe) coveredProbes.set(scope, probe);
|
||||
else coveredProbes.delete(scope);
|
||||
};
|
||||
const helpCovered = createStore<ReadonlySet<KeyScope>>(new Set());
|
||||
|
||||
export const closeKeyboardHelp = (): void => helpOpen.set(false);
|
||||
export const toggleKeyboardHelp = (): void => {
|
||||
const next = !helpOpen.get();
|
||||
if (next)
|
||||
if (next) {
|
||||
helpOverLayer.set(!anyBlockingLayer() ? "page" : listInTopLayer() ? "layerWithList" : "layer");
|
||||
helpCovered.set(new Set([...coveredProbes].filter(([, covered]) => covered()).map(([s]) => s)));
|
||||
}
|
||||
helpOpen.set(next);
|
||||
};
|
||||
/** Subscribe to whether the sheet is showing (the Plex player suppresses wheel-volume under it). */
|
||||
export const useKeyboardHelpOpen = (): boolean => helpOpen.useValue();
|
||||
/** What the sheet was opened over (see `helpOverLayer`). */
|
||||
export const useKeyboardHelpOverLayer = (): HelpOver => helpOverLayer.useValue();
|
||||
/** The surfaces a layer covered when the sheet opened (see `setScopeCoveredProbe`). */
|
||||
export const useKeyboardHelpCovered = (): ReadonlySet<KeyScope> => helpCovered.useValue();
|
||||
|
||||
// The modules this account can reach — published by `useGlobalKeymap`, read by the `g` chords and
|
||||
// by the sheet (which drops the chord of a gated module rather than promise a page that isn't there).
|
||||
|
||||
Reference in New Issue
Block a user