Repository navigation
pitis/perch#24: Launch no longer checks copied files on the main thread, or in folders Perch can't read yet - #27
Merged
Conversation
Launch checked every saved clip's file on the main thread. A file copied from Documents or Downloads, before Perch had access there, could block on a macOS permission prompt and freeze the panel, the same way the Desktop did before. Pruning now runs in the background and never touches files in Desktop, Documents, Downloads or /Volumes unless that folder holds the screenshot folder Perch already watches. Those clips stay. QuickLook thumbnails are also requested off the main thread.
… on the main thread Clip.url no longer asks the disk whether a path is a folder, which the Clips page did on every redraw. The prune only drops files that are really gone, not ones macOS refused access to. Protected folders now include iCloud Drive and cloud storage, match regardless of case, and count each volume on its own. The prune runs again once the screenshot folder is known, and the drag fallback that never ran is gone.
Owner
Author
ReviewRan Fixed
Declined
Left for you (product decisions)
|
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.
Refs #24
This uses
Refs, notCloses, because the repo's rule is to close an issue only after the change has run on a real Mac, and this one hasn't yet (see Not done below).What changed
ClipsManager.load()no longer callsfileExistson the main thread. It sets the saved clips and callspruneMissing(), which now checks the files on a utility queue and removes the missing ones back on the main thread./Volumes(removable and network volumes). The only access Perch knows it has is the screenshot folder it's watching. If that folder is inside a protected folder, files there are checked as before, so deleted Desktop screenshots still disappear when screenshots are on. Other clips in protected folders stay, as the issue suggests. Opening one whose file is gone does nothing, and dragging it carries nothing instead of an empty piece of text.captureScreenshotsis on.ProtectedFolders.mayPromptinPerchCore, with tests.Why
Same freeze as #21, by another route. A file copied from
~/Documentsbefore Perch had Documents access was checked withfileExistson the main thread at launch. That check can block on a macOS permission prompt, and the notch freezes until the prompt is answered. If the user had denied access, the check came back false and the clip was silently pruned.How it was tested
make check: 45 tests pass, including 4 newProtectedFoldersTests. They didn't compile beforeProtectedFoldersexisted.swift buildbuilds with no warnings.make shots: no screen changes. Every pair matches except the clock: the Clips screen differs only in its 22:16 / 22:17 captions, and the other differing screens show times and countdowns this change doesn't touch. No before/after table is posted because nothing visible changed in the screens--snapshotcan render. The one behaviour a person could notice is that a clip for a deleted file in Documents, Downloads or Desktop (with screenshots off) now stays instead of disappearing. Sample data can't show that.Not done
openlaunch with Documents access revoked, and AGENTS.md says not to raise permission prompts on the user's machine from a session like this. After merge, this should be checked with those steps and get theverifylabel.Openand drag still touch the file on the main thread when the user asks for them, as before./pr-review-toolkit:review-prand/ponytail:ponytail-reviewwere run, and the fixes are in the review comment below. Two product questions are left open there.