| 1 | import type { QualityFloor, TabMeta } from "./types"; |
| 2 | |
| 3 | export interface QualityFloorBindings { |
| 4 | SetQualityFloor(floor: string): Promise<void>; |
| 5 | SetQualityFloorForTab(tabID: string, floor: string): Promise<void>; |
| 6 | // Model-free exit from the delivery pause; see desktop/delivery_accept.go. |
| 7 | AcceptDelivery(): Promise<void>; |
| 8 | AcceptDeliveryToTab(tabID: string): Promise<void>; |
| 9 | } |
| 10 | |
| 11 | export function normalizeQualityFloor(floor: string): QualityFloor { |
| 12 | void floor; |
| 13 | return "standard"; |
| 14 | } |
| 15 | |
| 16 | // The mock preserves the retired bridge surface while matching the host's |
| 17 | // standard-only compatibility behavior. |
| 18 | export function makeMockQualityFloorBindings( |
| 19 | tabs: () => TabMeta[], |
| 20 | setTabs: (next: TabMeta[]) => void, |
| 21 | ): QualityFloorBindings { |
| 22 | const applyToTab = (tabID: string, floor: string) => { |
| 23 | const next = normalizeQualityFloor(floor); |
| 24 | setTabs(tabs().map((tab) => (tab.id === tabID ? { ...tab, qualityFloor: next, floorInferred: false } : tab))); |
| 25 | }; |
| 26 | return { |
| 27 | async SetQualityFloor(floor: string) { |
| 28 | const active = tabs().find((tab) => tab.active); |
| 29 | if (active) applyToTab(active.id, floor); |
| 30 | }, |
| 31 | async SetQualityFloorForTab(tabID: string, floor: string) { |
| 32 | applyToTab(tabID, floor); |
| 33 | }, |
| 34 | async AcceptDelivery() {}, |
| 35 | async AcceptDeliveryToTab(_tabID: string) {}, |
| 36 | }; |
| 37 | } |
| 38 |