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 folder group's figures whole and name each folder's Remove button
Țugui Dragoș67436937baae
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex 20a4f04b..90165022 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -137174,6 +137174,112 @@}}},+ "Remove %@" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Odebrat složku %@"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "„%@“ entfernen"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Eliminar %@"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Retirer %@"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Rimuovi “%@”"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@をリストから削除"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@ 제거"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Verwijder %@"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Usuń folder %@ z listy"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Remover %@"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Eliminați %@"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Убрать папку «%@»"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ta bort %@"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Kaldır: %@"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Вилучити «%@»"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "移除“%@”"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "移除「%@」"+ }+ }+ }+ },"Remove Downloads" : {"localizations" : {"cs" : {diff --git a/Peel/Views/Duplicates/DuplicateFolderGroupView.swift b/Peel/Views/Duplicates/DuplicateFolderGroupView.swiftindex 87c373b9..0bcf977c 100644--- a/Peel/Views/Duplicates/DuplicateFolderGroupView.swift+++ b/Peel/Views/Duplicates/DuplicateFolderGroupView.swift@@ -44,12 +44,7 @@ struct DuplicateFolderGroupView: View {Text(verbatim: group.folders[0].url.lastPathComponent).pageTitle().help(Text(verbatim: group.folders[0].url.lastPathComponent))- HStack(spacing: 6) {- Badge(title: Text(verbatim: group.size.byteCount), systemImage: "folder")- Badge(title: Text("^[\(group.fileCount) file](inflect: true)"), systemImage: "doc")- Badge(title: Text(group.folders.count, format: .number), systemImage: "folder.badge.plus")- .accessibilityLabel(Text("^[\(group.folders.count) copy](inflect: true)"))- }+ DuplicateFolderGroupBadges(group: group)}Spacer(minLength: 8)DuplicateSelectedTotal(bytes: duplicates.selectedSize(in: group))@@ -71,6 +66,19 @@ struct DuplicateFolderGroupView: View {}}+struct DuplicateFolderGroupBadges: View {+ let group: DuplicateFolderGroup++ var body: some View {+ FlowLayout(spacing: 6) {+ Badge(title: Text(verbatim: group.size.byteCount), systemImage: "folder")+ Badge(title: Text("^[\(group.fileCount) file](inflect: true)"), systemImage: "doc")+ Badge(title: Text(group.folders.count, format: .number), systemImage: "folder.badge.plus")+ .accessibilityLabel(Text("^[\(group.folders.count) copy](inflect: true)"))+ }+ }+}+private struct DuplicateFolderRow: View {let duplicates: DuplicateLibrarylet folder: DuplicateFolderdiff --git a/Peel/Views/Duplicates/DuplicateScanForm.swift b/Peel/Views/Duplicates/DuplicateScanForm.swiftindex 245c6982..9241b33e 100644--- a/Peel/Views/Duplicates/DuplicateScanForm.swift+++ b/Peel/Views/Duplicates/DuplicateScanForm.swift@@ -100,11 +100,12 @@ private struct FolderRow: View {let folder: URLvar body: some View {+ let name = FileManager.default.displayName(atPath: folder.path(percentEncoded: false))HStack(spacing: 8) {AppIcon(url: folder).frame(width: 18, height: 18)VStack(alignment: .leading, spacing: 2) {- Text(verbatim: FileManager.default.displayName(atPath: folder.path(percentEncoded: false)))+ Text(verbatim: name).lineLimit(1).truncationMode(.middle)if let reason {@@ -123,6 +124,7 @@ private struct FolderRow: View {}.buttonStyle(.plain).foregroundStyle(.secondary)+ .accessibilityLabel(Text("Remove \(name)")).help(Text("Don’t scan this folder"))}.help(folder.abbreviatedPath)diff --git a/PeelTests/DuplicateFolderGroupBadgesTests.swift b/PeelTests/DuplicateFolderGroupBadgesTests.swiftnew file mode 100644index 00000000..c74792c4--- /dev/null+++ b/PeelTests/DuplicateFolderGroupBadgesTests.swift@@ -0,0 +1,21 @@+import AppKit+@testable import Peel+@testable import PeelCore+import SwiftUI+import Testing++@MainActor+struct DuplicateFolderGroupBadgesTests {+ @Test func badgesThatDontFitOnOneLineMoveToTheNextRatherThanBeCut() {+ let folders = ["a", "b"].map { name in+ DuplicateFolder(+ url: URL(filePath: "/org.example/\(name)"), fileCount: 12_345, size: 1_234_567_890,+ reclaimableSize: 1_234_567_890, contents: "", neverProjects: []+ )+ }+ let badges = DuplicateFolderGroupBadges(group: DuplicateFolderGroup(id: "org.example", folders: folders))+ let oneLine = NSHostingView(rootView: badges).fittingSize+ let narrower = NSHostingView(rootView: badges.frame(width: oneLine.width - 1)).fittingSize+ #expect(narrower.height > oneLine.height)+ }+}