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.

Keep the line about History in a removal's copied details

Țugui Dragoș703a3d7017a9
diff --git a/Peel/Views/RemovalFailureAlert.swift b/Peel/Views/RemovalFailureAlert.swift
index 4e64c2a1..f9c3f596 100644
--- a/Peel/Views/RemovalFailureAlert.swift
+++ b/Peel/Views/RemovalFailureAlert.swift
@@ -102,9 +102,7 @@ struct RemovalFailureAlert: ViewModifier {
}
static func message(for outcome: RemovalOutcome) -> String {
- var lines = outcome.historyCouldNotRecord
- ? [String(localized: "What moved is in the Trash: drag it back out in Finder if you need it.")] : []
- lines += shortened(quitLines(outcome))
+ var lines = historyLines(outcome) + shortened(quitLines(outcome))
+ firstItems(outcome.failures.map { "\($0.url.abbreviatedPath)\n\($0.reason.explanation)" })
lines += shortened(keptLines(outcome)) + driverLines(outcome) + administratorLines(outcome)
+ shellLines(outcome) { Self.listed($0) { String(inflecting: "^[\($0) more line](inflect: true)") } }
@@ -115,6 +113,11 @@ struct RemovalFailureAlert: ViewModifier {
return lines.joined(separator: "\n\n")
}
+ private static func historyLines(_ outcome: RemovalOutcome) -> [String] {
+ guard outcome.historyCouldNotRecord else { return [] }
+ return [String(localized: "What moved is in the Trash: drag it back out in Finder if you need it.")]
+ }
+
private static func administratorLines(_ outcome: RemovalOutcome) -> [String] {
let count = outcome.leftForAnAdministrator
guard count > 0 else { return [] }
@@ -172,7 +175,8 @@ struct RemovalFailureAlert: ViewModifier {
}
static func details(for outcome: RemovalOutcome) -> String {
- var lines = quitLines(outcome) + outcome.failures.map { "\($0.url.path(percentEncoded: false))\n\($0.reason.explanation)" }
+ var lines = historyLines(outcome) + quitLines(outcome)
+ + outcome.failures.map { "\($0.url.path(percentEncoded: false))\n\($0.reason.explanation)" }
+ keptLines(outcome) + driverLines(outcome) + administratorLines(outcome)
+ shellLines(outcome) { $0.formatted(.list(type: .and)) } + appManagementLines(outcome)
+ privacyLines(outcome)
diff --git a/PeelTests/RemovalOutcomeTests.swift b/PeelTests/RemovalOutcomeTests.swift
index 7305e310..fc211e58 100644
--- a/PeelTests/RemovalOutcomeTests.swift
+++ b/PeelTests/RemovalOutcomeTests.swift
@@ -44,5 +44,6 @@ struct RemovalOutcomeTests {
#expect(outcome.historyCouldNotRecord && !outcome.isEmpty)
#expect(RemovalFailureAlert.message(for: outcome).hasPrefix("What moved is in the Trash"))
+ #expect(RemovalFailureAlert.details(for: outcome).hasPrefix("What moved is in the Trash"))
}
}