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.

History shows it is reading instead of an empty state

Țugui Dragoșf0c447a6acbc
diff --git a/Peel/Model/RemovalHistoryStore.swift b/Peel/Model/RemovalHistoryStore.swift
index cc48a330..1d38b0ad 100644
--- a/Peel/Model/RemovalHistoryStore.swift
+++ b/Peel/Model/RemovalHistoryStore.swift
@@ -106,7 +106,7 @@ final class RemovalHistoryStore {
/// The records grouped into batches. Worked out once when the records change, because the list reads this
/// several times per render.
private(set) var batches: [RemovalBatch] = []
- /// Whether the log has been read at all, so an empty list is not taken for an empty History.
+ /// Whether the log and the refusals have been read at all, so an empty list is not taken for an empty History.
private(set) var hasLoaded = false
/// What a search looks through, built once with the batches rather than walked on every keystroke.
private(set) var searchKeys: [RemovalBatch.ID: String] = [:]
@@ -142,6 +142,7 @@ final class RemovalHistoryStore {
func load() async {
apply(await log.load())
await loadRefusals()
+ hasLoaded = true
}
/// The problem History's page shows: that History cannot be read, as soon as that is known, otherwise what the
@@ -250,7 +251,6 @@ final class RemovalHistoryStore {
}
problem = outcome.problem
checkReadability()
- hasLoaded = true
}
func restore(_ records: [RemovalRecord], canUseHelper: Bool) async {
diff --git a/Peel/Views/History/HistoryList.swift b/Peel/Views/History/HistoryList.swift
index 084a40f9..5b4a4ba5 100644
--- a/Peel/Views/History/HistoryList.swift
+++ b/Peel/Views/History/HistoryList.swift
@@ -54,13 +54,15 @@ struct HistoryList: View {
.motion(.settle, .movement, value: history.shownProblem != nil)
}
.overlay {
- if history.batches.isEmpty, history.refusalBatches.isEmpty, history.hasLoaded {
+ if !history.hasLoaded {
+ ProgressView()
+ } else if history.batches.isEmpty, history.refusalBatches.isEmpty {
ContentUnavailableView(
"Nothing Removed Yet",
systemImage: "clock.arrow.circlepath",
description: Text("What you move to the Trash with Peel shows up here, and can be put back while it’s still in the Trash.")
)
- } else if listed.isEmpty, refused.isEmpty {
+ } else if listed.isEmpty, refused.isEmpty, !searchText.isEmpty {
ContentUnavailableView.search(text: searchText)
}
}