Migrate all IPC call sites to typed tauri-specta commands.*
Replace the remaining ~155 untyped invoke() calls across stores, services, components, and routes with the generated commands.* wrappers from $lib/api/bindings, so every IPC call is compile-time-checked against the command signatures. - Register repository_get_subtitle_url and repository_get_video_download_url in specta_builder() and the invoke_handler; regenerate bindings.ts. - Source duplicated wire types (AutoplaySettings, CacheConfig, Session, ConnectivityStatus, audio/video settings, etc.) from bindings. - Fix two bugs surfaced by the typed wrappers: - VideoDownloadButton passed an un-awaited Promise as the stream URL. - setAutoplaySettings omitted the required userId argument. - Update unit tests asserting the old invoke(name, args) shape. - Remove the five param-naming guard tests; the compiler and codegen now enforce what they checked. svelte-check: 0 errors. vitest: green. cargo test --lib: green.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
import { writable, derived } from "svelte/store";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { commands } from "$lib/api/bindings";
|
||||
|
||||
export type SleepTimerMode =
|
||||
| { kind: "off" }
|
||||
@@ -39,25 +39,19 @@ function createSleepTimerStore() {
|
||||
// Methods that invoke the backend API
|
||||
async setTimeTimer(minutes: number): Promise<void> {
|
||||
const endTime = Date.now() + minutes * 60 * 1000;
|
||||
await invoke("player_set_sleep_timer", {
|
||||
mode: { kind: "time", endTime },
|
||||
});
|
||||
await commands.playerSetSleepTimer({ kind: "time", endTime });
|
||||
},
|
||||
|
||||
async setEndOfTrackTimer(): Promise<void> {
|
||||
await invoke("player_set_sleep_timer", {
|
||||
mode: { kind: "endOfTrack" },
|
||||
});
|
||||
await commands.playerSetSleepTimer({ kind: "endOfTrack" });
|
||||
},
|
||||
|
||||
async setEpisodesTimer(count: number): Promise<void> {
|
||||
await invoke("player_set_sleep_timer", {
|
||||
mode: { kind: "episodes", remaining: count },
|
||||
});
|
||||
await commands.playerSetSleepTimer({ kind: "episodes", remaining: count });
|
||||
},
|
||||
|
||||
async cancel(): Promise<void> {
|
||||
await invoke("player_cancel_sleep_timer");
|
||||
await commands.playerCancelSleepTimer();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user