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 Return on OK in every alert that offers other buttons
Țugui Dragoș251e85fea721
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/AlertDefaultButtonTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/AlertDefaultButtonTests.swiftnew file mode 100644index 00000000..24a277ae--- /dev/null+++ b/Packages/PeelCore/Tests/PeelCoreTests/AlertDefaultButtonTests.swift@@ -0,0 +1,22 @@+import Foundation+import Testing++struct AlertDefaultButtonTests {+ @Test func anAlertWithOtherButtonsKeepsReturnOnOK() throws {+ let root = LineLengthTests.repository.path(percentEncoded: false)+ var found: [String] = []+ for file in try LineLengthTests.swiftFiles()+ where file.path(percentEncoded: false).dropFirst(root.count).hasPrefix("Peel/") {+ let lines = try String(contentsOf: file, encoding: .utf8).components(separatedBy: "\n")+ for (index, line) in lines.enumerated() where line.contains(#"Button("OK", role: .cancel)"#) {+ guard let start = lines[..<index].lastIndex(where: { $0.contains(".alert(") }) else { continue }+ let hasOtherButtons = lines[(start + 1)..<index].contains { $0.contains("Button(") }+ let next = index + 1 < lines.count ? lines[index + 1] : ""+ if hasOtherButtons, !next.contains(".keyboardShortcut(.defaultAction)") {+ found.append("\(file.path(percentEncoded: false).dropFirst(root.count)):\(index + 1)")+ }+ }+ }+ #expect(found.isEmpty, "Return would press the first other button, not OK: \(found)")+ }+}diff --git a/Peel/Views/History/HistoryDetailView.swift b/Peel/Views/History/HistoryDetailView.swiftindex d52b3388..fdcbd907 100644--- a/Peel/Views/History/HistoryDetailView.swift+++ b/Peel/Views/History/HistoryDetailView.swift@@ -92,6 +92,7 @@ struct HistoryDetailView: View {}Button("Copy Details") { copyFailureDetails() }Button("OK", role: .cancel) {}+ .keyboardShortcut(.defaultAction)} message: {failureMessage}diff --git a/Peel/Views/Orphans/OrphanList.swift b/Peel/Views/Orphans/OrphanList.swiftindex 7374f420..9ba3e951 100644--- a/Peel/Views/Orphans/OrphanList.swift+++ b/Peel/Views/Orphans/OrphanList.swift@@ -158,6 +158,7 @@ struct OrphanList: View {Button("Open Peel Settings") { SettingsPane.exclusions.open(with: openSettings) }}Button("OK", role: .cancel) {}+ .keyboardShortcut(.defaultAction)} message: {orphans.owners == nil? Text("Peel can’t read its list of the orphaned files you said belong to an app, so it lists them all. Start the list over in Settings > Exclusions.")diff --git a/Peel/Views/RemovalBar.swift b/Peel/Views/RemovalBar.swiftindex f4551963..af4dad8f 100644--- a/Peel/Views/RemovalBar.swift+++ b/Peel/Views/RemovalBar.swift@@ -283,6 +283,7 @@ struct RemovalBar: View {Button("Move the Rest") { Task { askToMove(rest) } }}Button("OK", role: .cancel) {}+ .keyboardShortcut(.defaultAction)}}diff --git a/Peel/Views/StartOverButton.swift b/Peel/Views/StartOverButton.swiftindex 9638fd69..ff133c8d 100644--- a/Peel/Views/StartOverButton.swift+++ b/Peel/Views/StartOverButton.swift@@ -24,6 +24,7 @@ struct StartOverButton: View {.alert("Peel couldn’t set the old file aside", isPresented: $couldNotSetAside) {Button("Show in Finder") { NSWorkspace.shared.activateFileViewerSelecting([file]) }Button("OK", role: .cancel) {}+ .keyboardShortcut(.defaultAction)} message: {Text("Nothing changed. Check that Peel can write to its folder in Application Support, then try again.")}