Free, open-source macOS cleaner. CleanMyMac alternative with zero telemetry. Native SwiftUI, scheduled auto-cleaning, Xcode/Homebrew/system cache cleanup. MIT licensed.
Swift cache-cleanercleanmymaccleanupdisk-cleanerdisk-spacehomebrewmac-utilitymacosmacos-appmacos-cleanermacosxnativeossosxprivacyswiftswiftuisystem-cleanerxcode-cleaner
feat: CleanMyMac-grade dashboard + Finder uninstall + fixes (v2.7.0, build 14)
moamen42a2280fb56a
diff --git a/PureMac.xcodeproj/project.pbxproj b/PureMac.xcodeproj/project.pbxprojindex c82ca72..2da84c7 100644--- a/PureMac.xcodeproj/project.pbxproj+++ b/PureMac.xcodeproj/project.pbxproj@@ -26,6 +26,7 @@76B132F9C499225D33E0D075 /* EmptyStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 424F7B28624C271620E13BBC /* EmptyStateView.swift */; };826A750D2D7EC14C2AE306A3 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3667D46D8E2004EB4D73835A /* Models.swift */; };8947F0CE448791BD50EECF46 /* Conditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB94E06E145558123BB5BFB3 /* Conditions.swift */; };+ 8B541441926847072DC5B75B /* DashboardCharts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C60E04A0CA3F227816DB63 /* DashboardCharts.swift */; };93743B036059418560D876E6 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A8D39C3C250F26302EC45AB /* SettingsView.swift */; };95278ABDCF5F4D6AC60503B1 /* AppearancePill.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92259B3E9F4468865F15DEEC /* AppearancePill.swift */; };9AA80E035DF7B33F6EE118DF /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = CED1B71D5F9510582E869CFD /* AppState.swift */; };@@ -67,6 +68,7 @@022D0EAEE2B6E54069FC2CBE /* UpdateService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateService.swift; sourceTree = "<group>"; };02E502E2B5C6AECC76E5CFEF /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };069AAE87E3F9EDE5593AD8B3 /* PermissionSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionSheet.swift; sourceTree = "<group>"; };+ 08C60E04A0CA3F227816DB63 /* DashboardCharts.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashboardCharts.swift; sourceTree = "<group>"; };10B0AF194677EAC1D5568785 /* CategoryDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryDetailView.swift; sourceTree = "<group>"; };155CE1B8CDCCCA6F9FD028C1 /* LocalizationFilesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalizationFilesTests.swift; sourceTree = "<group>"; };1AB003A7751F05727DBFD1A5 /* AppTheme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTheme.swift; sourceTree = "<group>"; };@@ -219,6 +221,7 @@92259B3E9F4468865F15DEEC /* AppearancePill.swift */,1AB003A7751F05727DBFD1A5 /* AppTheme.swift */,F0599AA604B0D6BA4F957537 /* ConfettiView.swift */,+ 08C60E04A0CA3F227816DB63 /* DashboardCharts.swift */,424F7B28624C271620E13BBC /* EmptyStateView.swift */,231FF7CBB5F621B66F2AB8A5 /* FDADemoView.swift */,069AAE87E3F9EDE5593AD8B3 /* PermissionSheet.swift */,@@ -430,6 +433,7 @@48D1431A7C99C19EEBDB056B /* CleaningEngine.swift in Sources */,8947F0CE448791BD50EECF46 /* Conditions.swift in Sources */,ABDDD4F35102A39CC1A2C325 /* ConfettiView.swift in Sources */,+ 8B541441926847072DC5B75B /* DashboardCharts.swift in Sources */,A2AE68CC75CB72D6B10CBDF5 /* DashboardView.swift in Sources */,76B132F9C499225D33E0D075 /* EmptyStateView.swift in Sources */,52F11962555C639F0EECADD6 /* FDADemoView.swift in Sources */,@@ -533,7 +537,7 @@CODE_SIGN_STYLE = Automatic;COMBINE_HIDPI_IMAGES = YES;COPY_PHASE_STRIP = NO;- CURRENT_PROJECT_VERSION = 13;+ CURRENT_PROJECT_VERSION = 14;DEBUG_INFORMATION_FORMAT = dwarf;DEVELOPMENT_TEAM = H3WXHVTP97;ENABLE_STRICT_OBJC_MSGSEND = YES;@@ -555,7 +559,7 @@GENERATE_INFOPLIST_FILE = NO;INFOPLIST_FILE = PureMac/Info.plist;MACOSX_DEPLOYMENT_TARGET = 13.0;- MARKETING_VERSION = 2.6.1;+ MARKETING_VERSION = 2.7.0;MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;MTL_FAST_MATH = YES;ONLY_ACTIVE_ARCH = NO;@@ -657,7 +661,7 @@CODE_SIGN_STYLE = Automatic;COMBINE_HIDPI_IMAGES = YES;COPY_PHASE_STRIP = NO;- CURRENT_PROJECT_VERSION = 13;+ CURRENT_PROJECT_VERSION = 14;DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";DEVELOPMENT_TEAM = H3WXHVTP97;ENABLE_NS_ASSERTIONS = NO;@@ -673,7 +677,7 @@GENERATE_INFOPLIST_FILE = NO;INFOPLIST_FILE = PureMac/Info.plist;MACOSX_DEPLOYMENT_TARGET = 13.0;- MARKETING_VERSION = 2.6.1;+ MARKETING_VERSION = 2.7.0;MTL_ENABLE_DEBUG_INFO = NO;MTL_FAST_MATH = YES;ONLY_ACTIVE_ARCH = NO;diff --git a/PureMac/Info.plist b/PureMac/Info.plistindex e9c7374..79ca3a0 100644--- a/PureMac/Info.plist+++ b/PureMac/Info.plist@@ -36,5 +36,25 @@<string>PureMac needs system administration access to clean caches and uninstall apps completely.</string><key>NSAppleEventsUsageDescription</key><string>PureMac uses Apple Events to interact with Finder when revealing files.</string>+ <key>NSServices</key>+ <array>+ <dict>+ <key>NSMenuItem</key>+ <dict>+ <key>default</key>+ <string>Uninstall with PureMac</string>+ </dict>+ <key>NSMessage</key>+ <string>uninstallApp</string>+ <key>NSPortName</key>+ <string>PureMac</string>+ <key>NSRequiredContext</key>+ <dict/>+ <key>NSSendFileTypes</key>+ <array>+ <string>com.apple.application-bundle</string>+ </array>+ </dict>+ </array></dict></plist>diff --git a/PureMac/Logic/Scanning/AppInfoFetcher.swift b/PureMac/Logic/Scanning/AppInfoFetcher.swiftindex 34c837f..ef48766 100644--- a/PureMac/Logic/Scanning/AppInfoFetcher.swift+++ b/PureMac/Logic/Scanning/AppInfoFetcher.swift@@ -79,6 +79,19 @@ final class AppInfoFetcher {return apps.sorted { $0.appName.localizedCaseInsensitiveCompare($1.appName) == .orderedAscending }}+ /// Build an `InstalledApp` from a single bundle URL. Used by the Finder+ /// Services handler ("Uninstall with PureMac") to resolve a right-clicked+ /// .app into the uninstaller without re-scanning every app. Enforces the+ /// same protections as the full scan: no /System apps, and no protected+ /// Apple bundle IDs (Safari, Mail, Xcode, App Store, …) — so a right-click+ /// can never route a system app into the uninstaller.+ func fetchApp(at url: URL) -> InstalledApp? {+ guard url.pathExtension == "app", !url.path.hasPrefix("/System") else { return nil }+ guard let app = loadAppInfo(from: url),+ !Self.protectedBundleIDs.contains(app.bundleIdentifier) else { return nil }+ return app+ }+private func loadAppInfo(from url: URL) -> InstalledApp? {guard let bundle = Bundle(url: url) else { return nil }diff --git a/PureMac/PureMacApp.swift b/PureMac/PureMacApp.swiftindex 7faa6a1..743ef55 100644--- a/PureMac/PureMacApp.swift+++ b/PureMac/PureMacApp.swift@@ -9,6 +9,34 @@ class AppDelegate: NSObject, NSApplicationDelegate {// Touch TCC-protected paths so macOS registers PureMac in the// Full Disk Access pane on first launch (fixes issue #75).FullDiskAccessManager.shared.triggerRegistration()+ // Register the Finder Services provider so "Uninstall with PureMac"+ // appears when an .app bundle is right-clicked (issue #109).+ NSApp.servicesProvider = self+ NSUpdateDynamicServices()+ }++ /// Finder Services entry point. Declared in Info.plist as NSMessage+ /// `uninstallApp`; receives the right-clicked .app via the pasteboard and+ /// hands it to AppState through a notification. Brings PureMac forward so+ /// the user lands on the uninstall scan.+ @objc func uninstallApp(_ pboard: NSPasteboard,+ userData: String?,+ error: AutoreleasingUnsafeMutablePointer<NSString>?) {+ let urls = (pboard.readObjects(forClasses: [NSURL.self],+ options: [.urlReadingFileURLsOnly: true]) as? [URL]) ?? []+ guard let appURL = urls.first(where: { $0.pathExtension == "app" }) else {+ error?.pointee = "Select an application (.app) to uninstall." as NSString+ return+ }+ NSApp.activate(ignoringOtherApps: true)+ // Buffer the path for the cold-launch case (AppState may not exist yet,+ // and NotificationCenter does not replay); AppState drains it in init.+ ExternalUninstallBuffer.pendingPath = appURL.path+ NotificationCenter.default.post(+ name: .pureMacExternalUninstall,+ object: nil,+ userInfo: ["path": appURL.path]+ )}}diff --git a/PureMac/ViewModels/AppState.swift b/PureMac/ViewModels/AppState.swiftindex 8734b32..3c90b85 100644--- a/PureMac/ViewModels/AppState.swift+++ b/PureMac/ViewModels/AppState.swift@@ -11,6 +11,22 @@ enum AppSection: Hashable {case cleaning(CleaningCategory)}+extension Notification.Name {+ /// Posted by the Finder Services handler ("Uninstall with PureMac") with a+ /// `["path": String]` userInfo pointing at the right-clicked .app bundle.+ static let pureMacExternalUninstall = Notification.Name("PureMac.ExternalUninstall")+}++/// Cold-launch buffer for Finder Services. A "Uninstall with PureMac" request+/// can arrive before the SwiftUI scene (and thus AppState) exists; the posted+/// notification then has no subscriber and is lost (NotificationCenter has no+/// replay). AppDelegate stashes the path here and AppState drains it in init.+enum ExternalUninstallBuffer {+ // Written by the Finder Services handler and drained by AppState — both+ // run on the main thread, so a plain static is sufficient here.+ static var pendingPath: String?+}+@MainActorfinal class AppState: ObservableObject {typealias AppFileScanner = @MainActor (@@ -64,6 +80,13 @@ final class AppState: ObservableObject {/// different app or mutates selection while the FDA sheet is open.@Published var lastFailedRemovalURLs: [URL] = []@Published var appFileScanLocationCount: Int = 0+ /// Set when a right-clicked app arrives via the Finder Services handler.+ /// MainWindow consumes it on both onChange AND onAppear so a request that+ /// lands before MainWindow mounts (cold launch, or while onboarding is+ /// still showing) is still surfaced — a one-shot token would be missed.+ @Published var pendingExternalApp: InstalledApp?++ private var externalUninstallObserver: AnyCancellable?// MARK: - Services@@ -108,6 +131,24 @@ final class AppState: ObservableObject {self.locationsProvider = locationsProviderself.appFileScanner = appFileScanner+ // Listen for right-click "Uninstall with PureMac" hand-offs from the+ // Finder Services handler in AppDelegate.+ externalUninstallObserver = NotificationCenter.default+ .publisher(for: .pureMacExternalUninstall)+ .receive(on: RunLoop.main)+ .sink { [weak self] note in+ let path = (note.userInfo?["path"] as? String) ?? ExternalUninstallBuffer.pendingPath+ ExternalUninstallBuffer.pendingPath = nil+ guard let path else { return }+ Task { @MainActor in self?.presentExternalUninstall(appPath: path) }+ }+ // Drain a request that arrived before this AppState existed (cold launch+ // via Finder Services — the notification fired with no subscriber).+ if let buffered = ExternalUninstallBuffer.pendingPath {+ ExternalUninstallBuffer.pendingPath = nil+ presentExternalUninstall(appPath: buffered)+ }+if performStartupTasks {loadDiskInfo()checkFullDiskAccess()@@ -138,6 +179,38 @@ final class AppState: ObservableObject {}}+ /// Resolve a right-clicked .app (via the Finder Services handler) into the+ /// uninstaller: select it, kick off the related-files scan, and signal+ /// MainWindow to surface the Installed Apps section.+ func presentExternalUninstall(appPath: String) {+ let url = URL(fileURLWithPath: appPath)+ if let cached = installedApps.first(where: { $0.path.standardizedFileURL == url.standardizedFileURL }) {+ applyExternalUninstall(cached)+ return+ }+ // Not in the cached list (non-standard location, or a cold start before+ // loadInstalledApps finished). Resolve off the main thread — fetchApp+ // walks the entire bundle to size it, which would beachball the UI for+ // a multi-gigabyte app.+ Task.detached(priority: .userInitiated) {+ let app = AppInfoFetcher.shared.fetchApp(at: url)+ await MainActor.run { [weak self] in+ guard let self else { return }+ guard let app else {+ Logger.shared.log("Finder uninstall request rejected (non-app or protected): \(appPath)", level: .warning)+ return+ }+ self.applyExternalUninstall(app)+ }+ }+ }++ private func applyExternalUninstall(_ app: InstalledApp) {+ selectedApp = app+ pendingExternalApp = app+ scanForAppFiles(app)+ }+func scanForAppFiles(_ app: InstalledApp) {discoveredFiles = []selectedFiles = []diff --git a/PureMac/Views/Apps/AppListView.swift b/PureMac/Views/Apps/AppListView.swiftindex 844976d..1131432 100644--- a/PureMac/Views/Apps/AppListView.swift+++ b/PureMac/Views/Apps/AppListView.swift@@ -98,10 +98,26 @@ struct AppListView: View {.width(ideal: 70)}.onChange(of: selection) { newValue in- if let id = newValue,- let app = appState.installedApps.first(where: { $0.id == id }) {- appState.selectedApp = app- appState.scanForAppFiles(app)+ guard let id = newValue,+ let app = appState.installedApps.first(where: { $0.id == id })+ else { return }+ // Skip when the selection was just synced from an external+ // (Finder Services) hand-off that already scanned this app,+ // so we don't fire a redundant second scan.+ guard appState.selectedApp?.id != app.id else { return }+ appState.selectedApp = app+ appState.scanForAppFiles(app)+ }+ .onChange(of: appState.selectedApp) { app in+ // Reflect an externally-driven selection (Finder Services)+ // in the table highlight.+ if selection != app?.id { selection = app?.id }+ }+ .onAppear {+ // Sync the highlight when this view mounts already pointed+ // at an externally-selected app.+ if selection != appState.selectedApp?.id {+ selection = appState.selectedApp?.id}}}diff --git a/PureMac/Views/Components/ConfettiView.swift b/PureMac/Views/Components/ConfettiView.swiftindex bd1d0b2..cbc5274 100644--- a/PureMac/Views/Components/ConfettiView.swift+++ b/PureMac/Views/Components/ConfettiView.swift@@ -1,115 +1,152 @@-import AppKitimport SwiftUI-/// One-shot confetti burst. Wraps a `CAEmitterLayer` so the particles run on-/// Core Animation rather than burning a SwiftUI render pass per frame. Use-/// `ConfettiView(trigger: someBool)` and flip `trigger` to fire. The emitter-/// produces a short burst (~1.2s of emission, ~2.5s for particles to fall)-/// then quiets itself so it doesn't keep churning if the view stays alive.-struct ConfettiView: NSViewRepresentable {- /// Flip this to fire a new burst. Each rising edge fires once.+/// Tasteful one-shot confetti, redesigned away from the old harsh CAEmitter+/// rectangles. A `Canvas` + `TimelineView` particle system: mixed shapes+/// (streamers, discs, rings), a soft brand palette, gentle gravity with a+/// little horizontal sway, a 3D-style tumble, and a graceful fade. Fire with+/// `ConfettiView(trigger:)` — each rising edge fires one burst that quiets+/// itself. Honors Reduce Motion (renders nothing).+struct ConfettiView: View {+ /// Flip to fire a burst. Each rising edge fires once.let trigger: Bool- final class Coordinator {- var lastTrigger = false- }+ @State private var particles: [Particle] = []+ @State private var start: Date?+ @State private var generation = 0+ @Environment(\.accessibilityReduceMotion) private var reduceMotion- func makeCoordinator() -> Coordinator { Coordinator() }+ private let duration: TimeInterval = 2.6- func makeNSView(context: Context) -> NSView {- let host = HostingView()- // wantsLayer alone gives AppKit a properly-scaled CALayer with the- // window's backing-store scale. Assigning a bare CALayer here would- // overwrite that and render particles at 1x on Retina displays.- host.wantsLayer = true- return host+ var body: some View {+ GeometryReader { geo in+ TimelineView(.animation(paused: start == nil)) { timeline in+ Canvas { ctx, size in+ guard let start else { return }+ let t = timeline.date.timeIntervalSince(start)+ guard t <= duration else { return }+ for p in particles {+ draw(p, at: t, in: size, ctx: &ctx)+ }+ }+ }+ // The parent flips `trigger` (via .toggle()) as a fire pulse, so a+ // burst should play on ANY change — not just the rising edge, which+ // would skip every other cleanup.+ .onChange(of: trigger) { _ in+ fire(in: geo.size)+ }+ .allowsHitTesting(false)+ }}- func updateNSView(_ nsView: NSView, context: Context) {- if trigger && !context.coordinator.lastTrigger {- (nsView as? HostingView)?.fire()+ private func fire(in size: CGSize) {+ guard !reduceMotion, size.width > 0 else { return }+ particles = (0..<90).map { _ in Particle.random(width: size.width) }+ start = Date()+ generation += 1+ let g = generation+ // Quiet the timeline once the burst has fully faded so we don't keep+ // re-rendering an empty canvas. Guard on `generation` so a later burst+ // isn't cut short by an earlier burst's cleanup timer.+ DispatchQueue.main.asyncAfter(deadline: .now() + duration + 0.1) {+ guard generation == g else { return }+ start = nil+ particles = []}- context.coordinator.lastTrigger = trigger}- // MARK: - Host- /// Subclass so we can capture bounds for emitter geometry.- final class HostingView: NSView {- override var isFlipped: Bool { true }+ private func draw(_ p: Particle, at t: Double, in size: CGSize, ctx: inout GraphicsContext) {+ // Vertical: initial downward velocity + gravity. Horizontal: drift ++ // a sine sway so pieces flutter instead of dropping like stones.+ let x = p.x0 + p.drift * t + p.swayAmp * sin(p.swayFreq * t + p.phase)+ let y = p.y0 + p.vy0 * t + 0.5 * p.gravity * t * t- func fire() {- guard let layer = self.layer else { return }- let emitter = CAEmitterLayer()- emitter.emitterPosition = CGPoint(x: bounds.midX, y: -10)- emitter.emitterSize = CGSize(width: bounds.width, height: 1)- emitter.emitterShape = .line- emitter.beginTime = CACurrentMediaTime()- emitter.birthRate = 1.0- emitter.emitterCells = makeCells()- layer.addSublayer(emitter)+ guard y < size.height + 40 else { return }- // Stop emission after a short burst — particles already in flight- // continue falling and clean up via removeFromSuperlayer below.- // The `[weak self, weak emitter]` capture lets a torn-down view- // skip the work entirely so we don't keep allocating particles- // against an orphaned layer.- DispatchQueue.main.asyncAfter(deadline: .now() + 1.2) { [weak self, weak emitter] in- guard self?.window != nil else {- emitter?.removeFromSuperlayer()- return- }- emitter?.birthRate = 0- }- DispatchQueue.main.asyncAfter(deadline: .now() + 4.0) { [weak emitter] in- emitter?.removeFromSuperlayer()- }+ let fade: Double+ if t > p.fadeStart {+ fade = max(0, 1 - (t - p.fadeStart) / (duration - p.fadeStart))+ } else {+ fade = 1}+ guard fade > 0.01 else { return }- private func makeCells() -> [CAEmitterCell] {- let colors: [NSColor] = [- NSColor(srgbRed: 0.04, green: 0.52, blue: 1.00, alpha: 1),- NSColor(srgbRed: 0.18, green: 0.78, blue: 0.47, alpha: 1),- NSColor(srgbRed: 1.00, green: 0.58, blue: 0.04, alpha: 1),- NSColor(srgbRed: 0.55, green: 0.32, blue: 0.87, alpha: 1),- NSColor(srgbRed: 1.00, green: 0.30, blue: 0.50, alpha: 1),- NSColor(srgbRed: 1.00, green: 0.78, blue: 0.04, alpha: 1),- ]- return colors.map { color in- let cell = CAEmitterCell()- cell.contents = Self.particleImage().cgImage(- forProposedRect: nil, context: nil, hints: nil- )- cell.color = color.cgColor- cell.birthRate = 16- cell.lifetime = 6.0- cell.lifetimeRange = 1.0- cell.velocity = 220- cell.velocityRange = 90- cell.yAcceleration = 240- cell.xAcceleration = 0- cell.emissionLongitude = .pi / 2 // straight down- cell.emissionRange = .pi / 5- cell.spin = 4- cell.spinRange = 6- cell.scale = 0.35- cell.scaleRange = 0.20- cell.alphaSpeed = -0.35 // fade as they fall- return cell- }+ let angle = p.spin * t+ // Tumble: squash one axis on a cosine so pieces appear to flip in 3D.+ let tumble = abs(cos(p.tumbleSpeed * t + p.phase))+ let w = p.size.width * (0.25 + 0.75 * tumble)+ let h = p.size.height++ var sub = ctx+ sub.translateBy(x: x, y: y)+ sub.rotate(by: .radians(angle))+ sub.opacity = fade++ let rect = CGRect(x: -w / 2, y: -h / 2, width: w, height: h)+ switch p.shape {+ case .streamer:+ sub.fill(Path(roundedRect: rect, cornerRadius: min(w, h) * 0.45), with: .color(p.color))+ case .disc:+ sub.fill(Path(ellipseIn: CGRect(x: -h / 2, y: -h / 2, width: h, height: h)), with: .color(p.color))+ case .ring:+ let r = h / 2+ let ring = Path(ellipseIn: CGRect(x: -r, y: -r, width: h, height: h))+ sub.stroke(ring, with: .color(p.color), lineWidth: max(1.4, h * 0.22))}+ }+}++private enum ConfettiShape: CaseIterable { case streamer, disc, ring }++private struct Particle {+ var x0: CGFloat+ var y0: CGFloat+ var vy0: Double+ var gravity: Double+ var drift: Double+ var swayAmp: Double+ var swayFreq: Double+ var phase: Double+ var spin: Double+ var tumbleSpeed: Double+ var fadeStart: Double+ var color: Color+ var size: CGSize+ var shape: ConfettiShape++ /// Soft, slightly desaturated brand palette — premium, not garish.+ static let palette: [Color] = [+ Color(red: 0.27, green: 0.56, blue: 1.00), // blue+ Color(red: 0.30, green: 0.80, blue: 0.56), // green+ Color(red: 1.00, green: 0.66, blue: 0.30), // amber+ Color(red: 0.62, green: 0.45, blue: 0.92), // purple+ Color(red: 1.00, green: 0.46, blue: 0.62), // pink+ Color(red: 0.36, green: 0.80, blue: 0.94), // cyan+ ]- /// Tiny rectangle PNG used as the particle texture. Keeping the image- /// procedural means we don't ship an asset just for confetti.- private static func particleImage() -> NSImage {- let size = NSSize(width: 10, height: 14)- let image = NSImage(size: size)- image.lockFocus()- NSColor.white.setFill()- let path = NSBezierPath(roundedRect: NSRect(origin: .zero, size: size),- xRadius: 1.5, yRadius: 1.5)- path.fill()- image.unlockFocus()- return image+ static func random(width: CGFloat) -> Particle {+ let shape = ConfettiShape.allCases.randomElement()!+ let dim: CGSize+ switch shape {+ case .streamer: dim = CGSize(width: .random(in: 5...8), height: .random(in: 11...16))+ case .disc: dim = CGSize(width: 9, height: .random(in: 7...10))+ case .ring: dim = CGSize(width: 10, height: .random(in: 9...13))}+ return Particle(+ x0: .random(in: 0...width),+ y0: .random(in: -60 ... -10),+ vy0: .random(in: 90...170),+ gravity: .random(in: 130...210),+ drift: .random(in: -40...40),+ swayAmp: .random(in: 8...26),+ swayFreq: .random(in: 1.4...3.0),+ phase: .random(in: 0...(2 * .pi)),+ spin: .random(in: -5...5),+ tumbleSpeed: .random(in: 2.5...5.5),+ fadeStart: .random(in: 1.3...1.9),+ color: palette.randomElement()!,+ size: dim,+ shape: shape+ )}}diff --git a/PureMac/Views/Components/DashboardCharts.swift b/PureMac/Views/Components/DashboardCharts.swiftnew file mode 100644index 0000000..d0481c7--- /dev/null+++ b/PureMac/Views/Components/DashboardCharts.swift@@ -0,0 +1,302 @@+import SwiftUI+import Charts++// MARK: - Health Ring+//+// Premium animated radial gauge that replaces the flat StorageGauge. An+// angular-gradient sweep with a soft tinted glow, a rounded cap, and a+// spring-driven fill. The center number rolls via numericText. Honors+// Reduce Motion (no spring, no idle shimmer).++struct HealthRing: View {+ /// Primary fill, 0...1 (e.g. fraction of disk used).+ let percent: Double+ var tint: Color = Tint.blue+ var warnTint: Color = Tint.orange+ var stressThreshold: Double = 0.85+ var lineWidth: CGFloat = 14+ var subtitle: LocalizedStringKey = "USED"++ @State private var sweep: Double = 0+ @State private var displayPercent: Int = 0+ @Environment(\.accessibilityReduceMotion) private var reduceMotion++ private var clamped: Double { max(0, min(1, percent)) }+ private var stress: Bool { clamped >= stressThreshold }+ private var arcColor: Color { stress ? warnTint : tint }+ private var trailColor: Color { stress ? Tint.red : Tint.purple }++ var body: some View {+ ZStack {+ Circle()+ .stroke(Color.primary.opacity(0.06), lineWidth: lineWidth)++ // Soft glow layer underneath the crisp arc.+ Circle()+ .trim(from: 0, to: sweep)+ .stroke(arcColor.opacity(0.5),+ style: StrokeStyle(lineWidth: lineWidth, lineCap: .round))+ .rotationEffect(.degrees(-90))+ .blur(radius: 9)++ Circle()+ .trim(from: 0, to: sweep)+ .stroke(+ AngularGradient(+ gradient: Gradient(colors: [arcColor.opacity(0.85), trailColor, arcColor]),+ center: .center,+ startAngle: .degrees(-90),+ endAngle: .degrees(-90 + 360 * max(sweep, 0.0001))+ ),+ style: StrokeStyle(lineWidth: lineWidth, lineCap: .round)+ )+ .rotationEffect(.degrees(-90))++ // Endpoint highlight dot for a polished finish. The dot sits at the+ // top of the ring and the whole layer rotates about the ring+ // center so it orbits to the arc's end. Radius is derived from the+ // real frame so it tracks the stroke at any size.+ if sweep > 0.02 {+ GeometryReader { geo in+ let radius = (min(geo.size.width, geo.size.height) - lineWidth) / 2+ Circle()+ .fill(.white)+ .frame(width: lineWidth * 0.42, height: lineWidth * 0.42)+ .position(x: geo.size.width / 2, y: geo.size.height / 2 - radius)+ .shadow(color: arcColor.opacity(0.7), radius: 4)+ }+ .rotationEffect(.degrees(360 * sweep))+ }++ VStack(spacing: 1) {+ Text("\(displayPercent)%")+ .font(.system(size: 44, weight: .semibold))+ .monospacedDigit()+ .contentTransition(.numericText())+ .foregroundStyle(stress ? warnTint : Color.primary)+ Text(subtitle)+ .font(.system(size: 10, weight: .semibold))+ .tracking(0.8)+ .foregroundStyle(.secondary)+ }+ }+ .onAppear { animate(to: clamped) }+ .onChange(of: clamped) { animate(to: $0) }+ }++ private func animate(to value: Double) {+ if reduceMotion {+ sweep = value+ displayPercent = Int(round(value * 100))+ return+ }+ withAnimation(.spring(response: 1.0, dampingFraction: 0.82)) {+ sweep = value+ }+ withAnimation(.easeOut(duration: 0.9)) {+ displayPercent = Int(round(value * 100))+ }+ }+}++// MARK: - Storage Donut+//+// Custom multi-segment donut (Used / Junk / Purgeable / Free) drawn from+// trimmed arcs so it works on macOS 13 (SectorMark is 14+). Segments grow in+// with a spring on appear and animate when values change.++struct StorageDonut: View {+ struct Segment: Identifiable {+ /// Stable id (e.g. "used"/"junk") so legend rows keep identity across+ /// the many @Published refreshes that rebuild this array — otherwise a+ /// fresh UUID per render replays the staggered entrance animation.+ let id: String+ let value: Double // raw byte fraction; normalized internally+ let color: Color+ let label: LocalizedStringKey+ let display: String+ }++ let segments: [Segment]+ var lineWidth: CGFloat = 16+ var gap: Double = 0.006 // angular gap between segments (fraction of circle)++ @State private var reveal: CGFloat = 0+ @Environment(\.accessibilityReduceMotion) private var reduceMotion++ private var total: Double { max(segments.reduce(0) { $0 + $1.value }, 0.0001) }++ var body: some View {+ // A single segment is a full ring — no inter-segment hairline, so the+ // gap would otherwise carve a false missing slice.+ let effectiveGap = segments.count <= 1 ? 0 : gap+ let fractions = segments.map { $0.value / total }+ var cursor = 0.0+ var ranges: [(start: Double, end: Double)] = []+ for frac in fractions {+ let start = cursor+ cursor += frac+ // Trim back the trailing edge by `gap` for a hairline between+ // segments, clamped so a tiny slice never inverts.+ ranges.append((start, max(start, cursor - effectiveGap)))+ }++ return ZStack {+ Circle().stroke(Color.primary.opacity(0.05), lineWidth: lineWidth)+ ForEach(Array(segments.enumerated()), id: \.element.id) { idx, seg in+ Circle()+ .trim(from: ranges[idx].start * reveal, to: ranges[idx].end * reveal)+ .stroke(seg.color, style: StrokeStyle(lineWidth: lineWidth, lineCap: .butt))+ .rotationEffect(.degrees(-90))+ }+ }+ .onAppear {+ if reduceMotion { reveal = 1; return }+ withAnimation(.spring(response: 1.0, dampingFraction: 0.85)) { reveal = 1 }+ }+ }+}++// MARK: - Category Bar Chart+//+// Horizontal Swift Charts bar chart of junk size per category. BarMark is+// available on macOS 13. Used in the completed-scan state to give an+// at-a-glance "where the space is" graphic above the toggle list.++struct CategoryBarChart: View {+ struct Bar: Identifiable {+ // Category is unique per bar, so derive a stable id from it.+ var id: String { category.rawValue }+ let category: CleaningCategory+ let size: Int64+ var name: String { String(localized: String.LocalizationValue(category.rawValue)) }+ }++ let bars: [Bar]++ var body: some View {+ // Reserve ~28% trailing headroom so the byte-size annotation on the+ // longest bar renders fully instead of clipping at the chart edge+ // (the macOS 14+ annotation overflowResolution isn't available here).+ let maxSize = bars.map(\.size).max() ?? 0+ let upper = max(Int64(1), Int64(Double(maxSize) * 1.28))++ return Chart(bars) { bar in+ BarMark(+ x: .value("Size", bar.size),+ y: .value("Category", bar.name)+ )+ .foregroundStyle(bar.category.color.gradient)+ .cornerRadius(5)+ .annotation(position: .trailing, alignment: .leading) {+ Text(ByteCountFormatter.string(fromByteCount: bar.size, countStyle: .file))+ .font(.system(size: 10, weight: .semibold))+ .monospacedDigit()+ .foregroundStyle(.secondary)+ }+ }+ .chartXScale(domain: 0...upper)+ .chartXAxis(.hidden)+ .chartYAxis {+ AxisMarks(preset: .aligned, position: .leading) { _ in+ AxisValueLabel()+ }+ }+ .chartLegend(.hidden)+ .frame(height: max(120, CGFloat(bars.count) * 34))+ }+}++// MARK: - Legend chip++struct LegendChip: View {+ let color: Color+ let label: LocalizedStringKey+ let value: String++ var body: some View {+ HStack(spacing: 7) {+ RoundedRectangle(cornerRadius: 3, style: .continuous)+ .fill(color)+ .frame(width: 10, height: 10)+ VStack(alignment: .leading, spacing: 0) {+ Text(label)+ .font(.system(size: 10.5))+ .foregroundStyle(.secondary)+ Text(value)+ .font(.system(size: 12, weight: .semibold))+ .monospacedDigit()+ }+ }+ }+}++// MARK: - Success medal+//+// Center checkmark with two concentric rings that expand and fade once on+// appear — a calm, premium "done" beat to pair with the freed-space number.++struct SuccessMedal: View {+ var tint: Color = Tint.green+ var size: CGFloat = 120++ @State private var pop = false+ @State private var ripple = false+ @Environment(\.accessibilityReduceMotion) private var reduceMotion++ var body: some View {+ ZStack {+ ForEach(0..<2) { i in+ Circle()+ .stroke(tint.opacity(ripple ? 0 : 0.45), lineWidth: 2)+ .scaleEffect(ripple ? 1.5 + CGFloat(i) * 0.25 : 0.7)+ }+ Circle()+ .fill(tint.opacity(0.14))+ .scaleEffect(pop ? 1 : 0.6)++ Image(systemName: "checkmark")+ .font(.system(size: size * 0.42, weight: .bold))+ .foregroundStyle(tint)+ .scaleEffect(pop ? 1 : 0.3)+ .opacity(pop ? 1 : 0)+ }+ .frame(width: size, height: size)+ .onAppear {+ if reduceMotion { pop = true; return }+ withAnimation(.spring(response: 0.5, dampingFraction: 0.6)) { pop = true }+ withAnimation(.easeOut(duration: 1.1)) { ripple = true }+ }+ }+}++// MARK: - Staggered reveal+//+// Drop-in entrance animation: fades + lifts content with a per-index delay so+// grids and lists cascade in. Honors Reduce Motion.++struct StaggeredReveal: ViewModifier {+ let index: Int+ var baseDelay: Double = 0.04+ @State private var shown = false+ @Environment(\.accessibilityReduceMotion) private var reduceMotion++ func body(content: Content) -> some View {+ content+ .opacity(shown ? 1 : 0)+ .offset(y: shown ? 0 : 10)+ .onAppear {+ if reduceMotion { shown = true; return }+ withAnimation(.spring(response: 0.5, dampingFraction: 0.85)+ .delay(Double(index) * baseDelay)) {+ shown = true+ }+ }+ }+}++extension View {+ func staggered(_ index: Int, baseDelay: Double = 0.04) -> some View {+ modifier(StaggeredReveal(index: index, baseDelay: baseDelay))+ }+}diff --git a/PureMac/Views/DashboardView.swift b/PureMac/Views/DashboardView.swiftindex d803cbe..8236a6b 100644--- a/PureMac/Views/DashboardView.swift+++ b/PureMac/Views/DashboardView.swift@@ -18,6 +18,10 @@ struct DashboardView: View {case .idle:herostats+ if appState.diskInfo.totalSpace > 0 {+ sectionHeader("Storage composition")+ storageComposition+ }if !suggestionRows.isEmpty {sectionHeader("Suggested for you")suggestions@@ -32,6 +36,7 @@ struct DashboardView: View {completedHeroif appState.totalJunkSize > 0 {sectionHeader("By category")+ categoryChartCardresultsList}case .cleaning:@@ -96,7 +101,7 @@ struct DashboardView: View {return CardSurface(padding: 24, accent: stress ? Tint.orange : Tint.blue, elevation: .raised) {HStack(alignment: .center, spacing: 28) {- StorageGauge(percentUsed: percentUsed)+ HealthRing(percent: percentUsed).frame(width: 180, height: 180)VStack(alignment: .leading, spacing: 14) {@@ -212,6 +217,7 @@ struct DashboardView: View {value: ByteCountFormatter.string(fromByteCount: free, countStyle: .file),delta: total > 0 ? freeSpaceDelta(total: total, percentUsed: percentUsed) : nil)+ .staggered(0)StatCard(icon: "trash.circle.fill",tint: Tint.orange,@@ -223,6 +229,7 @@ struct DashboardView: View {? String(localized: "Run a scan"): junkFoundDelta(count: appState.allResults.count))+ .staggered(1)StatCard(icon: "square.grid.2x2.fill",tint: Tint.purple,@@ -230,6 +237,7 @@ struct DashboardView: View {value: "\(appState.installedApps.count)",delta: String(localized: "installed"))+ .staggered(2)StatCard(icon: "memorychip.fill",tint: Tint.green,@@ -239,6 +247,7 @@ struct DashboardView: View {: "—",delta: String(localized: "APFS reclaimable"))+ .staggered(3)}}@@ -254,12 +263,66 @@ struct DashboardView: View {String(format: String(localized: "across %lld categories"), Int64(count))}+ // MARK: - Storage composition++ private var storageComposition: some View {+ let total = appState.diskInfo.totalSpace+ let free = appState.diskInfo.freeSpace+ let purge = max(0, appState.diskInfo.purgeableSpace)+ let junk = max(0, min(appState.totalJunkSize, appState.diskInfo.usedSpace))+ // "Used" excludes the junk + purgeable slices so the four segments sum+ // to the whole disk without double-counting.+ let usedCore = max(0, appState.diskInfo.usedSpace - junk - purge)++ var segments: [StorageDonut.Segment] = []+ func add(_ id: String, _ value: Int64, _ color: Color, _ label: LocalizedStringKey) {+ guard value > 0 else { return }+ segments.append(.init(+ id: id,+ value: Double(value),+ color: color,+ label: label,+ display: ByteCountFormatter.string(fromByteCount: value, countStyle: .file)+ ))+ }+ add("used", usedCore, Tint.blue, "Used")+ add("junk", junk, Tint.orange, "Junk")+ add("purgeable", purge, Tint.green, "Purgeable")+ add("free", free, Color.primary.opacity(0.14), "Free")++ return CardSurface(padding: 18, elevation: .standard) {+ HStack(alignment: .center, spacing: 24) {+ ZStack {+ StorageDonut(segments: segments)+ .frame(width: 132, height: 132)+ VStack(spacing: 1) {+ Text(ByteCountFormatter.string(fromByteCount: total, countStyle: .file))+ .font(.system(size: 17, weight: .bold))+ .monospacedDigit()+ Text("total")+ .font(.system(size: 10))+ .foregroundStyle(.secondary)+ }+ }++ VStack(alignment: .leading, spacing: 12) {+ ForEach(Array(segments.enumerated()), id: \.element.id) { idx, seg in+ LegendChip(color: seg.color, label: seg.label, value: seg.display)+ .staggered(idx)+ }+ }+ Spacer(minLength: 0)+ }+ }+ }+// MARK: - Suggestionsprivate var suggestions: some View {VStack(spacing: 10) {- ForEach(suggestionRows) { row in+ ForEach(Array(suggestionRows.enumerated()), id: \.offset) { idx, row inSuggestionRow(suggestion: row)+ .staggered(idx)}}}@@ -409,11 +472,24 @@ struct DashboardView: View {)}+ private var categoryChartCard: some View {+ let bars = appState.allResults+ .filter { $0.totalSize > 0 }+ .sorted { $0.totalSize > $1.totalSize }+ .prefix(8)+ .map { CategoryBarChart.Bar(category: $0.category, size: $0.totalSize) }++ return CardSurface(padding: 18, elevation: .standard) {+ CategoryBarChart(bars: Array(bars))+ }+ }+private var resultsList: some View {CardSurface(padding: 0) {VStack(spacing: 0) {- ForEach(appState.allResults) { result in+ ForEach(Array(appState.allResults.enumerated()), id: \.element.id) { idx, result inCategoryToggleRow(result: result)+ .staggered(idx)if result.id != appState.allResults.last?.id {Divider().padding(.leading, 54)}@@ -434,18 +510,6 @@ struct DashboardView: View {}}- @ViewBuilder- private var bigCheckmark: some View {- let base = Image(systemName: "checkmark")- .font(.system(size: 54, weight: .semibold))- .foregroundStyle(Tint.green)- if #available(macOS 14.0, *) {- base.symbolEffect(.bounce, value: appState.totalFreedSpace)- } else {- base- }- }-@ViewBuilderprivate var sparklesIcon: some View {let base = Image(systemName: "sparkles")@@ -485,12 +549,7 @@ struct DashboardView: View {private var cleanedHero: some View {CardSurface(padding: 24, accent: Tint.green, elevation: .raised) {HStack(alignment: .center, spacing: 28) {- ZStack {- Circle()- .fill(Tint.green.opacity(0.12))- bigCheckmark- }- .frame(width: 120, height: 120)+ SuccessMedal()VStack(alignment: .leading, spacing: 6) {Text(ByteCountFormatter.string(fromByteCount: appState.totalFreedSpace, countStyle: .file))@@ -595,39 +654,6 @@ private struct SuggestionRow: View {// MARK: - Gauges-private struct StorageGauge: View {- let percentUsed: Double // 0...1-- var body: some View {- let pct = max(0, min(1, percentUsed))- let displayPercent = Int(round(pct * 100))- let stress = pct > 0.85- let arcColor: Color = stress ? Tint.orange : Tint.blue-- ZStack {- Circle()- .stroke(Color.primary.opacity(0.07), lineWidth: 10)-- Circle()- .trim(from: 0, to: CGFloat(pct))- .stroke(arcColor, style: StrokeStyle(lineWidth: 10, lineCap: .round))- .rotationEffect(.degrees(-90))- .animation(.easeOut(duration: 0.7), value: pct)-- VStack(spacing: 2) {- Text("\(displayPercent)%")- .font(.system(size: 44, weight: .semibold))- .monospacedDigit()- .contentTransition(.numericText())- Text("USED")- .font(.system(size: 10, weight: .medium))- .tracking(0.6)- .foregroundStyle(.secondary)- }- }- }-}-private struct LegendDot: View {let color: Colorlet label: LocalizedStringKeydiff --git a/PureMac/Views/MainWindow.swift b/PureMac/Views/MainWindow.swiftindex e1784b5..26e57be 100644--- a/PureMac/Views/MainWindow.swift+++ b/PureMac/Views/MainWindow.swift@@ -24,6 +24,22 @@ struct MainWindow: View {appState.checkFullDiskAccess()permission.refreshStatus()}+ .onChange(of: appState.pendingExternalApp) { app in+ // A right-clicked app arrived via Finder Services — surface the+ // Installed Apps view so its related-files scan is visible.+ guard app != nil else { return }+ selectedSection = .apps+ appState.pendingExternalApp = nil+ }+ .onAppear {+ // Covers a request that landed before MainWindow mounted (cold+ // launch, or while onboarding was still showing) — onChange alone+ // fires only on subsequent changes and would miss it.+ if appState.pendingExternalApp != nil {+ selectedSection = .apps+ appState.pendingExternalApp = nil+ }+ }.onChange(of: appState.cleanErrorIsFDAFixable) { isFDAFixable in// Auto-route FDA-fixable clean errors straight into the rich// sheet — skip the generic alert entirely so the user getsdiff --git a/PureMac/ar.lproj/Localizable.strings b/PureMac/ar.lproj/Localizable.stringsindex d89bbc2..c9aaf16 100644--- a/PureMac/ar.lproj/Localizable.strings+++ b/PureMac/ar.lproj/Localizable.strings@@ -330,3 +330,8 @@"Drag this icon into the Full Disk Access list in System Settings." = "اسحب هذه الأيقونة إلى قائمة الوصول الكامل للقرص في إعدادات النظام.";"Tip: drag the icon on the left straight into the list." = "نصيحة: اسحب الأيقونة على اليسار مباشرةً إلى القائمة.";"Or drag the icon on the left straight into Settings." = "أو اسحب الأيقونة على اليسار مباشرةً إلى الإعدادات.";++/* Dashboard storage composition (v2.7.0) */+"Storage composition" = "تكوين مساحة التخزين";+"total" = "الإجمالي";+"Free" = "متاح";diff --git a/PureMac/en.lproj/Localizable.strings b/PureMac/en.lproj/Localizable.stringsindex bb28698..427abd9 100644--- a/PureMac/en.lproj/Localizable.strings+++ b/PureMac/en.lproj/Localizable.strings@@ -330,3 +330,8 @@"Drag this icon into the Full Disk Access list in System Settings." = "Drag this icon into the Full Disk Access list in System Settings.";"Tip: drag the icon on the left straight into the list." = "Tip: drag the icon on the left straight into the list.";"Or drag the icon on the left straight into Settings." = "Or drag the icon on the left straight into Settings.";++/* Dashboard storage composition (v2.7.0) */+"Storage composition" = "Storage composition";+"total" = "total";+"Free" = "Free";diff --git a/PureMac/es.lproj/Localizable.strings b/PureMac/es.lproj/Localizable.stringsindex bfdf8d1..d718615 100644--- a/PureMac/es.lproj/Localizable.strings+++ b/PureMac/es.lproj/Localizable.strings@@ -330,3 +330,8 @@"Drag this icon into the Full Disk Access list in System Settings." = "Arrastra este icono a la lista de Acceso a Todo el Disco en Ajustes del Sistema.";"Tip: drag the icon on the left straight into the list." = "Consejo: arrastra el icono de la izquierda directamente a la lista.";"Or drag the icon on the left straight into Settings." = "O arrastra el icono de la izquierda directamente a Ajustes.";++/* Dashboard storage composition (v2.7.0) */+"Storage composition" = "Composición del almacenamiento";+"total" = "total";+"Free" = "Libre";diff --git a/PureMac/ja.lproj/Localizable.strings b/PureMac/ja.lproj/Localizable.stringsindex f780153..3d1104c 100644--- a/PureMac/ja.lproj/Localizable.strings+++ b/PureMac/ja.lproj/Localizable.strings@@ -330,3 +330,8 @@"Drag this icon into the Full Disk Access list in System Settings." = "このアイコンをシステム設定のフルディスクアクセスのリストにドラッグしてください。";"Tip: drag the icon on the left straight into the list." = "ヒント: 左のアイコンをそのままリストにドラッグできます。";"Or drag the icon on the left straight into Settings." = "または左のアイコンをそのまま設定にドラッグしてください。";++/* Dashboard storage composition (v2.7.0) */+"Storage composition" = "ストレージの内訳";+"total" = "合計";+"Free" = "空き";diff --git a/PureMac/pt-BR.lproj/Localizable.strings b/PureMac/pt-BR.lproj/Localizable.stringsindex ab2153f..57c150d 100644--- a/PureMac/pt-BR.lproj/Localizable.strings+++ b/PureMac/pt-BR.lproj/Localizable.strings@@ -330,3 +330,8 @@"Drag this icon into the Full Disk Access list in System Settings." = "Arraste este ícone para a lista de Acesso Total ao Disco em Ajustes do Sistema.";"Tip: drag the icon on the left straight into the list." = "Dica: arraste o ícone da esquerda diretamente para a lista.";"Or drag the icon on the left straight into Settings." = "Ou arraste o ícone da esquerda direto para os Ajustes.";++/* Dashboard storage composition (v2.7.0) */+"Storage composition" = "Composição do armazenamento";+"total" = "total";+"Free" = "Livre";diff --git a/PureMac/zh-Hans.lproj/Localizable.strings b/PureMac/zh-Hans.lproj/Localizable.stringsindex 8b5157d..a5fe1bf 100644--- a/PureMac/zh-Hans.lproj/Localizable.strings+++ b/PureMac/zh-Hans.lproj/Localizable.strings@@ -330,3 +330,8 @@"Drag this icon into the Full Disk Access list in System Settings." = "将此图标拖入系统设置中的完整磁盘访问列表。";"Tip: drag the icon on the left straight into the list." = "提示:把左侧图标直接拖入列表。";"Or drag the icon on the left straight into Settings." = "或者把左侧图标直接拖入设置。";++/* Dashboard storage composition (v2.7.0) */+"Storage composition" = "存储构成";+"total" = "总计";+"Free" = "可用";diff --git a/PureMac/zh-Hant.lproj/Localizable.strings b/PureMac/zh-Hant.lproj/Localizable.stringsindex 6f47902..b569e40 100644--- a/PureMac/zh-Hant.lproj/Localizable.strings+++ b/PureMac/zh-Hant.lproj/Localizable.strings@@ -330,3 +330,8 @@"Drag this icon into the Full Disk Access list in System Settings." = "將此圖示拖入系統設定中的完整磁碟存取清單。";"Tip: drag the icon on the left straight into the list." = "提示:把左側圖示直接拖入清單。";"Or drag the icon on the left straight into Settings." = "或者把左側圖示直接拖入設定。";++/* Dashboard storage composition (v2.7.0) */+"Storage composition" = "儲存空間組成";+"total" = "總計";+"Free" = "可用";diff --git a/README.md b/README.mdindex e0e21fa..53ee504 100644--- a/README.md+++ b/README.md@@ -73,7 +73,7 @@ Most Mac cleaners are subscription apps that hide their disk usage behind a payw## What it does### App Uninstaller-Discovers everything in `/Applications` and `~/Applications`, then uses a 10-level matching engine (bundle ID, team identifier, entitlements, Spotlight metadata, container discovery, company-name heuristics, partial path matches) to find every file the app dropped on your disk. Three sensitivity tiers - Strict, Enhanced, Deep - let you choose how aggressive that match is. Apple system apps are excluded from the uninstall list automatically.+Discovers everything in `/Applications` and `~/Applications`, then uses a 10-level matching engine (bundle ID, team identifier, entitlements, Spotlight metadata, container discovery, company-name heuristics, partial path matches) to find every file the app dropped on your disk. Three sensitivity tiers - Strict, Enhanced, Deep - let you choose how aggressive that match is. Apple system apps are excluded from the uninstall list automatically. You can also right-click any app in Finder and choose **Services → Uninstall with PureMac** to jump straight into its related-files scan.### Orphan FinderWalks `~/Library` and surfaces files left behind by apps that no longer exist on disk. The matcher compares against bundle identifiers and normalized names of every installed app, so a leftover `~/Library/Containers/com.foo.bar` from an app you deleted in 2022 shows up clearly.@@ -107,6 +107,23 @@ What PureMac does *not* do:- It does not require a network connection to operate.- It does not move data anywhere except the Trash and `diskutil`'s APFS purge command.+## Troubleshooting++### Launchpad / Dock shows a stale or dull PureMac icon++macOS aggressively caches app icons in LaunchServices. After a Homebrew **reinstall or upgrade** the Dock and Launchpad can keep showing the old cached icon. PureMac's cask now runs `lsregister -f` on install to refresh it automatically, but if a stale icon persists, reset the cache manually:++```bash+# Clear the icon caches and rebuild the LaunchServices database+sudo rm -rfv /Library/Caches/com.apple.iconservices.store+sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; 2>/dev/null+/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister \+ -kill -r -domain local -domain user -domain system+killall Dock; killall Finder+```++Give it a minute to re-seed, then open PureMac once. If it still sticks, a restart (or Safe Mode boot) forces a full rebuild.+## Screenshots| Onboarding | App Uninstaller |diff --git a/docs/IMPROVEMENT-RESEARCH.md b/docs/IMPROVEMENT-RESEARCH.mdnew file mode 100644index 0000000..6ba4f55--- /dev/null+++ b/docs/IMPROVEMENT-RESEARCH.md@@ -0,0 +1,154 @@+# PureMac Improvement Research++> Multi-agent deep research (CleanMyMac UX, SwiftUI motion, feature gaps, icon/Launchpad cache). Generated for the v2.7.0 polish pass.++Deployment target is macOS 13.0 (constrains some APIs). I have everything needed to write the report.++# PureMac -> CleanMyMac-Grade: Engineering Report++**Constraint baseline:** Deployment target is `MACOSX_DEPLOYMENT_TARGET = 13.0` (confirmed in `.pbxproj`). This gates several premium APIs. `PhaseAnimator`/`KeyframeAnimator`/`.symbolEffect`/`.contentTransition(.numericText)`/`SectorMark` selection require macOS 14+; `.scrollTransition`/`.visualEffect` are macOS 14+; `TextRenderer`/zoom transitions are macOS 15+. **Recommendation: raise the floor to macOS 14.0** — it unlocks ~80% of the premium toolkit (Swift Charts `SectorMark`, symbol effects, numeric text, phase/keyframe animators) at minimal user-base cost given macOS 14 shipped 2023. Where I list a 14+ API, a macOS 13 fallback is noted. Existing confetti, dashboard, and onboarding files are at `PureMac/Views/{DashboardView.swift, OnboardingView.swift, Components/ConfettiView.swift}`.++---++## 1. UI/UX Direction — SwiftUI Changes for CleanMyMac-Grade Polish++CleanMyMac's premium feel is not one trick; it is five stacked systems — organic geometry, a warm gradient color language, sensory layering (parallax + translucency + sound), tight micro-interaction timing, and glassmorphic depth [cleanmymac-ux ^1][^3]. Translate each into the existing SwiftUI surfaces.++### 1.1 Dashboard — tile-based information architecture+Replace any list-first dashboard with a `LazyVGrid` of 2-3 module tiles (Cleanup, Apps, Orphans, Storage, Large/Old, Schedule), each a summary stat + "Review"/"Clean" actions — progressive disclosure removes the wall-of-text intimidation factor [cleanmymac-ux ^10]. Edit `PureMac/Views/DashboardView.swift`.++- Each tile gets its **own gradient pair** for wayfinding without labels (Cleanup pink→blue, Storage blue→purple, Apps pink→lavender) [cleanmymac-ux ^1].+- Tile container: `.background(.ultraThinMaterial)` + `.overlay(RoundedRectangle(cornerRadius: 16).stroke(.white.opacity(0.18), lineWidth: 1))`, placed above a `LinearGradient` window backdrop. Glassmorphism only shines over vibrant saturated backgrounds — not flat gray [cleanmymac-ux ^7][^8].+- Hover elevation per tile: `.scaleEffect(isHovered ? 1.03 : 1.0)` + `.shadow(radius: isHovered ? 30 : 10)` + `.animation(.smooth(duration: 0.22), value: isHovered)`. Tap feedback `.scaleEffect(0.92)` with `.snappy(duration: 0.18)` [cleanmymac-ux ^4][^6].++### 1.2 Geometry — organic, not mechanical+Standardize on 16pt corner radius minimum; avoid perfect circles and hard corners. CleanMyMac deliberately uses superellipse/squircle shapes because "sterile, perfect objects repel people" [cleanmymac-ux ^2][^3]. SwiftUI: `RoundedRectangle(cornerRadius: 16, style: .continuous)` (the `.continuous` style is the system squircle — use it everywhere, it is the single cheapest organic-feel win).++### 1.3 Scan reveal — sequential, masked, motion-designed+The existing radial gauges are the right foundation. Upgrade the reveal:+- **Gauge fill**: keep `Circle().trim(from:0,to:progress).stroke(gradient, lineWidth:)` with `.rotationEffect(.degrees(-90))` and `.animation(.linear, value: progress)` for the live sweep [swiftui-motion].+- **Results stagger**: as categories resolve, reveal tiles sequentially (not simultaneously) — `.transition(.scale.combined(with:.opacity))` with per-tile `.animation(.spring(duration:0.5, bounce:0.2).delay(index * 0.06))`. Sequential timing is what reads as "designed" vs. a dump [cleanmymac-ux ^11].+- **Freed-space counter**: animate the GB number with `.contentTransition(.numericText(value:))` (macOS 14+; on 13 fall back to a `TimelineView`-driven interpolated `Text`) [swiftui-motion].+- **Completion**: spring settle on the gauge + `withAnimation(...) { } completion: { Haptics.success(); confetti }` using the completion-handler API so haptic/confetti fire exactly when the animation settles, not on a guessed timer [swiftui-motion].++### 1.4 Motion timing table (apply globally)+| Interaction | Duration | Curve | Effect |+|---|---|---|---|+| Tap | 180ms | `.snappy` | scale 1.0→0.92 |+| Hover | 220ms | `.smooth` | scale 1.0→1.03, shadow 10→30 |+| Reveal/context change | 400-600ms | spring bounce 0.2 | tile/scale-in |+| Idle pulse (CTA) | 1200ms loop | `.repeatForever(autoreverses:)` | scale 1.0→1.08 |++Keep bounce ≤ 0.30 for UI; never exceed 0.40 [cleanmymac-ux ^4][^6][swiftui-motion]. CTAs and category icons get SF Symbol feedback via `.symbolEffect(.bounce, value:)` on completion and `.symbolEffect(.pulse)` while scanning (macOS 14+; free + accessible) [swiftui-motion].++### 1.5 Graphs / charts — the biggest visible gap+Adopt **Swift Charts** (macOS 14+) for storage breakdown — this is the single feature that most reads as "premium graphical tool":+- **Donut** via `SectorMark(angle:.value(...), innerRadius:.ratio(0.618), angularInset:1.5).cornerRadius(5).foregroundStyle(by:)`, with `.chartBackground` centering total-storage text in the hole [swiftui-motion].+- **Segmented usage bar** for the dashboard header via `BarMark` stacked by file-type category.+- **Interactivity**: `.chartAngleSelection` to dim non-selected sectors to 0.3 opacity on hover/click [swiftui-motion].+- macOS 13 fallback: `Canvas` arc drawing (hardware-accelerated) for the donut — pattern in [swiftui-motion]. Existing gauges already prove the team can do `Canvas`/`trim`.++### 1.6 Color & depth+Define 3 module gradient pairs as `Theme` tokens (extend `PureMac/Extensions/Theme.swift`); test all over light/dark via `NSColor` dynamic providers. Use `.ultraThinMaterial` for floating panels, vibrant gradient for window background — layered planes are what flat design cannot reproduce [cleanmymac-ux ^1][^7][^8]. Add a subtle parallax: a low-opacity (0.6-0.8) gradient layer with a 2-3s offset loop behind the hero gauge for atmospheric depth [cleanmymac-ux ^1].++### 1.7 Sound + accessibility (mandatory)+- Success chime `NSSound(named: "Glass")?.play()`, error `NSSound(named: "Basso")` — fire in sync with the visual, not after [cleanmymac-ux ^3][^9]. macOS has no Taptic Engine; the existing `Haptics.swift` likely uses `NSHapticFeedbackManager` for trackpad — keep that paired with sound.+- **Gate every animation** on `@Environment(\.accessibilityReduceMotion)`: `.animation(reduceMotion ? nil : .spring, value:)`. When motion conveys status, swap for a dissolve/color-fade, don't just drop it. App Store reduced-motion criteria require this [swiftui-motion].++---++## 2. Confetti Redesign++Current `ConfettiView.swift` is a `CAEmitterLayer` line emitter dropping 6 rounded-rect colors straight down with `yAcceleration: 240`, `spin: 4`, `scale: 0.35`. It reads "horrible" because: (a) gravity-only fall with no upward burst looks like falling debris, not celebration; (b) flat 2D rectangles with no 3D tumble; (c) saturated primary palette clashes with a premium muted aesthetic [cleanmymac-ux ^3 — "muted, timeless palette, not neon acid tones"]; (d) uniform scale and a single rectangle shape.++**Tasteful replacement — two viable paths:**++**Option A (recommended, on-brand, low risk): refine the existing emitter.** Keep `CAEmitterLayer` (it correctly stays off the SwiftUI render thread — that part is right) but redesign the physics and look:+- **Center-burst, not top-drop**: `emitterShape = .point`, `emitterPosition` at the gauge center, `emissionRange = .pi * 2` (full radial), high initial `velocity` (~300) with negative-then-positive arc via `yAcceleration` — particles shoot up/out then gently fall. This is celebratory, not raining.+- **3D tumble**: drive `emissionLongitude` variation + higher `spinRange`, and ship 2-3 particle shapes (thin rectangle, small circle, tiny streamer) instead of one rounded rect.+- **Muted premium palette**: desaturate the current colors ~20-30% and add the module gradient hues (soft pink, periwinkle, mint, peach) — drop the pure-orange/pure-yellow neon [cleanmymac-ux ^3][^5].+- **Density & decay**: fewer particles (lower `birthRate`), faster `alphaSpeed` fade, total life ≤ 2s. Restraint reads premium.++**Option B (most premium, macOS 14+): native SwiftUI particle burst** using `KeyframeAnimator` over a `Canvas`. Spawn ~40 particles each with `(position, rotation3D, scale, opacity)` as an `Animatable`/`VectorArithmetic` struct; keyframe an arc (SpringKeyframe up, CubicKeyframe down) with independent rotation tracks for tumble [swiftui-motion]. Fully deterministic, GPU-cheap via `Canvas`, and matches the rest of the motion system. More work than A; do it as a follow-up.++Either way: fire on the animation **completion handler** (§1.3), respect `reduceMotion` (suppress confetti entirely, keep the sound), and trigger only on a genuine cleanup-complete with non-trivial space freed — celebration inflation cheapens it.++---++## 3. Missing Features — Prioritized++| Feature | User value | Effort | How |+|---|---|---|---|+| **Menu bar widget** | HIGH — discoverability, always-visible CTA, 1-click scan; no OSS cleaner has it [feature-gaps] | LOW (3-4d) | `NSStatusBar` item + `NSPopover` (or `MenuBarExtra` scene, macOS 13+). Show storage used/free %, "Run Scan", last-cleanup date. |+| **Disk-space visualization (sunburst/treemap)** | HIGH — the DaisyDisk/Space-Lens insight users pay $30 for; "see what eats space" without a list [feature-gaps] | MED-HIGH (2-3w) | `Canvas`/Core Graphics sunburst, click-to-drill-down, color by file type, exclude system by default. macOS 13-safe via Canvas. |+| **Duplicate file finder** | HIGH — 2-10 GB typical recovery [feature-gaps] | MED (2-3w) | Size-bucket → partial hash → full SHA fingerprint; xattr-cache hashes; filetype-aware (EXIF/MP3 tags); reference-dir safety (keep originals, delete only from chosen dirs). |+| **Large/Old files filter presets** | MED-HIGH — reuses existing scanner; power-user control [feature-gaps] | LOW (3-5d) | Add size slider + date picker + location scope to existing "Large & Old"; ship presets (Old Backups >5y, Bulky Media >1GB, Installers >500MB matching `.dmg/.pkg`); persist custom presets to `UserDefaults`. |+| **Login items / launch agents manager** | MED — boot-time bloat, no good OSS tool [feature-gaps] | MED-HIGH (1-2w) | Parse `~/Library/LaunchAgents`, `/Library/LaunchAgents`, daemons; PropertyList parse via Foundation; table (App/Label/Executable/toggle/delete); warn on Apple system agents; cross-ref `launchctl list`. |+| **Finder right-click "Uninstall with PureMac"** | MED-HIGH — removes drag/launch friction [feature-gaps] | MED (5-7d) | App Extension (Finder/Action extension) registered for `.app` bundles; launch host with bundle URL arg → pre-populate the existing uninstaller (`AppPathFinder`). |+| **Real-time monitoring (CPU/RAM/disk)** | LOW-MED — Sensei-style, mostly background value [feature-gaps] | MED (1-2w) | Defer to Phase 3. |+| **Malware/security scan** | MED (FUD-driven) [feature-gaps] | LOW value/HIGH cost (2-4w) | Defer; signature DB upkeep is a long-term liability. |++Engine is already ahead of AppCleaner/Pearcleaner; the entire gap to CleanMyMac is UX + visualization + these secondary features, not core capability [feature-gaps].++---++## 4. App Icon + Launchpad Cache Fix++### 4.1 Why the icon renders "abnormal" / dull+A near-white icon (≥ `#F5F5F5`) has insufficient contrast for macOS's Liquid-Glass specular/translucency layer, rendering dull/blank — worst in the Dock when the app is running [icon-launchpad]. Fix the asset, not just the cache.++### 4.2 Design guidance (asset fixes)+Edit the source art behind `PureMac/Assets.xcassets/AppIcon.appiconset`:+- **Do NOT bake rounded corners** — the OS applies the squircle/superellipse mask (~22.37% width radius, ~60% smoothing). Provide square layers [icon-launchpad].+- **512×512 canvas, 50px transparent padding all sides; primary content within the centered 412×412** — edge-to-edge fill makes the icon look 20-30% oversized in Dock/Launchpad [icon-launchpad].+- **Contrast ≥ 3:1** vs. background (prefer 4.5:1+ in grids); avoid solid light grays ≥ `#D0D0D0` as the primary color; **test light + dark mode** [icon-launchpad]. Give the near-white mark a saturated/dark backplate or gradient so Liquid Glass has something to catch.+- Vector (SVG/PDF) foreground; PNG only for raster/gradient layers [icon-launchpad].++### 4.3 Exact cache remediation (post-Homebrew-cask reinstall)+```bash+# 1. Kill UI processes+killall Dock+killall Finder++# 2. Clear icon caches+sudo rm -rfv /Library/Caches/com.apple.iconservices.store+sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \;++# 3. Rebuild LaunchServices (maps app bundles -> icons; critical after a cask relocation)+/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain user -domain system -v++# 4. Restart Dock/Finder+sleep 3+killall Dock+killall Finder+```+Allow 2-5 min for the LaunchServices DB to re-seed (system runs slower during rebuild); open PureMac once to force re-registration. If still stale, Safe Mode restart (Shut down → power on holding **Shift** through login → wait 5 min → restart normally) forces a rebuild with no third-party interference [icon-launchpad].++Faster user-domain-only LaunchServices variant for dev iteration: append `-apps u` instead of the `-domain` flags [icon-launchpad].++---++## 5. Ship THIS Release vs. Follow-Ups++### Ship now (low effort, high visible impact, macOS 13-safe)+1. **Confetti Option A** — refine the existing emitter (center burst, 3D tumble, muted palette, completion-handler trigger, reduce-motion gate). Hours, not days; directly fixes the "looks horrible" complaint. §2.+2. **`.continuous` corner radius + glass + hover/tap micro-interactions** across dashboard tiles — the cheapest premium-feel uplift, no new APIs. §1.1-1.4.+3. **Sound + `accessibilityReduceMotion` gating** on all existing animations — mandatory polish + App Store compliance, ~1 day. §1.7.+4. **Sequential staggered scan-reveal** using existing transitions/springs. §1.3.+5. **Large/Old files filter presets** (3-5d, reuses scanner). §3.+6. **App icon contrast/padding fix + documented cache-reset script** shipped in the README/troubleshooting. §4.++### Follow-up release (raise floor to macOS 14 first)+7. **Menu bar widget** (`MenuBarExtra`) — highest-ROI new feature, 3-4d. §3.+8. **Swift Charts donut + segmented storage bar** with selection. §1.5.+9. **Numeric-text freed-space counter** + `.symbolEffect` icon feedback. §1.3-1.4.+10. **Confetti Option B** (native Canvas/KeyframeAnimator particles). §2.++### Later phases+11. Disk-space sunburst visualization (2-3w). 12. Duplicate finder (2-3w). 13. Login-items manager (1-2w). 14. Finder context-menu extension (5-7d). Defer real-time monitoring + malware scan. §3.++---++**Files to touch:** `PureMac/Views/DashboardView.swift` (tiles, charts, reveal), `PureMac/Views/Components/ConfettiView.swift` (redesign), `PureMac/Extensions/Theme.swift` (gradient/color tokens), `PureMac/Services/Haptics.swift` (sound+haptic pairing), `PureMac/Assets.xcassets/AppIcon.appiconset` (icon art), and the `.pbxproj` `MACOSX_DEPLOYMENT_TARGET` (13.0 → 14.0 for the follow-up wave). New: a `MenuBarExtra` scene in `PureMac/PureMacApp.swift`, a `StorageChartView`, and an `AppExtension` target for Finder integration.++**Citation key:** [cleanmymac-ux] = CleanMyMac UX brief (Behance/Novikov ^1-3, micro-interactions ^4/^6, color ^5, glass ^7/^8, audio-haptic ^9, Smart Care ^10, reveal ^11); [swiftui-motion] = SwiftUI/macOS 2026 motion brief (Apple WWDC23-25 docs); [feature-gaps] = competitive feature brief (CleanMyMac X, DaisyDisk, Sensei, dupeGuru, Pearcleaner); [icon-launchpad] = icon/cache brief (Apple HIG, Eclectic Light, squircle.js.org, ithy.com Sequoia guide).\ No newline at end of filediff --git a/homebrew/puremac.rb b/homebrew/puremac.rbindex b9c98b6..bc1734f 100644--- a/homebrew/puremac.rb+++ b/homebrew/puremac.rb@@ -9,6 +9,13 @@ cask "puremac" doapp "PureMac.app"+ # Refresh LaunchServices so the Dock/Launchpad icon updates immediately on+ # (re)install instead of showing a stale cached icon (issue #111).+ postflight do+ system_command "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister",+ args: ["-f", "#{appdir}/PureMac.app"]+ end+zap trash: ["~/Library/Preferences/com.puremac.app.plist","~/Library/Caches/com.puremac.app",diff --git a/project.yml b/project.ymlindex ccb459c..649f8ac 100644--- a/project.yml+++ b/project.yml@@ -23,8 +23,8 @@ settings:CODE_SIGN_ENTITLEMENTS: "PureMac/PureMac.entitlements"INFOPLIST_FILE: "PureMac/Info.plist"PRODUCT_BUNDLE_IDENTIFIER: "com.puremac.app"- MARKETING_VERSION: "2.6.1"- CURRENT_PROJECT_VERSION: "13"+ MARKETING_VERSION: "2.7.0"+ CURRENT_PROJECT_VERSION: "14"GENERATE_INFOPLIST_FILE: "NO"ASSETCATALOG_COMPILER_APPICON_NAME: "AppIcon"COMBINE_HIDPI_IMAGES: "YES"