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.

Say when macOS is asking during a Duplicates scan, and judge an added folder apart

Țugui Dragoș9dd0e1c82086
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 1f1a3af2..f8eeaa96 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -203161,6 +203161,112 @@
}
}
},
+ "This counts every disk the copies are on." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tento údaj zahrnuje všechny disky, na kterých kopie jsou."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dies zählt jedes Volume mit, auf dem die Kopien liegen."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Esto incluye todos los discos en los que están las copias."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ce total inclut tous les disques où se trouvent les copies."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Questo totale comprende tutti i dischi su cui si trovano le copie."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "この合計には、コピーがあるすべてのディスクの分が含まれます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "복사본이 있는 모든 디스크를 합산한 값입니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dit telt elke schijf mee waarop de kopieën staan."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ta wartość obejmuje wszystkie dyski, na których są kopie."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Este valor inclui todos os discos em que as cópias estão."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Acest total include toate discurile pe care se află copiile."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Здесь учитываются все диски, на которых находятся копии."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Här räknas alla skivor som kopiorna ligger på."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Bu toplam, kopyaların bulunduğu tüm diskleri kapsar."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Тут враховано кожен диск, на якому лежать копії."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "此数字计入了副本所在的所有磁盘。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "此總計會計入副本所在的每個磁碟。"
+ }
+ }
+ }
+ },
"This driver is Intel only. On this Intel Mac it runs natively." : {
"localizations" : {
"cs" : {
diff --git a/Peel/Model/DuplicateLibrary.swift b/Peel/Model/DuplicateLibrary.swift
index a8072a0e..3e1839ee 100644
--- a/Peel/Model/DuplicateLibrary.swift
+++ b/Peel/Model/DuplicateLibrary.swift
@@ -93,10 +93,13 @@ final class DuplicateLibrary {
}
/// Adds the folders Peel can scan and returns the others, each with why.
- func add(_ urls: [URL]) -> [DuplicateScan.FolderSetAside] {
+ func add(_ urls: [URL]) async -> [DuplicateScan.FolderSetAside] {
+ let finder = finder
+ // Off the main actor, as `reasonToSetAside`: a folder on a network volume can be slow to answer.
+ let judged = await Task.detached { urls.map { (url: $0, reason: finder.refusal(of: $0)) } }.value
var refused: [DuplicateScan.FolderSetAside] = []
- for url in urls {
- if let reason = finder.refusal(of: url) {
+ for (url, reason) in judged {
+ if let reason {
refused.append(DuplicateScan.FolderSetAside(url: url, reason: reason))
} else if !folders.contains(url) {
folders.append(url)
diff --git a/Peel/Views/Duplicates/DuplicateGroupView.swift b/Peel/Views/Duplicates/DuplicateGroupView.swift
index 69bfb57c..c6b3d97c 100644
--- a/Peel/Views/Duplicates/DuplicateGroupView.swift
+++ b/Peel/Views/Duplicates/DuplicateGroupView.swift
@@ -81,6 +81,7 @@ struct DuplicateGroupView: View {
Spacer(minLength: 8)
// The selection's total, not the group's, so the figure changes as the user selects or deselects copies.
DuplicateSelectedTotal(bytes: duplicates.selectedSize(in: group))
+ .help(group.isOnSeveralDisks ? Text("This counts every disk the copies are on.") : Text(verbatim: ""))
}
.padding(.vertical, 8)
}
diff --git a/Peel/Views/Duplicates/DuplicateScanForm.swift b/Peel/Views/Duplicates/DuplicateScanForm.swift
index e6eac92d..20d799d3 100644
--- a/Peel/Views/Duplicates/DuplicateScanForm.swift
+++ b/Peel/Views/Duplicates/DuplicateScanForm.swift
@@ -71,7 +71,7 @@ struct DuplicateScanForm: View {
allowsMultipleSelection: true
) { result in
guard case .success(let urls) = result else { return }
- rejectedFolders = duplicates.add(urls)
+ Task { rejectedFolders = await duplicates.add(urls) }
}
.alert(
rejectedFolders.count == 1 ? "Peel can’t look for duplicates in this folder." : "Peel can’t look for duplicates in these folders.",
diff --git a/Peel/Views/Duplicates/DuplicateStatusViews.swift b/Peel/Views/Duplicates/DuplicateStatusViews.swift
index 82b51a80..c2186c59 100644
--- a/Peel/Views/Duplicates/DuplicateStatusViews.swift
+++ b/Peel/Views/Duplicates/DuplicateStatusViews.swift
@@ -6,6 +6,7 @@ struct DuplicateScanProgressView: View {
/// Read here rather than in `ContentView`, the parent view. Progress changes many times a second during a
/// scan, and reading it there would re-run `ContentView`'s body, which builds the whole window, on every change.
@Environment(DuplicateLibrary.self) private var duplicates
+ @Environment(HomeModel.self) private var home
private var progress: DuplicateScanProgress? { duplicates.progress }
@@ -17,9 +18,18 @@ struct DuplicateScanProgressView: View {
.progressViewStyle(.linear)
Text(headline)
.font(.headline)
- count
- .foregroundStyle(.secondary)
- .monospacedDigit()
+ if AppDataQuestion.isAsked(
+ frontmost: FrontmostApp.shared.bundleIdentifier,
+ hasFullDiskAccess: home.states[.fullDiskAccess] == .on
+ ) {
+ Text("macOS is asking whether Peel may access some of your files. The scan continues once you answer.")
+ .foregroundStyle(.secondary)
+ .multilineTextAlignment(.center)
+ } else {
+ count
+ .foregroundStyle(.secondary)
+ .monospacedDigit()
+ }
if duplicates.kind == .any {
Text("Step \(duplicates.isOnFiles ? 2 : 1) of \(2)")
.font(.caption)