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.

Show that a Duplicates scan was stopped, as every other page does

Țugui Dragoș57da98135cdd
diff --git a/Peel/Model/DuplicateLibrary.swift b/Peel/Model/DuplicateLibrary.swift
index 701a3eb9..c88ef811 100644
--- a/Peel/Model/DuplicateLibrary.swift
+++ b/Peel/Model/DuplicateLibrary.swift
@@ -34,6 +34,8 @@ final class DuplicateLibrary {
/// reports, or from the start when a kind is chosen, since folders are then not compared.
private(set) var isOnFiles = false
private(set) var isScanning = false
+ /// True when the last scan was stopped before it ended, so the page says so rather than offer a first scan.
+ private(set) var wasStopped = false
private(set) var isRemoving = false
var selection: DuplicateRow?
private(set) var selectedURLs: Set<URL> = []
@@ -129,6 +131,7 @@ final class DuplicateLibrary {
scanTask?.cancel()
generation += 1
progress = nil
+ if isScanning { wasStopped = true }
isScanning = false
}
@@ -158,6 +161,7 @@ final class DuplicateLibrary {
private func runScan(_ current: Int) async {
clearResults()
isScanning = true
+ wasStopped = false
progress = nil
isOnFiles = kind != .any
var options = DuplicateScanOptions(folders: folders)
diff --git a/Peel/Views/Duplicates/DuplicateList.swift b/Peel/Views/Duplicates/DuplicateList.swift
index 2e0aba58..7428f378 100644
--- a/Peel/Views/Duplicates/DuplicateList.swift
+++ b/Peel/Views/Duplicates/DuplicateList.swift
@@ -99,6 +99,9 @@ struct DuplicateList: View {
} else if duplicates.isScanning {
DuplicateScanProgressView()
.centeredOnColumn()
+ } else if duplicates.wasStopped {
+ StoppedScan()
+ .centeredOnColumn()
} else {
ContentUnavailableView {
Label("Find Duplicate Files", systemImage: "doc.on.doc")
diff --git a/Peel/Views/ScanState.swift b/Peel/Views/ScanState.swift
index cc3a794b..6a88effd 100644
--- a/Peel/Views/ScanState.swift
+++ b/Peel/Views/ScanState.swift
@@ -132,7 +132,7 @@ struct ReadSoFar: View {
/// What a page shows when its first scan was stopped. Scan Again runs the toolbar's Rescan command, so the two
/// always do the same thing.
-private struct StoppedScan: View {
+struct StoppedScan: View {
var body: some View {
ContentUnavailableView {
Label("Scan Stopped", systemImage: "xmark.circle")