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,7 +1,8 @@
|
||||
<!-- TRACES: UR-023 | DR-048 -->
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { commands } from "$lib/api/bindings";
|
||||
import type { AudioSettings, VideoSettings, VolumeLevel } from "$lib/api/bindings";
|
||||
import {
|
||||
getCacheStats,
|
||||
setCacheLimit,
|
||||
@@ -12,21 +13,6 @@
|
||||
type ImageCacheStats,
|
||||
} from "$lib/services/imageCache";
|
||||
|
||||
type VolumeLevel = "loud" | "normal" | "quiet";
|
||||
|
||||
interface AudioSettings {
|
||||
crossfadeDuration: number;
|
||||
gaplessPlayback: boolean;
|
||||
normalizeVolume: boolean;
|
||||
volumeLevel: VolumeLevel;
|
||||
}
|
||||
|
||||
interface VideoSettings {
|
||||
autoPlayNextEpisode: boolean;
|
||||
autoPlayCountdownSeconds: number;
|
||||
autoPlayMaxEpisodes: number;
|
||||
}
|
||||
|
||||
const episodeLimitOptions = [
|
||||
{ value: 0, label: "Unlimited" },
|
||||
{ value: 1, label: "1" },
|
||||
@@ -75,8 +61,8 @@
|
||||
try {
|
||||
loading = true;
|
||||
const [audioResult, videoResult] = await Promise.all([
|
||||
invoke<AudioSettings>("player_get_audio_settings"),
|
||||
invoke<VideoSettings>("player_get_video_settings"),
|
||||
commands.playerGetAudioSettings(),
|
||||
commands.playerGetVideoSettings(),
|
||||
]);
|
||||
settings = audioResult;
|
||||
videoSettings = videoResult;
|
||||
@@ -142,8 +128,8 @@
|
||||
saving = true;
|
||||
saveMessage = "";
|
||||
await Promise.all([
|
||||
invoke("player_set_audio_settings", { settings }),
|
||||
invoke("player_set_video_settings", { settings: videoSettings }),
|
||||
commands.playerSetAudioSettings(settings),
|
||||
commands.playerSetVideoSettings(videoSettings),
|
||||
]);
|
||||
saveMessage = "Settings saved successfully!";
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user