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.

Read an app's Dock icon and default roles in the page's scan

Țugui Dragoș365813634fd9
diff --git a/Peel/Model/BulkRemovalPlan.swift b/Peel/Model/BulkRemovalPlan.swift
index 241188aa..98c8faa3 100644
--- a/Peel/Model/BulkRemovalPlan.swift
+++ b/Peel/Model/BulkRemovalPlan.swift
@@ -112,15 +112,16 @@ final class BulkRemovalPlan {
) async {
self.canUseHelper = canUseHelper
let apps = apps
- guard let (result, revision) = await scanRun.run({
+ guard let (result, revision, inTheDock) = await scanRun.run({
let revision = ExclusionsStore.shared.revision
+ async let inTheDock = DockTiles().holding(apps.map(\.url))
return (await BulkUninstallation.prepare(
apps,
installedApps: installedApps,
exclusions: ExclusionsStore.shared.exclusions,
casks: casks,
receipts: receipts
- ), revision)
+ ), revision, await inTheDock)
}) else { return }
bulk = result
exclusionsRevision = revision
@@ -132,7 +133,7 @@ final class BulkRemovalPlan {
self.installedApps = installedApps
suggested = result.suggestedSelection(canUseHelper: self.canUseHelper)
selectedURLs = choices.update(selectedURLs, in: result, canUseHelper: self.canUseHelper)
- appsInTheDock = await DockTiles().holding(apps.map(\.url))
+ appsInTheDock = inTheDock
}
/// Brings the selection in line with the helper as it is now, without scanning again.
diff --git a/Peel/Model/RemovalPlan.swift b/Peel/Model/RemovalPlan.swift
index 29622038..68792f61 100644
--- a/Peel/Model/RemovalPlan.swift
+++ b/Peel/Model/RemovalPlan.swift
@@ -134,9 +134,11 @@ final class RemovalPlan {
) async {
self.canUseHelper = canUseHelper
let app = app
- guard let (result, bundle, installed, revision) = await scanRun.run({
+ guard let (result, bundle, installed, revision, roles, isInTheDock) = await scanRun.run({
let revision = ExclusionsStore.shared.revision
let exclusions = ExclusionsStore.shared.exclusions
+ async let roles = DefaultApps.roles(of: app)
+ async let isInTheDock = !(await DockTiles().holding([app.url])).isEmpty
let result = await Uninstallation.prepare(
app,
installedApps: installedApps,
@@ -148,7 +150,9 @@ final class RemovalPlan {
result,
await Self.look(inside: app),
await Self.packageReceipts(of: app, exclusions: exclusions),
- revision
+ revision,
+ await roles,
+ await isInTheDock
)
}) else { return }
uninstallation = result
@@ -165,8 +169,8 @@ final class RemovalPlan {
vendorUninstaller = bundle
(packageReceipts, filesOutside) = installed
selectedURLs = choices.update(selectedURLs, in: result, canUseHelper: self.canUseHelper)
- defaultRoles = await DefaultApps.roles(of: app)
- hasDockTile = !(await DockTiles().holding([app.url])).isEmpty
+ defaultRoles = roles
+ hasDockTile = isInTheDock
}
/// Brings the selection in line with the helper as it is now, without scanning again.