Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Look again once the apps have quit, before asking to move their files

Țugui Dragoș94a9cc30a83d
diff --git a/Peel/Views/AppDetailView.swift b/Peel/Views/AppDetailView.swift
index 1ad74620..3bae28e0 100644
--- a/Peel/Views/AppDetailView.swift
+++ b/Peel/Views/AppDetailView.swift
@@ -446,10 +446,20 @@ struct AppDetailView: View {
return lines.dropFirst().reduce(first) { Text("\($0)\n\n\($1)") }
}
- /// Asks the question once the app has quit, since none of its files moves while it runs.
+ /// Asks the question once the app has quit, since none of its files moves while it runs, and after scanning again
+ /// if it had to quit: what it wrote until then was not there when the page scanned.
private func requestRemoval() {
let plan = plan
- quitting.check(plan.runningProcesses) { plan.question.ask(plan.request) }
+ let running = plan.runningProcesses
+ quitting.check(running) {
+ Task {
+ if !running.isEmpty {
+ await rescan()
+ guard !plan.scanRun.wasStopped else { return }
+ }
+ plan.question.ask(plan.request)
+ }
+ }
}
/// Quitting the app before removing it, or only its files when it stays.
diff --git a/Peel/Views/MultipleAppsView.swift b/Peel/Views/MultipleAppsView.swift
index 2ac24a74..f28fb786 100644
--- a/Peel/Views/MultipleAppsView.swift
+++ b/Peel/Views/MultipleAppsView.swift
@@ -326,16 +326,23 @@ struct MultipleAppsView: View {
resetsPrivacy ? PrivacyReset.apps(among: plan.apps, moving: urls) : []
}
- /// Asks the question once the apps have quit, since none of their files moves while they run. Its words are
- /// worked out here, once, rather than with every change of the page: the note compares every chosen app with
- /// every other.
+ /// Asks the question once the apps have quit, since none of their files moves while they run, and after scanning
+ /// again if any had to quit: what they wrote until then was not there when the page scanned. Its words are worked
+ /// out here, once, rather than with every change of the page: the note compares every chosen app with every other.
private func requestRemoval() {
let plan = plan
- quitting.check(plan.runningProcesses) {
- let request = plan.request
- questionTitle = Text.movingToTrash(request.urls.count, request.total)
- questionNote = note(about: request.urls)
- plan.question.ask(request)
+ let running = plan.runningProcesses
+ quitting.check(running) {
+ Task {
+ if !running.isEmpty {
+ await rescan()
+ guard !plan.scanRun.wasStopped else { return }
+ }
+ let request = plan.request
+ questionTitle = Text.movingToTrash(request.urls.count, request.total)
+ questionNote = note(about: request.urls)
+ plan.question.ask(request)
+ }
}
}