Skip to content

Commit a92dd5d

Browse files
authored
Merge pull request #3 from AlexTkDev/dev/release-1.1
Dev/release 1.1
2 parents 5fd8ab1 + 0277042 commit a92dd5d

153 files changed

Lines changed: 10316 additions & 1454 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,6 @@ build/
116116
PLAN.md
117117
macos-cache-cleanup.sh
118118
xcuserdata/
119-
*.xcuserstate
119+
*.xcuserstate
120+
opencode.json
121+
.agents

MacOSCleaner/App/MacOSCleanerApp.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,8 @@ struct MacOSCleanerApp: App {
2222
let engine = CleanupEngine(commandRunner: commandRunner)
2323
self.cleanupViewModel = CleanupViewModel(engine: engine, journal: journal, settings: appSettings)
2424

25-
// Request permissions at startup
26-
let manager = permissionsManager
27-
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
28-
manager.showGuidanceIfNeeded()
29-
}
25+
// Preload Launch Services cache
26+
Task { await LSRegisterCache().warmup() }
3027
}
3128

3229
private static func installCrashHandlers() {
@@ -66,13 +63,13 @@ struct MacOSCleanerApp: App {
6663
}
6764
.commands {
6865
CommandGroup(replacing: .appInfo) {
69-
Button("About MacOS Cleaner") {
66+
Button("about_title".localized) {
7067
openWindow(id: "about")
7168
}
7269
}
7370
}
7471

75-
Window("About MacOS Cleaner", id: "about") {
72+
Window("about_title".localized, id: "about") {
7673
AboutView()
7774
}
7875
.windowResizability(.contentSize)

MacOSCleaner/App/RootView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ struct RootView: View {
2121
} detail: {
2222
if let selectedItem {
2323
contentView(for: selectedItem)
24-
.frame(minWidth: 900, minHeight: 600)
24+
.frame(minWidth: 800, minHeight: 600)
2525
} else {
2626
Text("sidebar_select_item".localized)
2727
.foregroundColor(.secondary)
28-
.frame(minWidth: 900, minHeight: 600)
28+
.frame(minWidth: 800, minHeight: 600)
2929
}
3030
}
3131

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import Foundation
2+
3+
extension CleanupCategory {
4+
5+
public var localizedTitle: String {
6+
"category.\(rawValue)".localized
7+
}
8+
9+
public static func fromFixturePathType(_ pathType: CleanupPathType) -> [CleanupCategory] {
10+
switch pathType {
11+
case .caches:
12+
return [.appCaches, .browserCaches, .ideCaches, .messagingMedia, .languageCaches, .systemCaches]
13+
case .applicationSupport:
14+
return [.ideCaches, .orphanedRemnants, .orphanedFiles]
15+
case .containers:
16+
return [.appContainers, .orphanedRemnants]
17+
case .groupContainers:
18+
return [.appContainers, .orphanedRemnants]
19+
case .preferences:
20+
return [.orphanedRemnants, .savedAppState]
21+
case .logs:
22+
return [.userLogs, .crashReporter]
23+
case .savedState:
24+
return [.savedAppState]
25+
case .httpStorages:
26+
return [.orphanedFiles]
27+
case .webkit:
28+
return [.orphanedFiles]
29+
case .applicationScripts:
30+
return [.orphanedRemnants]
31+
case .launchAgents:
32+
return [.launchAgents]
33+
case .launchDaemons:
34+
return [.launchDaemons]
35+
case .privilegedHelperTools:
36+
return [.privilegedHelpers]
37+
case .pkgReceipts:
38+
return [.pkgReceipts]
39+
case .internetPlugins:
40+
return [.internetPlugins]
41+
case .cookies:
42+
return [.orphanedFiles]
43+
case .diagnosticReports:
44+
return [.crashReporter]
45+
case .cloudDocs:
46+
return [.cloudDocs]
47+
case .sharedFileLists:
48+
return [.sharedFileLists]
49+
case .developerArtifacts:
50+
return []
51+
}
52+
}
53+
54+
public static func fromCleanupJsonScannerId(_ scannerId: String) -> CleanupCategory? {
55+
switch scannerId {
56+
case "browser_data_scanner": return .browserCaches
57+
case "logs_scanner": return .userLogs
58+
case "language_toolchain_scanner": return .languageCaches
59+
case "cache_scanner": return .appCaches
60+
case "xcode_derived_data_scanner": return .xcode
61+
case "simulator_scanner": return .iosSimulators
62+
case "quicklook_cache_scanner": return .systemCaches
63+
case "photo_library_cache_scanner": return .photosCache
64+
case "voice_memos_scanner": return .voiceMemos
65+
case "garageband_logic_scanner": return .garageBandLogic
66+
case "imovie_final_cut_scanner": return .iMovieFinalCut
67+
case "garmin_fitbit_scanner": return .garminFitbit
68+
case "old_backups_scanner": return .oldBackups
69+
case "mail_attachments_scanner": return .mailDownloads
70+
case "dns_cache_scanner": return .dnsFlush
71+
case "font_cache_scanner": return .fontCache
72+
case "sleep_image_scanner": return .sleepImage
73+
case "duplicate_files_scanner": return .duplicateFiles
74+
case "unused_apps_scanner": return .unusedApps
75+
case "docker_scanner": return .docker
76+
case "downloads_scanner": return .largeFiles
77+
case "trash_scanner": return .scatteredJunk
78+
case "time_machine_local_snapshots_scanner": return .timeMachineSnapshots
79+
case "itunes_backup_scanner": return .iosBackups
80+
case "spotlight_index_scanner": return .systemCaches
81+
case "swap_files_scanner": return .systemCaches
82+
default: return nil
83+
}
84+
}
85+
}

MacOSCleaner/Domains/Cleanup/CleanupCoordinator.swift

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -207,49 +207,55 @@ public final class CleanupCoordinator: @unchecked Sendable {
207207
}
208208

209209
private func parseSkippedFromLog(_ log: String) -> SkippedCleanupItem? {
210-
let patterns: [(label: String, keywords: [String])] = [
211-
("App containers", ["App containers"]),
212-
("Orphaned remnants", ["Orphaned remnants"]),
213-
("Orphaned files", ["Orphaned files"]),
214-
("Large files", ["Large files"]),
215-
("Dynamic cache discovery", ["Dynamic cache discovery"]),
216-
("App caches", ["App caches"]),
217-
("Package managers", ["Package managers"]),
218-
("Gradle + Maven", ["Gradle"]),
219-
("Flutter / Dart", ["Flutter"]),
220-
("Xcode", ["Xcode"]),
221-
("iOS Simulators", ["iOS Simulators"]),
222-
("Android caches", ["Android caches"]),
223-
("Android SDK", ["Android SDK"]),
224-
("IDE / Electron caches", ["IDE"]),
225-
("Browser caches", ["Browser caches"]),
226-
("Messaging / media", ["Messaging"]),
227-
("Docker", ["Docker"]),
228-
("Language caches", ["Language caches"]),
229-
("User logs", ["User logs"]),
230-
("System caches", ["System caches"]),
231-
("Dotfile caches", ["Dotfile caches"]),
232-
("Scattered junk", ["Scattered junk"]),
233-
("Time Machine Snapshots", ["Time Machine"]),
234-
("iOS Backups", ["iOS Backups"]),
235-
("Mail Downloads", ["Mail Downloads"]),
236-
("Saved Application State", ["Saved Application State"]),
237-
("Crash Reporter", ["Crash Reporter"]),
238-
("AssetsV2", ["AssetsV2"]),
239-
("CloudKit Cache", ["CloudKit"]),
240-
("Swift Package Manager Cache", ["SwiftPM"]),
241-
("Carthage Cache", ["Carthage"]),
242-
("Steam Cache", ["Steam"]),
243-
("Microsoft Teams Cache", ["Teams"]),
244-
("Adobe Caches", ["Adobe"]),
245-
("Chrome Extra Caches", ["Chrome"]),
210+
let patterns: [(category: CleanupCategory?, keywords: [String])] = [
211+
(.appContainers, ["App containers"]),
212+
(.orphanedRemnants, ["Orphaned remnants"]),
213+
(.orphanedFiles, ["Orphaned files"]),
214+
(.largeFiles, ["Large files"]),
215+
(.dynamicCacheDiscovery, ["Dynamic cache discovery"]),
216+
(.appCaches, ["App caches"]),
217+
(.packageManagers, ["Package managers"]),
218+
(.gradleMaven, ["Gradle"]),
219+
(.flutterDart, ["Flutter"]),
220+
(.xcode, ["Xcode"]),
221+
(.iosSimulators, ["iOS Simulators"]),
222+
(.androidCaches, ["Android caches"]),
223+
(.androidSDK, ["Android SDK"]),
224+
(.ideCaches, ["IDE"]),
225+
(.browserCaches, ["Browser caches"]),
226+
(.messagingMedia, ["Messaging"]),
227+
(.docker, ["Docker"]),
228+
(.languageCaches, ["Language caches"]),
229+
(.userLogs, ["User logs"]),
230+
(.systemCaches, ["System caches"]),
231+
(.dotfileCaches, ["Dotfile caches"]),
232+
(.scatteredJunk, ["Scattered junk"]),
233+
(.timeMachineSnapshots, ["Time Machine"]),
234+
(.iosBackups, ["iOS Backups"]),
235+
(.mailDownloads, ["Mail Downloads"]),
236+
(.savedAppState, ["Saved Application State"]),
237+
(.crashReporter, ["Crash Reporter"]),
238+
(.assetsV2, ["AssetsV2"]),
239+
(.cloudKitCache, ["CloudKit"]),
240+
(.swiftPMCache, ["SwiftPM"]),
241+
(.carthageCache, ["Carthage"]),
242+
(.steamCache, ["Steam"]),
243+
(.teamsCache, ["Teams"]),
244+
(.adobeCaches, ["Adobe"]),
245+
(.chromeExtraCaches, ["Chrome"]),
246246
]
247247

248248
guard let matched = patterns.first(where: { $0.keywords.contains(where: { log.contains($0) }) }) else {
249249
return nil
250250
}
251251

252-
// Extract reason — everything between "—" and ", skipped"
252+
let label: String
253+
if let category = matched.category {
254+
label = category.localizedTitle
255+
} else {
256+
label = matched.keywords[0]
257+
}
258+
253259
let reason: String
254260
if let range = log.range(of: "") {
255261
let afterDash = log[range.upperBound...]
@@ -262,7 +268,7 @@ public final class CleanupCoordinator: @unchecked Sendable {
262268
reason = "unknown"
263269
}
264270

265-
return SkippedCleanupItem(label: matched.label, reason: reason)
271+
return SkippedCleanupItem(label: label, reason: reason)
266272
}
267273

268274
@MainActor

0 commit comments

Comments
 (0)