mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-14 20:53:43 +01:00
The strip, quiet encrypted rows, warning rows for refused handshakes, the encrypted card with named actions, trust at the first Decrypt, the toast with Undo and Reconnect, the pill's Decrypt everything switch, Settings' Decryption section, the Encrypted sidebar row, and two-step setup. Both body tabs read Body with a type badge; Info leads the request half with the timeline folded in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
900 B
TypeScript
28 lines
900 B
TypeScript
import { useQueryClient } from "@tanstack/react-query";
|
|
import type {
|
|
DecryptList,
|
|
DecryptListChangedPayload,
|
|
DecryptListEntry,
|
|
} from "@yaakapp-internal/proxy-lib";
|
|
import { useCallback } from "react";
|
|
import { useRpcEvent } from "./useRpcEvent";
|
|
import { useRpcQuery } from "./useRpcQuery";
|
|
|
|
const KEY = ["get_decrypt_list", {}];
|
|
const EMPTY: DecryptListEntry[] = [];
|
|
|
|
/**
|
|
* The decrypt list's entries, empty until read. Kept current as this process changes it, from
|
|
* the app or through its control API.
|
|
*/
|
|
export function useDecryptList(): DecryptListEntry[] {
|
|
const queryClient = useQueryClient();
|
|
const onChanged = useCallback(
|
|
(payload: DecryptListChangedPayload) =>
|
|
queryClient.setQueryData<DecryptList>(KEY, payload.list),
|
|
[queryClient],
|
|
);
|
|
useRpcEvent("decrypt_list_changed", onChanged);
|
|
return useRpcQuery("get_decrypt_list", {}).data?.entries ?? EMPTY;
|
|
}
|