feat(email): on-demand attachment download, search clear, per-category read prefs

- Download search-result attachments on demand before opening (fixes Linux
  where xdg-open reports success on a missing file so the old open-then-
  download fallback never fired)
- Add a clear button to the search box that dismisses search and returns to
  the inbox
- Remove the read toggle from the Important section
- Replace the Everything else "Read" toggle with a "Mark as read" preference:
  turning it on marks all current and future "Everything else" mail read;
  turning it off only stops auto-reading future mail, leaving current threads
  untouched
This commit is contained in:
hrsvrn 2026-07-01 23:51:08 +05:30
parent ab9bce6203
commit 063f6892a8
7 changed files with 269 additions and 50 deletions

View file

@ -107,6 +107,10 @@ export const GmailAttachmentSchema = z.object({
mimeType: z.string().optional(),
sizeBytes: z.number().int().nonnegative().optional(),
savedPath: z.string(),
// Gmail identifiers used to fetch the attachment on demand when it hasn't
// been downloaded to disk yet (e.g. attachments on search results).
messageId: z.string().optional(),
attachmentId: z.string().optional(),
});
export type GmailAttachment = z.infer<typeof GmailAttachmentSchema>;

View file

@ -292,6 +292,22 @@ const ipcSchemas = {
req: z.object({ section: z.enum(['important', 'other']), read: z.boolean() }),
res: z.object({ ok: z.boolean(), count: z.number().int().nonnegative(), error: z.string().optional() }),
},
'gmail:downloadAttachment': {
req: z.object({
messageId: z.string().min(1),
savedPath: z.string().min(1),
attachmentId: z.string().optional(),
}),
res: z.object({ ok: z.boolean(), error: z.string().optional() }),
},
'gmail:getAutoReadEverythingElse': {
req: z.object({}),
res: z.object({ enabled: z.boolean() }),
},
'gmail:setAutoReadEverythingElse': {
req: z.object({ enabled: z.boolean() }),
res: z.object({}),
},
'gmail:saveMessageHeight': {
req: z.object({
threadId: z.string().min(1),