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:
@@ -1,6 +1,6 @@
|
||||
<!-- TRACES: UR-004, UR-005, UR-028 | DR-009 -->
|
||||
<script lang="ts">
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { commands } from "$lib/api/bindings";
|
||||
import { goto } from "$app/navigation";
|
||||
import type { MediaItem } from "$lib/api/types";
|
||||
import { auth } from "$lib/stores/auth";
|
||||
@@ -74,28 +74,28 @@
|
||||
async function handleSeekEnd() {
|
||||
seeking = false;
|
||||
seekPending = true; // Keep showing target position until backend catches up
|
||||
await invoke("player_seek", { position: seekValue });
|
||||
await commands.playerSeek(seekValue);
|
||||
}
|
||||
|
||||
// Control handlers for Controls component
|
||||
async function handlePlayPause() {
|
||||
await invoke("player_toggle");
|
||||
await commands.playerToggle();
|
||||
}
|
||||
|
||||
async function handlePrevious() {
|
||||
await invoke("player_previous");
|
||||
await commands.playerPrevious();
|
||||
}
|
||||
|
||||
async function handleNext() {
|
||||
await invoke("player_next");
|
||||
await commands.playerNext();
|
||||
}
|
||||
|
||||
async function handleToggleShuffle() {
|
||||
await invoke("player_toggle_shuffle");
|
||||
await commands.playerToggleShuffle();
|
||||
}
|
||||
|
||||
async function handleCycleRepeat() {
|
||||
await invoke("player_cycle_repeat");
|
||||
await commands.playerCycleRepeat();
|
||||
}
|
||||
|
||||
// Prefer album ID for artwork (all tracks in an album share the same cover)
|
||||
@@ -128,7 +128,7 @@
|
||||
async function handleQueueItemClick(index: number) {
|
||||
try {
|
||||
queue.skipTo(index);
|
||||
await invoke("player_skip_to", { index });
|
||||
await commands.playerSkipTo(index);
|
||||
} catch (e) {
|
||||
console.error("Failed to skip to queue item:", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user