Add Open Recent submenu to File menu#82
Merged
Merged
Conversation
macOS convention for non-document apps: a File > Open Recent submenu that lists recently-scanned folder paths so users can re-launch a scan without reaching for the sidebar. Submenu items route through `store.scanRecentPath(_:)`, which preserves the existing security-scoped re-grant flow — if the folder's bookmark has expired, the user is asked to re-pick the folder instead of silently failing. Implementation: - AppDelegate conforms to NSMenuDelegate; the submenu's delegate is set to self - `recentScansSubmenu` stored property is populated on first build, rebuilt in-place on each `menuNeedsUpdate(_:)` call (cheap — bounded by RecentsStore.maxEntries = 8) - validateMenuItem gates scanRecentFromMenu on `!store.isScanning` (mid-scan disabled, matching the sidebar's existing scan-gated behavior) - Empty state shows a disabled "No Recent Scans" placeholder item - "Clear Menu" item calls clearRecentScansMenu which loops forget(path:) per entry (RecentsStore doesn't expose a clearAll API; the loop is bounded and rarely-used) Co-Authored-By: NCode <noreply@noumena.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
macOS convention for non-document apps: a
File > Open Recentsubmenu that lists recently-scanned folder paths so users can re-launch a scan without reaching for the sidebar.Submenu items route through the existing
store.scanRecentPath(_:)API, which preserves the security-scoped re-grant flow — if a folder's bookmark has expired, the user is asked to re-pick the folder instead of silently failing.Implementation
AppDelegateconforms toNSMenuDelegate; submenu's delegate set to selfrecentScansSubmenustored property rebuilt in-place on eachmenuNeedsUpdate(_:)call (cheap — bounded byRecentsStore.maxEntries = 8)validateMenuItemgatesscanRecentFromMenuon!store.isScanning(mid-scan disabled, matching the sidebar's existing scan-gated behavior)clearRecentScansMenu, which loopsforget(path:)per entryTest plan
swift test(54 tests in 5 suites pass)swift buildsucceeds./script/public_upload_audit.shpassesTest plan (visual E2E)
Manual: launch via
bash ./script/build_and_run.sh, scan a folder, then open File > Open Recent — verify the path appears, click it, scan re-launches.🤖 Generated with NCode