Files
margin-mail/src/api/threads.ts
T
pj eb59cb5f8d build the app, and ship it on Linux and Windows as well as macOS
The client itself: the sync engine and mirror, the Gmail and IMAP providers,
the screener, the three boxes and two piles, compose and send, the sanitiser
and tracker stripping, contacts, clips, backup, notifications and the guide.

The pipeline that ships it. Three runners now build in parallel and the
publish gate wants all four platform keys in latest.json before a release
leaves draft. Linux gets two more packages Tauri does not build: a flatpak
repackaged from the deb against GNOME 48, and a Nix package that relinks the
deb against nixpkgs so it runs as a native Wayland client rather than through
Xwayland. CI runs the Rust suite on all three desktops rather than on Linux
alone, and rebuilds the flatpak manifest on every push to main.

Two things that were only ever exercised on macOS and were wrong everywhere
else. The menu bar was built by adjusting the submenus macOS is given, so on
a platform whose default menu has no File or View the new File menu landed
after Edit, Check for Updates landed nowhere, and the three places and the
reading pane had no menu at all. The deb declared libwebkit2gtk-4.1-0 and
libgtk-3-0 twice, because tauri.conf.json named the dependencies Tauri
already emits.

The updater key exists now, so releases can sign their artifacts.
2026-09-06 12:15:30 +05:30

67 lines
2.6 KiB
TypeScript

import {
call,
type FlagPatch,
type Pile,
type SnoozeKind,
type ThreadPage,
type ThreadQuery,
type ThreadView,
type Undo,
} from "../ipc";
export const threadsList = (query: ThreadQuery) => call<ThreadPage>("threads_list", { query });
export const threadView = (key: string) => call<ThreadView>("thread_view", { key });
/**
* Fetches the bodies `thread_view` came back without, and answers with how many arrived. The view
* is read again rather than patched from this, because what a message renders as is the mirror's
* answer and not this call's.
*/
export const threadHydrate = (key: string) => call<number>("thread_hydrate", { key });
/**
* Opening is what marks a thread seen, and this is the mirror being told. Nothing comes back: it
* is not a verb, it is not on the undo stack, and a thread already seen is a no-op on the far side.
*/
export const threadOpened = (key: string) => call<void>("thread_opened", { key });
/** Seen, starred, archived, trashed and spam are the provider's flags, so these go through it. */
export const flagsSet = (keys: string[], patch: FlagPatch) =>
call<Undo>("flags_set", { keys, patch });
export const markAllSeen = (accountId: string | null, place: string) =>
call<Undo>("mark_all_seen", { accountId, place });
/**
* The only bulk write to the provider the app ever proposes: mark everything older than a date as
* seen. Reversible for seven days, which is what the token is for.
*/
export const startFresh = (accountId: string, olderThanMs: number) =>
call<Undo>("start_fresh", { accountId, olderThanMs });
export const pileToggle = (keys: string[], pile: Pile) => call<Undo>("pile_toggle", { keys, pile });
export const snoozeSet = (keys: string[], kind: SnoozeKind, returnAtMs: number) =>
call<Undo>("snooze_set", { keys, kind, returnAtMs });
export const snoozeClear = (keys: string[]) => call<Undo>("snooze_clear", { keys });
/** Runs on open, on foreground and on wake. Returns the threads that came back. */
export const snoozeEvaluate = () => call<string[]>("snooze_evaluate");
export const threadRename = (key: string, name: string | null) =>
call<Undo>("thread_rename", { key, name });
/** The merged thread takes the first key in the list, which is also the one Unmerge undoes from. */
export const threadMerge = (keys: string[], name: string | null) =>
call<Undo>("thread_merge", { keys, name });
export const threadUnmerge = (key: string) => call<Undo>("thread_unmerge", { key });
export const threadIgnore = (keys: string[], on: boolean) =>
call<Undo>("thread_ignore", { keys, on });
export const threadNotify = (keys: string[], on: boolean) =>
call<Undo>("thread_notify", { keys, on });