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
Show Space's Developer notice with the plan, not seconds after it
Țugui Dragoșba3b69ca2241
diff --git a/Peel/Views/Space/SpaceDetailView.swift b/Peel/Views/Space/SpaceDetailView.swiftindex 742d2135..5ae6e6a3 100644--- a/Peel/Views/Space/SpaceDetailView.swift+++ b/Peel/Views/Space/SpaceDetailView.swift@@ -24,8 +24,8 @@ struct SpaceDetailView: View {if let plan, plan.removable.contains(where: { plan.isLocked($0, canUseHelper: helper.canAct) }) {HelperRequiredBanner()}- if !item.isReadOnly, let plan, !plan.leftToDeveloper.isEmpty, let sizes = plan.developerSizes {- developerNotice(plan, sizes: sizes)+ if !item.isReadOnly, let plan, Self.showsDeveloperNotice(for: plan) {+ developerNotice(plan, sizes: plan.developerSizes ?? [:]).listRowSeparator(.hidden)}@@ -176,6 +176,11 @@ struct SpaceDetailView: View {}}+ /// The notice comes with the plan, without its figures until they are measured, so it never pushes the rows down.+ static func showsDeveloperNotice(for plan: SpaceRemoval.Plan) -> Bool {+ !plan.leftToDeveloper.isEmpty+ }+/// Why the area's size in the list is more than this page can move, and where the rest is freed.private func developerNotice(_ plan: SpaceRemoval.Plan, sizes: [URL: Int64]) -> some View {let folders = plan.leftToDeveloperdiff --git a/PeelTests/DeveloperNoticeTests.swift b/PeelTests/DeveloperNoticeTests.swiftnew file mode 100644index 00000000..45968cd7--- /dev/null+++ b/PeelTests/DeveloperNoticeTests.swift@@ -0,0 +1,21 @@+import Foundation+@testable import Peel+@testable import PeelCore+import Testing++@MainActor+struct DeveloperNoticeTests {+ @Test func theNoticeComesWithThePlanBeforeItsSizesAreMeasured() {+ let caches = URL(filePath: "/Users/someone/Library/Caches", directoryHint: .isDirectory)+ var plan = SpaceRemoval.Plan(+ removable: [caches.appending(path: "org.example.app")], inUse: [],+ leftToDeveloper: [caches.appending(path: "Homebrew")], sizes: [:]+ )++ #expect(SpaceDetailView.showsDeveloperNotice(for: plan))+ plan.developerSizes = [caches.appending(path: "Homebrew"): 1]+ #expect(SpaceDetailView.showsDeveloperNotice(for: plan))+ let nothingLeft = SpaceRemoval.Plan(removable: [], inUse: [], leftToDeveloper: [], sizes: [:])+ #expect(!SpaceDetailView.showsDeveloperNotice(for: nothingLeft))+ }+}