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
Keep a click on a removal option from rebuilding the whole page
Țugui Dragoșcc7fefdfa76f
diff --git a/Peel/Model/BulkRemovalPlan.swift b/Peel/Model/BulkRemovalPlan.swiftindex df7d48d6..1cb83442 100644--- a/Peel/Model/BulkRemovalPlan.swift+++ b/Peel/Model/BulkRemovalPlan.swift@@ -14,6 +14,9 @@ final class BulkRemovalPlan {/// The question before a removal, and the removal it starts.let question = RemovalQuestion()var isRemoving: Bool { question.isRemoving }+ /// The options of the removal, kept here rather than in the page, so a click updates only the option's own row.+ var resetsPrivacy = false+ var removesDockTiles = true/// Every installed app as of the last scan, to tell a chosen app's processes from another installed app's.private var installedApps: [InstalledApp] = []var selectedURLs: Set<URL> = [] {diff --git a/Peel/Model/RemovalPlan.swift b/Peel/Model/RemovalPlan.swiftindex 13d93cbd..5dd9f94f 100644--- a/Peel/Model/RemovalPlan.swift+++ b/Peel/Model/RemovalPlan.swift@@ -13,6 +13,9 @@ final class RemovalPlan {/// The question before a removal, and the removal it starts.let question = RemovalQuestion()var isRemoving: Bool { question.isRemoving }+ /// The options of the removal, kept here rather than in the page, so a click updates only the option's own row.+ var resetsPrivacy = false+ var removesDockTile = true/// The kinds of files and links this app opens by default, so the page can say which app opens them once/// it is gone.private(set) var defaultRoles: [DefaultRole] = []diff --git a/Peel/Views/AppDetailView.swift b/Peel/Views/AppDetailView.swiftindex cbb757cf..17df3585 100644--- a/Peel/Views/AppDetailView.swift+++ b/Peel/Views/AppDetailView.swift@@ -11,9 +11,7 @@ struct AppDetailView: View {@State private var quitting = QuitBeforeRemoving()@Environment(RemovalOutcome.self) private var outcome@State private var isRescanning = false- @State private var resetsPrivacy = false@State private var progress = MoveProgress()- @State private var removesDockTile = true@State private var isConfirmingPrivacyReset = false/// The result of the last privacy reset started from the More menu, shown under the buttons.@State private var privacyReset: PrivacyReset.Result?@@ -180,12 +178,7 @@ struct AppDetailView: View {recommendedSectionreviewSection- if !PrivacyReset.apps(among: [plan.app], moving: plan.selectable).isEmpty {- PrivacyResetRow(isOn: $resetsPrivacy, detail: PrivacyResetRow.beforeTheMove)- }- if plan.hasDockTile, plan.selectable.contains(plan.app.url) {- DockTileRow(isOn: $removesDockTile)- }+ AppRemovalOptions(plan: plan)defaultsSectionPackageReceiptSection(plan: plan, rescan: rescan)}@@ -427,7 +420,8 @@ struct AppDetailView: View {/// The app, when a removal of `urls` resets its privacy permissions.private func resetting(_ urls: Set<URL>) -> [InstalledApp] {- resetsPrivacy ? PrivacyReset.apps(among: [plan.app], moving: urls) : []+ guard !urls.isEmpty, plan.resetsPrivacy else { return [] }+ return PrivacyReset.apps(among: [plan.app], moving: urls)}/// The confirmation's message: the privacy reset, which History can't undo, an app that uninstalls itself once@@ -486,7 +480,7 @@ struct AppDetailView: View {let result = await plan.move(request)let keptItsFiles = plan.uninstallation?.keptItsFiles(after: result, selection: request.urls) == trueoutcome.report(result, privacy: privacy, keptTheirFiles: keptItsFiles ? [plan.app.name] : [])- if removesDockTile, result.trashed.contains(where: { $0.originalURL == plan.app.url }) {+ if plan.removesDockTile, result.trashed.contains(where: { $0.originalURL == plan.app.url }) {_ = await DockTiles().takeOut([plan.app.url])}if let state = AppManagement.state(@@ -513,3 +507,18 @@ struct AppDetailView: View {}}}++/// The options of the app's removal, in a view of their own: a binding reads its value where it is made, so one made+/// in the page's body would build the whole page again with every click.+private struct AppRemovalOptions: View {+ let plan: RemovalPlan++ var body: some View {+ if !PrivacyReset.apps(among: [plan.app], moving: plan.selectable).isEmpty {+ PrivacyResetRow(isOn: Bindable(plan).resetsPrivacy, detail: PrivacyResetRow.beforeTheMove)+ }+ if plan.hasDockTile, plan.selectable.contains(plan.app.url) {+ DockTileRow(isOn: Bindable(plan).removesDockTile)+ }+ }+}diff --git a/Peel/Views/MultipleAppsView.swift b/Peel/Views/MultipleAppsView.swiftindex f3b16428..ccbe2fda 100644--- a/Peel/Views/MultipleAppsView.swift+++ b/Peel/Views/MultipleAppsView.swift@@ -9,9 +9,7 @@ struct MultipleAppsView: View {@Environment(HomebrewLibrary.self) private var homebrew@State private var plan: BulkRemovalPlan@State private var quitting = QuitBeforeRemoving()- @State private var resetsPrivacy = false@State private var progress = MoveProgress()- @State private var removesDockTiles = true@State private var isRescanning = false@State private var questionTitle = Text(verbatim: "")@State private var questionNote = Text(verbatim: "")@@ -37,12 +35,7 @@ struct MultipleAppsView: View {HelperRequiredBanner()}// Here, above the lists, so they are seen before Move to Trash however long the lists run.- if !PrivacyReset.apps(among: plan.apps, moving: plan.selectable).isEmpty {- PrivacyResetRow(isOn: $resetsPrivacy, detail: PrivacyResetRow.beforeTheMove)- }- if !plan.appsInTheDock.isDisjoint(with: plan.selectable) {- DockTileRow(isOn: $removesDockTiles)- }+ BulkRemovalOptions(plan: plan)Section {RemovalColumnHeaders()@@ -318,7 +311,8 @@ struct MultipleAppsView: View {/// The apps whose privacy permissions a removal of `urls` resets.private func resetting(_ urls: Set<URL>) -> [InstalledApp] {- resetsPrivacy ? PrivacyReset.apps(among: plan.apps, moving: urls) : []+ guard !urls.isEmpty, plan.resetsPrivacy else { return [] }+ return PrivacyReset.apps(among: plan.apps, moving: urls)}/// Asks the question once the apps have quit, since none of their files moves while they run, and after scanning@@ -356,7 +350,7 @@ struct MultipleAppsView: View {let result = await plan.move(request)let kept = plan.bulk?.appsThatKeptTheirFiles(after: result, selection: request.urls) ?? []outcome.report(result, privacy: privacy, keptTheirFiles: kept.map(\.name))- if removesDockTiles {+ if plan.removesDockTiles {let moved = Set(result.trashed.map(\.originalURL))// Asked of every app that moved, since one opened after the last scan has a tile now.let apps = plan.apps.map(\.url).filter(moved.contains).sorted { $0.path < $1.path }@@ -407,3 +401,18 @@ private struct AppStack: View {.accessibilityHidden(true)}}++/// The options of the apps' removal, in a view of their own: a binding reads its value where it is made, so one made+/// in the page's body would build the whole page, every row of its lists, again with every click.+private struct BulkRemovalOptions: View {+ let plan: BulkRemovalPlan++ var body: some View {+ if !PrivacyReset.apps(among: plan.apps, moving: plan.selectable).isEmpty {+ PrivacyResetRow(isOn: Bindable(plan).resetsPrivacy, detail: PrivacyResetRow.beforeTheMove)+ }+ if !plan.appsInTheDock.isDisjoint(with: plan.selectable) {+ DockTileRow(isOn: Bindable(plan).removesDockTiles)+ }+ }+}