Commit d378f42
committed
M5: Downloads notifications (toast + native, one bridge)
Adds the passive-nudge layer of the downloads watcher: when a file
lands in `~/Downloads`, fan out per the settings enum
`behavior.fileSystemWatching.downloadsNotifications` (`in-app | macos |
both | neither`, default `in-app`) to an in-app toast and/or a macOS
native notification.
- Add `tauri-plugin-notification` 2.3.3 (Rust + JS, both ≥14 days old
on crates.io / npmjs.com); wire the plugin into `lib.rs`; add
`notification:default` to `capabilities/default.json`.
- New `lib/downloads/event-bridge.svelte.ts`: one `download-detected`
listener mounted from `(main)/+page.svelte`. Reads the mode per event,
re-checks the FDA gate as defense in depth (the watcher already gates
on it), asks the OS for notification permission the first time the
macOS path is taken, surfaces a single INFO toast on denial without
flipping the user's setting.
- New `lib/downloads/DownloadToastContent.svelte`: title with filename
+ size, optional "in Downloads/<subdir>/" line, snapshotted shortcut
hint, "Jump to file" + "Stop showing these" actions, whole-body
mouse-clickable but not keyboard-focusable (the buttons own
keyboard activation independently).
- New `lib/downloads/notifications-mode.ts`: try/catch'd reader and
writer for the setting key, plus the Settings deep-link target. The
M7 registry entry isn't present yet; the wrapper safely falls back
to `'in-app'` until M7 lands.
- New `revealPath(explorer, dir, name)` in `reveal.ts`: navigate to a
SPECIFIC file's parent and select it, bypassing the latest-in-ring
lookup. The toast uses this so a burst of downloads each lands the
user on the file the toast was for, not whichever became "latest"
while they were reading.
- New `lib/downloads/CLAUDE.md` covering architecture, the four
dispatch branches, the snapshot-at-creation rule, the reveal-by-path
vs reveal-latest distinction, and the FDA defense-in-depth path.
- Vitest coverage: 7 behavior tests on the toast component (filename,
shortcut hint snapshotting, primary button calls reveal-by-path,
body-click also reveals, stop-propagation on buttons, mouse-only
click body), a tier-3 a11y test, and 9 bridge tests across all four
settings values plus the macOS permission grant/deny paths.1 parent 39e083b commit d378f42
15 files changed
Lines changed: 1168 additions & 8 deletions
File tree
- apps/desktop
- src-tauri
- capabilities
- src
- src
- lib/downloads
- routes/(main)
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| 303 | + | |
303 | 304 | | |
304 | 305 | | |
305 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
0 commit comments