Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Let iCloud Drive free downloads while History can't be read
Țugui Dragoș628d5bd91834
diff --git a/Peel/Views/Cloud/CloudView.swift b/Peel/Views/Cloud/CloudView.swiftindex 6efa6c2b..4874a3e5 100644--- a/Peel/Views/Cloud/CloudView.swift+++ b/Peel/Views/Cloud/CloudView.swift@@ -24,7 +24,7 @@ struct CloudView: View {List {header.listRowSeparator(.hidden)- RemovalsHeldBanner()+ RemovalsHeldBanner(recordsInHistory: false)if !cloud.refusals.isEmpty {Section {@@ -161,7 +161,8 @@ struct CloudView: View {title: "Remove Downloads",systemImage: "icloud.and.arrow.down",notice: freed,- removal: (cloud.freeing, cloud.stopFreeing)+ removal: (cloud.freeing, cloud.stopFreeing),+ recordsInHistory: false)} else {RemovalBar(@@ -173,7 +174,8 @@ struct CloudView: View {onRemove: { isConfirming = true },title: "Remove Downloads",systemImage: "icloud.and.arrow.down",- notice: freed+ notice: freed,+ recordsInHistory: false)}}diff --git a/Peel/Views/RemovalBar.swift b/Peel/Views/RemovalBar.swiftindex 6462da1b..950e15b3 100644--- a/Peel/Views/RemovalBar.swift+++ b/Peel/Views/RemovalBar.swift@@ -3,6 +3,7 @@ import SwiftUIstruct RemovalBar: View {@Environment(RemovalHistoryStore.self) private var history+ @Environment(ExclusionsStore.self) private var exclusions@Environment(SelectionCarrier.self) private var carrier/// What the last removal moved while this bar was on screen, shown briefly in place of the selection.@State private var moved: RemovalBatch?@@ -37,6 +38,9 @@ struct RemovalBar: View {var waitingToQuit: String?/// iCloud Drive's Remove Downloads: on macOS 27 the spinner says how far it got, and the button stops it.var removal: (progress: MoveProgress, stop: () -> Void)?+ /// False for an action History doesn't record, such as freeing iCloud downloads: it then waits only for the+ /// exclusions, and the bar never shows what History just moved.+ var recordsInHistory = trueprivate enum Purpose {/// What the page itself selected, which `onRemove` acts on.@@ -70,7 +74,8 @@ struct RemovalBar: View {notice: BarNotice? = nil,progress: MoveProgress? = nil,waitingToQuit: String? = nil,- removal: (progress: MoveProgress, stop: () -> Void)? = nil+ removal: (progress: MoveProgress, stop: () -> Void)? = nil,+ recordsInHistory: Bool = true) {purpose = .own(SizeTotal(known: selectedSize, isComplete: isSelectionMeasured),@@ -86,6 +91,7 @@ struct RemovalBar: View {self.progress = progressself.waitingToQuit = waitingToQuitself.removal = removal+ self.recordsInHistory = recordsInHistory}/// A bar for a page of the storage tools, whose selection travels to the others' pages.@@ -131,9 +137,15 @@ struct RemovalBar: View {}}+ static func mayAct(recordsInHistory: Bool, history: RemovalHistoryStore, exclusionsAreKnown: Bool) -> Bool {+ recordsInHistory ? history.mayMove : exclusionsAreKnown+ }+var body: some View {let reading = reading- let isEnabled = reading.isEnabled && history.mayMove+ let isEnabled = reading.isEnabled && Self.mayAct(+ recordsInHistory: recordsInHistory, history: history, exclusionsAreKnown: exclusions.exclusions.isKnown+ )BusyShown(isBusy: moving?.isMoving == true) { isShowingMove inBusyShown(isBusy: waitingToQuit != nil) { isShowingWait inBusyShown(isBusy: isScanning) { isShowingScan in@@ -230,7 +242,7 @@ struct RemovalBar: View {if let names { waitingNames = names }}.onChange(of: history.justMoved) { _, batch in- moved = batch+ if recordsInHistory { moved = batch }}.task(id: moved) {guard moved != nil else { return }diff --git a/Peel/Views/RemovalsHeldBanner.swift b/Peel/Views/RemovalsHeldBanner.swiftindex 9a125659..ef6d7b04 100644--- a/Peel/Views/RemovalsHeldBanner.swift+++ b/Peel/Views/RemovalsHeldBanner.swift@@ -8,17 +8,22 @@ enum MovesHeld: Equatable {case historyUnreadablecase historyUnwritable- static func reason(exclusionsUnreadable: Bool, historyUnreadable: Bool, historyUnwritable: Bool) -> MovesHeld? {+ static func reason(+ exclusionsUnreadable: Bool, historyUnreadable: Bool, historyUnwritable: Bool, recordsInHistory: Bool = true+ ) -> MovesHeld? {if exclusionsUnreadable { return .exclusionsUnreadable }+ guard recordsInHistory else { return nil }if historyUnreadable { return .historyUnreadable }return historyUnwritable ? .historyUnwritable : nil}@MainActor- static func reason(exclusions: ExclusionsStore, history: RemovalHistoryStore) -> MovesHeld? {+ static func reason(+ exclusions: ExclusionsStore, history: RemovalHistoryStore, recordsInHistory: Bool = true+ ) -> MovesHeld? {reason(exclusionsUnreadable: exclusions.exclusions.isUnreadable, historyUnreadable: history.isUnreadable,- historyUnwritable: history.cannotBeWritten+ historyUnwritable: history.cannotBeWritten, recordsInHistory: recordsInHistory)}}@@ -31,9 +36,11 @@ struct RemovalsHeldBanner: View {@Environment(\.openSettings) private var openSettings/// On History's own page, whose list says it with Start Over beside it, History is left unsaid here.var isOnHistoryPage = false+ /// False on a page whose action History doesn't record, which only the exclusions hold back.+ var recordsInHistory = truevar body: some View {- let held = MovesHeld.reason(exclusions: exclusions, history: history)+ let held = MovesHeld.reason(exclusions: exclusions, history: history, recordsInHistory: recordsInHistory)if held == .exclusionsUnreadable {Notice(title: Text("Peel couldn’t read your exclusions"),diff --git a/PeelTests/MovesHeldTests.swift b/PeelTests/MovesHeldTests.swiftindex a8b85ee4..1e62614b 100644--- a/PeelTests/MovesHeldTests.swift+++ b/PeelTests/MovesHeldTests.swift@@ -12,4 +12,17 @@ struct MovesHeldTests {#expect(reason(false, true, true) == .historyUnreadable)#expect(reason(false, false, true) == .historyUnwritable)}++ @Test func anActionHistoryDoesntRecordWaitsOnlyForTheExclusions() {+ func reason(_ exclusions: Bool, _ history: Bool, _ writing: Bool) -> MovesHeld? {+ MovesHeld.reason(+ exclusionsUnreadable: exclusions, historyUnreadable: history, historyUnwritable: writing,+ recordsInHistory: false+ )+ }++ #expect(reason(false, true, false) == nil)+ #expect(reason(false, false, true) == nil)+ #expect(reason(true, true, true) == .exclusionsUnreadable)+ }}diff --git a/PeelTests/RemovalBarTests.swift b/PeelTests/RemovalBarTests.swiftindex 96510827..29c30ffa 100644--- a/PeelTests/RemovalBarTests.swift+++ b/PeelTests/RemovalBarTests.swift@@ -25,4 +25,21 @@ struct RemovalBarTests {#expect(lines.last?.contains("76") == true, "\(lines.last ?? "")")#expect(RemovalBar.lines(for: parts(most)).count == most)}++ @Test func anActionHistoryDoesntRecordWaitsOnlyForTheExclusions() throws {+ let folder = FileManager.default.temporaryDirectory.appending(path: "PeelTests-\(UUID().uuidString)")+ let unreadable = folder.appending(path: "removals.json")+ try FileManager.default.createDirectory(at: unreadable, withIntermediateDirectories: true)+ defer { try? FileManager.default.removeItem(at: folder) }+ let history = RemovalHistoryStore(+ log: RemovalLog(url: unreadable), refusals: RefusalLog(url: folder.appending(path: "refusals.json")),+ knowsTheExclusions: { true }+ )+ history.checkReadability()+ #expect(history.isUnreadable)++ #expect(RemovalBar.mayAct(recordsInHistory: false, history: history, exclusionsAreKnown: true))+ #expect(!RemovalBar.mayAct(recordsInHistory: false, history: history, exclusionsAreKnown: false))+ #expect(!RemovalBar.mayAct(recordsInHistory: true, history: history, exclusionsAreKnown: true))+ }}