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
Release 3.2.0 with Apple feature guides and safer cleanup
momenbaselb4e28d22af21
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 49b4aef..d67f168 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -350,6 +350,13 @@ jobs:echo "- XcodeBuildMCP and MobileBuildMCP DerivedData in Xcode Junk, opt-in and Trash-only (#162)."echo "- The Protection check recognizes the firewall's block-all mode (#183), and the Homebrew cask no longer warns about postflight (#182)."echo ""+ elif [[ "${VERSION}" == "3.2.0" ]]; then+ echo "- Added Apple Features with shortcuts and instructions for Siri, Apple Intelligence, image generation, Writing Tools, ChatGPT, summaries, and privacy settings. Changes are completed manually in macOS."+ echo "- Inspect Apple model, screen saver, music content, and device backup storage. Protected models and system apps are not removed."+ echo "- Review individual iPhone and iPad backups and move selected completed backups to Trash after confirmation and fresh checks."+ echo "- Fixed Ollama and LM Studio cleanup with strict path checks and user-level removal; downloaded models remain excluded."+ echo "- Simplified Overview and navigation, reduced decoration, and added full paths and removal methods to category cleanup confirmation."+ echo ""elif [[ "${VERSION}" == "2.9.8" ]]; thenecho "### What changed"echo ""diff --git a/PureMac.xcodeproj/project.pbxproj b/PureMac.xcodeproj/project.pbxprojindex f842455..40fa917 100644--- a/PureMac.xcodeproj/project.pbxproj+++ b/PureMac.xcodeproj/project.pbxproj@@ -19,6 +19,8 @@27673871ECFD189E98548956 /* UpdateServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90D25BB11E61105B8764009E /* UpdateServiceTests.swift */; };27F449EDD1B082FE11FEC9DF /* SchedulerService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28181F034530331A550C6A3D /* SchedulerService.swift */; };2BCDC53C5E3AB58442C8E4B0 /* CleaningEngineTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 22B679C0120F1E3DDCB27FE2 /* CleaningEngineTests.swift */; };+ 2C3AD1E4511D0F07C8C7C9D1 /* DeviceBackupService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D7ABF3991A1C11BC5728FC6 /* DeviceBackupService.swift */; };+ 30D4A73B94B245DB4EB21B6B /* AppleStorageService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F9E767232924C819946DAAC /* AppleStorageService.swift */; };340E424F759ACCDE7372F99F /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5ADDC35F31E40780FB5D017 /* Theme.swift */; };39BEE5E2BEC526CCADFC9DDD /* ServicesMenu.strings in Resources */ = {isa = PBXBuildFile; fileRef = 57FBBF8C7EF27C8E09126ED5 /* ServicesMenu.strings */; };41B27CACD7C6C7471EFD03F9 /* UpdateService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 022D0EAEE2B6E54069FC2CBE /* UpdateService.swift */; };@@ -32,7 +34,9 @@5882104828B9C5A5E06B2AFB /* PerformanceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D84FB753A60BE6BF54D5126A /* PerformanceView.swift */; };59B3096E2AE8ED0397B16798 /* AppLanguagePreferencesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 491771F923C93FD61A263893 /* AppLanguagePreferencesTests.swift */; };5ED9C7AA76D850363CDC127C /* SimilarPhotosView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3C3342D6386FBB6DE3D18BC /* SimilarPhotosView.swift */; };+ 5FF5942BC279628276CF6543 /* DeviceBackupServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D0D0E67A3C5B3740B858AD8 /* DeviceBackupServiceTests.swift */; };61D285E96DED76FDCD54570F /* PermissionSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 069AAE87E3F9EDE5593AD8B3 /* PermissionSheet.swift */; };+ 668F6FC8967E338CC49D27D0 /* AppleFeaturesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95DCCE76F044F71BCBD8CE0C /* AppleFeaturesView.swift */; };6753946A301B2EB2FEF6998B /* SimulatorRuntimeSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74E66594478F53363BCB0F9 /* SimulatorRuntimeSupport.swift */; };68F9CE5ED4908F674D673FB2 /* BinaryThinner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69B24B648B82186FC3B6EF2B /* BinaryThinner.swift */; };6BCC5E3773DF2E9189F75A6B /* CleanupReviewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6116C5E9B68F439F6B2E42E5 /* CleanupReviewTests.swift */; };@@ -40,12 +44,15 @@6D449325D54B9850FC6C119F /* UniversalBinaryScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95EC878D25C244BF94D0094C /* UniversalBinaryScanner.swift */; };6E296DC4405F5912A76EFF68 /* ProcessResourcesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48F804C73B6DD4F8619B25B5 /* ProcessResourcesView.swift */; };6E72022A661CBB41331A442C /* PermissionCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9DCBD97CC88D77AE8DB01A4 /* PermissionCoordinator.swift */; };+ 7026A36B071FDFE87CF5B1BD /* AppleFeature.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98831CC736A3839B67CA47D1 /* AppleFeature.swift */; };74175B10C464D245E99BA6DB /* DuplicateFinderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1343918E4CD9C8DA99EFA588 /* DuplicateFinderView.swift */; };75B5F0401D37F2872B1AD85A /* AppListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60E6BC61614B27C065BB18C9 /* AppListView.swift */; };76B132F9C499225D33E0D075 /* EmptyStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 424F7B28624C271620E13BBC /* EmptyStateView.swift */; };7796BCD9AB92D1A644C28AF3 /* StorageExplorer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CF68B6BB9ED70387DF56728 /* StorageExplorer.swift */; };+ 7E881F4DEEE1E4B0FA44BEB2 /* AIAppsCleanupTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1104B86347C5671A5FC64BA /* AIAppsCleanupTests.swift */; };826A750D2D7EC14C2AE306A3 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3667D46D8E2004EB4D73835A /* Models.swift */; };8947F0CE448791BD50EECF46 /* Conditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB94E06E145558123BB5BFB3 /* Conditions.swift */; };+ 89D5B9A5B4F25EA729B5B08B /* DeviceBackupCoordinationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BA1FC37E3821117365707CD /* DeviceBackupCoordinationTests.swift */; };8B541441926847072DC5B75B /* DashboardCharts.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C60E04A0CA3F227816DB63 /* DashboardCharts.swift */; };91751CF033E1541BFD39B12C /* MenuBarMonitorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A27DB5A70FA829B6C3ED0AC3 /* MenuBarMonitorView.swift */; };93743B036059418560D876E6 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A8D39C3C250F26302EC45AB /* SettingsView.swift */; };@@ -86,11 +93,13 @@E2403D82F00D749C9AD4A6D4 /* AppStateTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 752603285F7DBBA12BB3AA91 /* AppStateTests.swift */; };E4145581C55556DB43725FBB /* NodeCachePathTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5984F53676A523D97AF2A89 /* NodeCachePathTests.swift */; };E4A14812146CC0A379644E74 /* CleanupExclusions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDBC9DA7C5043AD9A873BA03 /* CleanupExclusions.swift */; };+ E4E8308D3BBE72B5A72554ED /* AppleStorageServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3006DF98485FFC3C40308A22 /* AppleStorageServiceTests.swift */; };E60B0A2C5D0A6CAE35BF4DFB /* Locations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77D3D9A9BC52839E6D0A22BC /* Locations.swift */; };E69ECB1F931950E9DE5BE251 /* PerformanceInspector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C8619CA3ECD70CBBC96475C /* PerformanceInspector.swift */; };E726702EABBE56155861DBA9 /* AppLanguage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82BB0904726B38DEB141BECA /* AppLanguage.swift */; };E92B2068E8D0A381A2F10D72 /* AppUpdateSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 312E528C94C7302138EFA9DE /* AppUpdateSettingsView.swift */; };EDEF28CAD23E936FBED1783B /* PureMacApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63581B70F9B10231964E3602 /* PureMacApp.swift */; };+ F1908A8EFDD078AB512425B9 /* AppleFeatureCatalogTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62BA83A253E17A3C61060556 /* AppleFeatureCatalogTests.swift */; };F1F506C146E17D6CEC4A12F3 /* AppInfoFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23486A54A82EE3865B784D1C /* AppInfoFetcher.swift */; };F2FA881A4B2209CC2A6342FB /* CLI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01B2C5F66B6D812572BD4F05 /* CLI.swift */; };F4F02F966001A1504C2B4D33 /* SimulatorRuntimeSupportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7D81BE7EA5DB17F4A0300AD /* SimulatorRuntimeSupportTests.swift */; };@@ -137,6 +146,7 @@28181F034530331A550C6A3D /* SchedulerService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SchedulerService.swift; sourceTree = "<group>"; };2A8DE5D45BA19E2670B57DC5 /* CleaningEngine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CleaningEngine.swift; sourceTree = "<group>"; };2D3F9FEDC493A8E49E910F67 /* AppBundleDragHandle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppBundleDragHandle.swift; sourceTree = "<group>"; };+ 3006DF98485FFC3C40308A22 /* AppleStorageServiceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleStorageServiceTests.swift; sourceTree = "<group>"; };311078221878708524283765 /* PureMac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PureMac.app; sourceTree = BUILT_PRODUCTS_DIR; };312E528C94C7302138EFA9DE /* AppUpdateSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppUpdateSettingsView.swift; sourceTree = "<group>"; };340D303C60FF878B019056B6 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };@@ -155,6 +165,7 @@491771F923C93FD61A263893 /* AppLanguagePreferencesTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLanguagePreferencesTests.swift; sourceTree = "<group>"; };4AE790496C936424EF98320A /* OrphanSafetyPolicy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrphanSafetyPolicy.swift; sourceTree = "<group>"; };4C167DFBCD14DC84725EF15F /* CleanupExclusionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CleanupExclusionsTests.swift; sourceTree = "<group>"; };+ 4D0D0E67A3C5B3740B858AD8 /* DeviceBackupServiceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceBackupServiceTests.swift; sourceTree = "<group>"; };53CEAEA91A097FE8FF2FFDA0 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/InfoPlist.strings; sourceTree = "<group>"; };55CE234DB2DB54ED53A4EFD6 /* ThemeManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeManagerTests.swift; sourceTree = "<group>"; };5664D2BDAEAA9AE3A53DB364 /* PureMac.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PureMac.entitlements; sourceTree = "<group>"; };@@ -168,8 +179,10 @@607B9A8C7B34D6A7DCF4FFE2 /* PureMacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PureMacTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };60E6BC61614B27C065BB18C9 /* AppListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppListView.swift; sourceTree = "<group>"; };6116C5E9B68F439F6B2E42E5 /* CleanupReviewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CleanupReviewTests.swift; sourceTree = "<group>"; };+ 62BA83A253E17A3C61060556 /* AppleFeatureCatalogTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleFeatureCatalogTests.swift; sourceTree = "<group>"; };63581B70F9B10231964E3602 /* PureMacApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PureMacApp.swift; sourceTree = "<group>"; };69B24B648B82186FC3B6EF2B /* BinaryThinner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BinaryThinner.swift; sourceTree = "<group>"; };+ 6BA1FC37E3821117365707CD /* DeviceBackupCoordinationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceBackupCoordinationTests.swift; sourceTree = "<group>"; };6ED5C9C10C69C3143B1F5CA6 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/ServicesMenu.strings; sourceTree = "<group>"; };6F9B44A9C1B4065126789622 /* ProtectionAudit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProtectionAudit.swift; sourceTree = "<group>"; };752603285F7DBBA12BB3AA91 /* AppStateTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStateTests.swift; sourceTree = "<group>"; };@@ -184,12 +197,16 @@8CF68B6BB9ED70387DF56728 /* StorageExplorer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StorageExplorer.swift; sourceTree = "<group>"; };8D5E63D733D1A3BDEDF4DCA5 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Localizable.strings"; sourceTree = "<group>"; };8F97E4CB93302BFE911DB1FF /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/Localizable.strings; sourceTree = "<group>"; };+ 8F9E767232924C819946DAAC /* AppleStorageService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleStorageService.swift; sourceTree = "<group>"; };90D25BB11E61105B8764009E /* UpdateServiceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateServiceTests.swift; sourceTree = "<group>"; };913E3064AA9BD7BE94A315CF /* MenuBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarController.swift; sourceTree = "<group>"; };92259B3E9F4468865F15DEEC /* AppearancePill.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppearancePill.swift; sourceTree = "<group>"; };+ 95DCCE76F044F71BCBD8CE0C /* AppleFeaturesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleFeaturesView.swift; sourceTree = "<group>"; };95EC878D25C244BF94D0094C /* UniversalBinaryScanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UniversalBinaryScanner.swift; sourceTree = "<group>"; };97BF6BD57F76AECB9F92A421 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/ServicesMenu.strings; sourceTree = "<group>"; };+ 98831CC736A3839B67CA47D1 /* AppleFeature.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppleFeature.swift; sourceTree = "<group>"; };994C41A99AC1061D79486AEE /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/ServicesMenu.strings; sourceTree = "<group>"; };+ 9D7ABF3991A1C11BC5728FC6 /* DeviceBackupService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceBackupService.swift; sourceTree = "<group>"; };9F04B811BB0012F6D2F07F91 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };9F510F232341EE18F11DC934 /* MainWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainWindow.swift; sourceTree = "<group>"; };A27DB5A70FA829B6C3ED0AC3 /* MenuBarMonitorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuBarMonitorView.swift; sourceTree = "<group>"; };@@ -202,6 +219,7 @@B71E8F62DB76D85F41F9A2E9 /* OrphanListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrphanListView.swift; sourceTree = "<group>"; };B97348789EA68B1ABADB1421 /* SimilarPhotoFinder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimilarPhotoFinder.swift; sourceTree = "<group>"; };C0899FE169D270DF95334905 /* LanguageFilesScanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LanguageFilesScanner.swift; sourceTree = "<group>"; };+ C1104B86347C5671A5FC64BA /* AIAppsCleanupTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AIAppsCleanupTests.swift; sourceTree = "<group>"; };C4332033E243C3571C49A5E9 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };C5963EBBEE5BA6E147700821 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };C5ADDC35F31E40780FB5D017 /* Theme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = "<group>"; };@@ -243,12 +261,17 @@261FB8D961FEC76F15EA523A /* PureMacTests */ = {isa = PBXGroup;children = (+ C1104B86347C5671A5FC64BA /* AIAppsCleanupTests.swift */,491771F923C93FD61A263893 /* AppLanguagePreferencesTests.swift */,+ 62BA83A253E17A3C61060556 /* AppleFeatureCatalogTests.swift */,+ 3006DF98485FFC3C40308A22 /* AppleStorageServiceTests.swift */,F77B9D7D5353CD42BD03ADBB /* ApplicationUpdaterTests.swift */,752603285F7DBBA12BB3AA91 /* AppStateTests.swift */,22B679C0120F1E3DDCB27FE2 /* CleaningEngineTests.swift */,4C167DFBCD14DC84725EF15F /* CleanupExclusionsTests.swift */,6116C5E9B68F439F6B2E42E5 /* CleanupReviewTests.swift */,+ 6BA1FC37E3821117365707CD /* DeviceBackupCoordinationTests.swift */,+ 4D0D0E67A3C5B3740B858AD8 /* DeviceBackupServiceTests.swift */,D379BB1C513985CF9AB783D5 /* DuplicateFinderTests.swift */,155CE1B8CDCCCA6F9FD028C1 /* LocalizationFilesTests.swift */,0621A14395DCA19EC2995842 /* MonitoringLifecycleTests.swift */,@@ -270,6 +293,7 @@isa = PBXGroup;children = (82BB0904726B38DEB141BECA /* AppLanguage.swift */,+ 98831CC736A3839B67CA47D1 /* AppleFeature.swift */,D00EEBBBA38CC4B3F8077E7D /* CleanupReview.swift */,3667D46D8E2004EB4D73835A /* Models.swift */,EEF15CB1B8EFCA78EF491824 /* ScanError.swift */,@@ -280,6 +304,7 @@3FF7D3D9EA9340F29D4811FC /* Tools */ = {isa = PBXGroup;children = (+ 95DCCE76F044F71BCBD8CE0C /* AppleFeaturesView.swift */,5A0AF1B9C42A20B6C9FC2DD9 /* AppUpdatesView.swift */,1343918E4CD9C8DA99EFA588 /* DuplicateFinderView.swift */,D84FB753A60BE6BF54D5126A /* PerformanceView.swift */,@@ -319,10 +344,12 @@6184B2EC3D01E6E95633406E /* Services */ = {isa = PBXGroup;children = (+ 8F9E767232924C819946DAAC /* AppleStorageService.swift */,59873E44B520DE069F80CCD6 /* ApplicationUpdater.swift */,69B24B648B82186FC3B6EF2B /* BinaryThinner.swift */,2A8DE5D45BA19E2670B57DC5 /* CleaningEngine.swift */,EDBC9DA7C5043AD9A873BA03 /* CleanupExclusions.swift */,+ 9D7ABF3991A1C11BC5728FC6 /* DeviceBackupService.swift */,089D484A0482787027665936 /* DuplicateFinder.swift */,E866A1541D289C69144A5E62 /* FullDiskAccessManager.swift */,40A3F22FCEF534DE4A2CAD0E /* Haptics.swift */,@@ -588,6 +615,9 @@E92B2068E8D0A381A2F10D72 /* AppUpdateSettingsView.swift in Sources */,C85B54037A5989A85968F328 /* AppUpdatesView.swift in Sources */,95278ABDCF5F4D6AC60503B1 /* AppearancePill.swift in Sources */,+ 7026A36B071FDFE87CF5B1BD /* AppleFeature.swift in Sources */,+ 668F6FC8967E338CC49D27D0 /* AppleFeaturesView.swift in Sources */,+ 30D4A73B94B245DB4EB21B6B /* AppleStorageService.swift in Sources */,0BB6BC2EAFB02407FBC6CDA6 /* ApplicationUpdater.swift in Sources */,68F9CE5ED4908F674D673FB2 /* BinaryThinner.swift in Sources */,F2FA881A4B2209CC2A6342FB /* CLI.swift in Sources */,@@ -599,6 +629,7 @@ABDDD4F35102A39CC1A2C325 /* ConfettiView.swift in Sources */,8B541441926847072DC5B75B /* DashboardCharts.swift in Sources */,A2AE68CC75CB72D6B10CBDF5 /* DashboardView.swift in Sources */,+ 2C3AD1E4511D0F07C8C7C9D1 /* DeviceBackupService.swift in Sources */,D0E6B0AFF83228F121B4DDD3 /* DuplicateFinder.swift in Sources */,74175B10C464D245E99BA6DB /* DuplicateFinderView.swift in Sources */,76B132F9C499225D33E0D075 /* EmptyStateView.swift in Sources */,@@ -650,12 +681,17 @@isa = PBXSourcesBuildPhase;buildActionMask = 2147483647;files = (+ 7E881F4DEEE1E4B0FA44BEB2 /* AIAppsCleanupTests.swift in Sources */,59B3096E2AE8ED0397B16798 /* AppLanguagePreferencesTests.swift in Sources */,E2403D82F00D749C9AD4A6D4 /* AppStateTests.swift in Sources */,+ F1908A8EFDD078AB512425B9 /* AppleFeatureCatalogTests.swift in Sources */,+ E4E8308D3BBE72B5A72554ED /* AppleStorageServiceTests.swift in Sources */,D15B7A053D69D4348D9DCD88 /* ApplicationUpdaterTests.swift in Sources */,2BCDC53C5E3AB58442C8E4B0 /* CleaningEngineTests.swift in Sources */,B69BD60D8AB7EBB9F80C9965 /* CleanupExclusionsTests.swift in Sources */,6BCC5E3773DF2E9189F75A6B /* CleanupReviewTests.swift in Sources */,+ 89D5B9A5B4F25EA729B5B08B /* DeviceBackupCoordinationTests.swift in Sources */,+ 5FF5942BC279628276CF6543 /* DeviceBackupServiceTests.swift in Sources */,4FAAA6E9887181C4C0AA9F87 /* DuplicateFinderTests.swift in Sources */,CFA64F54CDBF8A4765E0068D /* LocalizationFilesTests.swift in Sources */,20E0D6D821D0D1BFAC82E6E4 /* MonitoringLifecycleTests.swift in Sources */,@@ -774,7 +810,7 @@CODE_SIGN_STYLE = Automatic;COMBINE_HIDPI_IMAGES = YES;COPY_PHASE_STRIP = NO;- CURRENT_PROJECT_VERSION = 30;+ CURRENT_PROJECT_VERSION = 31;DEBUG_INFORMATION_FORMAT = dwarf;DEVELOPMENT_TEAM = H3WXHVTP97;ENABLE_STRICT_OBJC_MSGSEND = YES;@@ -796,7 +832,7 @@GENERATE_INFOPLIST_FILE = NO;INFOPLIST_FILE = PureMac/Info.plist;MACOSX_DEPLOYMENT_TARGET = 13.0;- MARKETING_VERSION = 3.1.0;+ MARKETING_VERSION = 3.2.0;MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;MTL_FAST_MATH = YES;ONLY_ACTIVE_ARCH = NO;@@ -898,7 +934,7 @@CODE_SIGN_STYLE = Automatic;COMBINE_HIDPI_IMAGES = YES;COPY_PHASE_STRIP = NO;- CURRENT_PROJECT_VERSION = 30;+ CURRENT_PROJECT_VERSION = 31;DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";DEVELOPMENT_TEAM = H3WXHVTP97;ENABLE_NS_ASSERTIONS = NO;@@ -914,7 +950,7 @@GENERATE_INFOPLIST_FILE = NO;INFOPLIST_FILE = PureMac/Info.plist;MACOSX_DEPLOYMENT_TARGET = 13.0;- MARKETING_VERSION = 3.1.0;+ MARKETING_VERSION = 3.2.0;MTL_ENABLE_DEBUG_INFO = NO;MTL_FAST_MATH = YES;ONLY_ACTIVE_ARCH = NO;diff --git a/PureMac/Models/AppleFeature.swift b/PureMac/Models/AppleFeature.swiftnew file mode 100644index 0000000..0937144--- /dev/null+++ b/PureMac/Models/AppleFeature.swift@@ -0,0 +1,71 @@+import Foundation++struct AppleFeature: Identifiable {+ let id: String+ let title: String+ let summary: String+ let steps: String+ let destination: String+ let guide: URL+ let minimumVersion: OperatingSystemVersion++ func isAvailable(on version: OperatingSystemVersion) -> Bool {+ let actual = [version.majorVersion, version.minorVersion, version.patchVersion]+ let required = [minimumVersion.majorVersion, minimumVersion.minorVersion, minimumVersion.patchVersion]+ return !actual.lexicographicallyPrecedes(required)+ }+}++enum AppleFeatureCatalog {+ static func features(for version: OperatingSystemVersion) -> [AppleFeature] {+ let modern = version.majorVersion >= 27+ let legacyGuideVersion = version.majorVersion < 26 ? "15.0/mac/15.0" : "26/mac/26"+ let siriPane = "com.apple.Siri-Settings.extension"+ let screenTime = "com.apple.Screen-Time-Settings.extension"+ let restrictionsGuide = modern ? "z25xrnykpuln/mac" : "mchlb2e44f94/\(legacyGuideVersion)"+ let restrictions = modern+ ? "Open Screen Time > Content & Privacy Restrictions. Enable All Restrictions, then open Siri. These restrictions may apply across devices using your Apple Account."+ : "Open Screen Time > Content & Privacy. Enable Content & Privacy restrictions, then open Intelligence & Siri."+ func feature(_ id: String, _ title: String, _ summary: String, _ steps: String, _ destination: String, _ guide: String, _ major: Int = 13, _ minor: Int = 0) -> AppleFeature {+ AppleFeature(id: id, title: title, summary: summary, steps: steps, destination: destination,+ guide: URL(string: "https://support.apple.com/guide/mac-help/\(guide)")!,+ minimumVersion: OperatingSystemVersion(majorVersion: major, minorVersion: minor, patchVersion: 0))+ }+ var items = [+ feature("siri", "Siri", "Turn off the assistant and its activation controls.",+ modern ? "Open Siri and choose Turn Off Siri. Confirm the change. Screen Time also offers Don't Allow Siri."+ : "Open Siri or Apple Intelligence & Siri and turn off Ask Siri. On versions that show a Siri section, open it to find the control.",+ siriPane, modern ? "mchl3fd7fc15/mac" : "mchl3fd7fc15/26/mac/26"),+ feature("intelligence", "Apple Intelligence", "Review Apple's writing, image and summary features.",+ modern ? "macOS 27 uses separate Siri, Screen Time and app controls. Review the individual features below. Turning off Siri does not establish that all Apple Intelligence features are off."+ : "Open Apple Intelligence & Siri, turn off Apple Intelligence and confirm. macOS manages downloaded models; PureMac does not promise that this immediately recovers their storage.",+ siriPane, modern ? "mchlb2e44f94/mac" : "mchl46361784/\(legacyGuideVersion)", 15, 1),+ feature("images", "Image Playground & Genmoji", "Restrict image generation using Screen Time.",+ restrictions + (modern ? " Set Image Creation to Blocked where available." : " Turn off Image Creation." ) + " This restricts access; it does not uninstall the protected app or erase images you created.",+ screenTime, restrictionsGuide, 15, 2),+ feature("writing", modern ? "Writing Assistance" : "Writing Tools", "Restrict Apple's generated writing features.",+ restrictions + (modern ? " Set Writing Assistance to Blocked where available." : " Turn off Writing Tools."),+ screenTime, restrictionsGuide, 15, 1),+ feature("summaries", "Notification summaries", "Read original notification text without generated summaries.",+ "Open Notifications > Summarize Notifications and turn it off, or choose which apps can use summaries.",+ "com.apple.Notifications-Settings.extension", "mchlb2e44f94/mac", 15, 1),+ feature("mail", "Mail summaries", "Turn off generated previews in Apple Mail.",+ "In Mail, choose Mail > Settings > Viewing, then turn off Summarize Message Previews. The button opens Mail; finish the change in its settings.",+ "application:com.apple.mail", "mchlb2e44f94/mac", 15, 1),+ feature("predictions", "Inline text predictions", "Stop suggested completions appearing as you type.",+ "Open Keyboard > Text Input > Edit and turn off Show inline predictive text. This setting is separate from Apple Intelligence.",+ "com.apple.Keyboard-Settings.extension", "mchlp2299/mac", 14),+ feature("analytics", "Analytics & Siri recordings", "Review diagnostic and voice-recording sharing with Apple.",+ "Open Privacy & Security > Analytics & Improvements. Review Share Mac Analytics, Improve Siri & Dictation and Share iCloud Analytics. Available switches depend on your Mac and account.",+ "com.apple.preference.security?Privacy_Analytics", "mchl211c911f/27/mac/27"),+ feature("advertising", "Personalized Apple ads", "Turn off interest-based ad targeting by Apple.",+ "Open Privacy & Security > Apple Advertising and turn off Personalized Ads. This changes ad targeting; it does not remove advertising or reduce the number of ads.",+ "com.apple.preference.security?Privacy_Advertising", "mchl211c911f/27/mac/27")+ ]+ items.insert(feature("extensions", "ChatGPT & intelligence extensions", "Control access to external AI providers.",+ restrictions + (modern ? " Set Extensions to Blocked. This does not uninstall standalone provider apps."+ : " Turn off Intelligence Extensions. You can also open Apple Intelligence & Siri > ChatGPT to review its controls."),+ screenTime, restrictionsGuide, 15, 2), at: 4)+ return items+ }+}diff --git a/PureMac/Services/AppleStorageService.swift b/PureMac/Services/AppleStorageService.swiftnew file mode 100644index 0000000..5776775--- /dev/null+++ b/PureMac/Services/AppleStorageService.swift@@ -0,0 +1,205 @@+import Darwin+import Foundation++enum AppleStorageKind: String, Sendable {+ case intelligenceModels+ case screenSavers+ case garageBand+ case appleLoops+ case deviceBackups++ var title: String {+ switch self {+ case .intelligenceModels: return String(localized: "Apple Intelligence models")+ case .screenSavers: return String(localized: "Downloaded screen savers")+ case .garageBand: return String(localized: "GarageBand support files")+ case .appleLoops: return String(localized: "Apple Loops")+ case .deviceBackups: return String(localized: "iPhone and iPad backups")+ }+ }++ var detail: String {+ switch self {+ case .intelligenceModels:+ return String(localized: "The known generative-model folder. macOS manages these assets; this size is not a promise of space you can recover.")+ case .screenSavers:+ return String(localized: "Downloaded Apple aerial assets. Change the selected wallpaper or screen saver in System Settings.")+ case .garageBand:+ return String(localized: "Sound libraries and support files may be shared with music apps. Review Music Creation in Storage settings.")+ case .appleLoops:+ return String(localized: "Loops used by GarageBand and Logic Pro. Review Music Creation in Storage settings before removing sounds.")+ case .deviceBackups:+ return String(localized: "Local device backups can contain your only restore copy. Review individual backups below or use Finder's Manage Backups.")+ }+ }+}++struct AppleStorageLocation: Sendable {+ let kind: AppleStorageKind+ let url: URL+}++struct AppleStorageItem: Identifiable, Sendable {+ enum Status: String, Sendable {+ case complete+ case partial+ case unavailable+ case notPresent+ }++ let kind: AppleStorageKind+ let url: URL+ let allocatedBytes: Int64?+ let status: Status+ let scannedCount: Int+ let skippedCount: Int+ let inaccessibleCount: Int+ let reachedLimit: Bool++ var id: URL { url }+ var title: String { kind.title }+ var detail: String { kind.detail }+ var path: String { url.path }+}++enum AppleStorageService {+ static func standardLocations(homeDirectory: URL = FileManager.default.homeDirectoryForCurrentUser) -> [AppleStorageLocation] {+ [+ AppleStorageLocation(kind: .intelligenceModels, url: URL(fileURLWithPath: "/System/Library/AssetsV2/com_apple_MobileAsset_UAF_FM_GenerativeModels")),+ AppleStorageLocation(kind: .screenSavers, url: URL(fileURLWithPath: "/Library/Application Support/com.apple.idleassetsd")),+ AppleStorageLocation(kind: .garageBand, url: URL(fileURLWithPath: "/Library/Application Support/GarageBand")),+ AppleStorageLocation(kind: .appleLoops, url: URL(fileURLWithPath: "/Library/Audio/Apple Loops")),+ AppleStorageLocation(kind: .deviceBackups, url: homeDirectory.appendingPathComponent("Library/Application Support/MobileSync/Backup", isDirectory: true))+ ]+ }++ static func scan(+ locations: [AppleStorageLocation] = standardLocations(),+ maxEntriesPerLocation: Int = 100_000+ ) async throws -> [AppleStorageItem] {+ let task = Task.detached(priority: .utility) {+ try locations.map { location in+ try Task.checkCancellation()+ return try measure(location, limit: max(1, min(maxEntriesPerLocation, 100_000)))+ }+ }+ return try await withTaskCancellationHandler {+ try Task.checkCancellation()+ return try await task.value+ } onCancel: {+ task.cancel()+ }+ }++ private struct Identity: Hashable {+ let device: dev_t+ let inode: ino_t+ }++ private static let resourceKeys: Set<URLResourceKey> = [+ .isPackageKey, .isUbiquitousItemKey, .ubiquitousItemDownloadingStatusKey+ ]++ private static func measure(_ location: AppleStorageLocation, limit: Int) throws -> AppleStorageItem {+ let root = location.url.standardizedFileURL+ var bytes: Int64 = 0+ var count = 0+ var skipped = 0+ var inaccessible = 0+ var reachedLimit = false+ var seen: Set<Identity> = []++ func result(_ status: AppleStorageItem.Status, bytes: Int64?) -> AppleStorageItem {+ AppleStorageItem(kind: location.kind, url: root, allocatedBytes: bytes, status: status,+ scannedCount: count, skippedCount: skipped, inaccessibleCount: inaccessible,+ reachedLimit: reachedLimit)+ }++ var ancestor = URL(fileURLWithPath: "/", isDirectory: true)+ for component in root.pathComponents.dropFirst() {+ try Task.checkCancellation()+ ancestor.appendPathComponent(component)+ var metadata = stat()+ guard lstat(ancestor.path, &metadata) == 0 else {+ if errno == ENOENT { return result(.notPresent, bytes: nil) }+ inaccessible += 1+ return result(.unavailable, bytes: nil)+ }+ guard metadata.st_mode & S_IFMT == S_IFDIR,+ metadata.st_flags & UInt32(SF_DATALESS) == 0 else {+ skipped += 1+ return result(.unavailable, bytes: nil)+ }+ }++ guard let rootValues = try? root.resourceValues(forKeys: resourceKeys),+ rootValues.isPackage != true, !isCloudOnly(rootValues),+ FileManager.default.isReadableFile(atPath: root.path) else {+ inaccessible += 1+ return result(.unavailable, bytes: nil)+ }++ guard let enumerator = FileManager.default.enumerator(+ at: root,+ includingPropertiesForKeys: Array(resourceKeys),+ options: [],+ errorHandler: { _, _ in+ inaccessible += 1+ return true+ }+ ) else {+ inaccessible += 1+ return result(.unavailable, bytes: nil)+ }++ while let url = enumerator.nextObject() as? URL {+ try Task.checkCancellation()+ guard count < limit else {+ reachedLimit = true+ break+ }+ count += 1+ var metadata = stat()+ guard lstat(url.path, &metadata) == 0 else {+ inaccessible += 1+ enumerator.skipDescendants()+ continue+ }+ let type = metadata.st_mode & S_IFMT+ guard type == S_IFREG || type == S_IFDIR,+ metadata.st_flags & UInt32(SF_DATALESS) == 0 else {+ skipped += 1+ enumerator.skipDescendants()+ continue+ }+ let values: URLResourceValues+ do {+ values = try url.resourceValues(forKeys: resourceKeys)+ } catch {+ inaccessible += 1+ enumerator.skipDescendants()+ continue+ }+ let isModelPackage = location.kind == .intelligenceModels+ && ["mlmodelc", "mpsgraphpackage", "bundle"].contains(url.pathExtension.lowercased())+ guard values.isPackage != true || isModelPackage, !isCloudOnly(values) else {+ skipped += 1+ enumerator.skipDescendants()+ continue+ }+ if seen.insert(Identity(device: metadata.st_dev, inode: metadata.st_ino)).inserted {+ bytes += max(0, Int64(metadata.st_blocks)) * 512+ }+ }++ try Task.checkCancellation()+ if count == 0 && inaccessible > 0 { return result(.unavailable, bytes: nil) }+ let status: AppleStorageItem.Status = skipped > 0 || inaccessible > 0 || reachedLimit ? .partial : .complete+ return result(status, bytes: bytes)+ }++ private static func isCloudOnly(_ values: URLResourceValues) -> Bool {+ guard values.isUbiquitousItem == true else { return false }+ return values.ubiquitousItemDownloadingStatus != .current && values.ubiquitousItemDownloadingStatus != .downloaded+ }+}diff --git a/PureMac/Services/CleaningEngine.swift b/PureMac/Services/CleaningEngine.swiftindex 5e338b3..afa296b 100644--- a/PureMac/Services/CleaningEngine.swift+++ b/PureMac/Services/CleaningEngine.swift@@ -47,6 +47,11 @@ actor CleaningEngine {continue}+ if item.category == .aiApps, !isSupportedAIAppPath(item.path) {+ result.errors.append("Unsupported AI app cleanup path: \(item.path)")+ continue+ }+if item.category == .purgeableSpace {let purged = await purgePurgeableSpace()result.freedSpace += purged@@ -220,6 +225,12 @@ actor CleaningEngine {(nsError.domain == NSPOSIXErrorDomain &&(nsError.code == Int(EACCES) || nsError.code == Int(EPERM)))if isPermissionDenied {+ if item.category == .aiApps {+ let detail = "AI app cleanup requires access as the current user: \(item.path)"+ result.errors.append(detail)+ Logger.shared.log(detail, level: .warning)+ continue+ }if XcodeBuildMCPDerivedDataSupport.isManagedDerivedDataPath(item.path,homeDirectory: homeDirectory@@ -274,6 +285,10 @@ actor CleaningEngine {// refuses to escalate.let exclusions = CleanupExclusions.paths()let validated: [(item: CleanableItem, resolved: String)] = items.compactMap { item in+ guard item.category != .aiApps else {+ result.errors.append("Administrator cleanup is unavailable for AI app data: \(item.name)")+ return nil+ }guard !CleanupExclusions.excludes(item.path, paths: exclusions) else { return nil }guard !hasUnexpectedSymlink(in: item.path) else {Logger.shared.log("Refusing admin escalation for symlinked path: \(item.path)", level: .warning)@@ -562,6 +577,9 @@ actor CleaningEngine {resolvedPath: String,includeUninstallPaths: Bool = false) -> Bool {+ if item.category == .aiApps {+ return item.path == resolvedPath && isSupportedAIAppPath(resolvedPath)+ }let originalIsManaged = XcodeBuildMCPDerivedDataSupport.isManagedDerivedDataPath(item.path,homeDirectory: homeDirectory@@ -586,6 +604,21 @@ actor CleaningEngine {|| (includeUninstallPaths && isSafeUninstallEscalationPath(resolvedPath))}+ private func isSupportedAIAppPath(_ path: String) -> Bool {+ guard !path.utf8.contains(0), path == (path as NSString).standardizingPath else { return false }+ let home = homeDirectory.path+ return [+ "\(home)/.ollama/logs",+ "\(home)/.ollama/history",+ "\(home)/.lmstudio/server-logs",+ "\(home)/.lmstudio/conversations",+ "\(home)/Library/Caches/ollama",+ "\(home)/Library/Caches/com.electron.ollama",+ "\(home)/Library/WebKit/com.electron.ollama",+ "\(home)/Library/Saved Application State/com.electron.ollama.savedState",+ ].contains(path)+ }+/// Validates that a resolved path is safe to delete./// Prevents symlink attacks where a link in ~/Library/Caches points to ~/.ssh./// Downloads, Documents, and Desktop are intentionally NOT whole-subtreediff --git a/PureMac/Services/DeviceBackupService.swift b/PureMac/Services/DeviceBackupService.swiftnew file mode 100644index 0000000..a70277a--- /dev/null+++ b/PureMac/Services/DeviceBackupService.swift@@ -0,0 +1,281 @@+import CryptoKit+import Darwin+import Foundation++struct DeviceBackup: Identifiable, Hashable, Sendable {+ let url: URL+ let allocatedSize: Int64+ let modifiedAt: Date+ fileprivate let fingerprint: String+ fileprivate let ancestors: [UInt64]++ var id: URL { url }+ var name: String { url.lastPathComponent }+}++struct DeviceBackupScanResult: Sendable {+ let backups: [DeviceBackup]+ let issues: [String]+}++struct DeviceBackupRemovalResult: Sendable {+ let removedPaths: [String]+ let errors: [String]+}++actor DeviceBackupService {+ private struct Measurement {+ var hasher = SHA256()+ var allocatedSize: Int64 = 0+ var count = 0+ var seenFiles: Set<String> = []+ var rootIdentity = ""+ }++ private let root: URL+ private let trashHandler: (URL) throws -> Void+ private let exclusions: () -> [String]+ private let maxEntries: Int++ init(+ homeDirectory: URL = FileManager.default.homeDirectoryForCurrentUser,+ trashHandler: ((URL) throws -> Void)? = nil,+ exclusions: @escaping () -> [String] = { CleanupExclusions.paths() },+ maxEntries: Int = 500_000+ ) {+ root = homeDirectory.appendingPathComponent("Library/Application Support/MobileSync/Backup", isDirectory: true)+ self.trashHandler = trashHandler ?? { url in+ var destination: NSURL?+ try FileManager.default.trashItem(at: url, resultingItemURL: &destination)+ }+ self.exclusions = exclusions+ self.maxEntries = max(1, min(maxEntries, 500_000))+ }++ func scan() throws -> DeviceBackupScanResult {+ try Task.checkCancellation()+ let opened: (descriptor: Int32, identities: [UInt64])+ do {+ opened = try openRoot()+ } catch is CancellationError {+ throw CancellationError()+ } catch let error as POSIXError where error.code == .ENOENT {+ return DeviceBackupScanResult(backups: [], issues: [])+ } catch {+ return DeviceBackupScanResult(backups: [], issues: [error.localizedDescription])+ }+ defer { close(opened.descriptor) }+ var backups: [DeviceBackup] = []+ var issues: [String] = []+ for name in try names(in: opened.descriptor) {+ try Task.checkCancellation()+ let url = root.appendingPathComponent(name, isDirectory: true)+ do {+ let info = try metadata(name, in: opened.descriptor)+ guard info.st_mode & S_IFMT != S_IFLNK else { throw failure("Symbolic links are excluded", url) }+ guard info.st_mode & S_IFMT == S_IFDIR else { continue }+ guard !CleanupExclusions.excludes(url.path, paths: exclusions()) else {+ throw failure("Excluded from cleanup", url)+ }+ let measure = try measureBackup(name, in: opened.descriptor)+ backups.append(DeviceBackup(+ url: url,+ allocatedSize: measure.allocatedSize,+ modifiedAt: Date(timeIntervalSince1970: TimeInterval(info.st_mtimespec.tv_sec)),+ fingerprint: measure.hasher.finalize().map { String(format: "%02x", $0) }.joined(),+ ancestors: opened.identities+ ))+ } catch is CancellationError {+ throw CancellationError()+ } catch {+ issues.append("\(name): \(error.localizedDescription)")+ }+ }+ return DeviceBackupScanResult(+ backups: backups.sorted { $0.allocatedSize > $1.allocatedSize },+ issues: issues+ )+ }++ func trash(_ backups: [DeviceBackup]) throws -> DeviceBackupRemovalResult {+ var removed: [String] = []+ var errors: [String] = []+ var seen: Set<URL> = []+ for backup in backups where seen.insert(backup.url).inserted {+ do {+ try Task.checkCancellation()+ guard backup.url.deletingLastPathComponent().path == root.path,+ backup.url.standardizedFileURL.path == backup.url.path,+ !backup.url.path.utf8.contains(0),+ backup.url.path != root.path else {+ throw failure("Only individual device backup folders can be moved to Trash", backup.url)+ }+ guard !CleanupExclusions.excludes(backup.url.path, paths: exclusions()) else {+ throw failure("Excluded from cleanup", backup.url)+ }+ let opened = try openRoot()+ defer { close(opened.descriptor) }+ guard opened.identities == backup.ancestors else {+ throw failure("The backup location changed. Scan again", backup.url)+ }+ let measure = try measureBackup(backup.name, in: opened.descriptor)+ let fingerprint = measure.hasher.finalize().map { String(format: "%02x", $0) }.joined()+ guard fingerprint == backup.fingerprint else {+ throw failure("The backup changed. Scan again after the backup finishes", backup.url)+ }+ let finalRoot = try openRoot()+ defer { close(finalRoot.descriptor) }+ try validateCompletedBackup(backup.name, in: finalRoot.descriptor)+ guard finalRoot.identities == backup.ancestors,+ try identity(metadata(backup.name, in: finalRoot.descriptor)) == measure.rootIdentity,+ !CleanupExclusions.excludes(backup.url.path, paths: exclusions()) else {+ throw failure("The backup location or exclusions changed. Scan again", backup.url)+ }+ try trashHandler(backup.url)+ removed.append(backup.url.path)+ } catch is CancellationError {+ errors.append(String(localized: "Backup removal was cancelled. Remaining backups were left in place."))+ break+ } catch {+ errors.append("\(backup.name): \(error.localizedDescription)")+ }+ }+ return DeviceBackupRemovalResult(removedPaths: removed, errors: errors)+ }++ private func openRoot() throws -> (descriptor: Int32, identities: [UInt64]) {+ guard root.path.hasPrefix("/"), root.path == root.standardizedFileURL.path,+ !root.path.utf8.contains(0) else { throw failure("Invalid backup location", root) }+ var descriptor = open("/", O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)+ guard descriptor >= 0 else { throw posixError() }+ var identities: [UInt64] = []+ do {+ for component in root.path.split(separator: "/") {+ try Task.checkCancellation()+ let next = openat(descriptor, String(component), O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)+ guard next >= 0 else { throw posixError() }+ close(descriptor)+ descriptor = next+ var info = stat()+ guard fstat(descriptor, &info) == 0 else { throw posixError() }+ identities.append(UInt64(bitPattern: Int64(info.st_dev)))+ identities.append(UInt64(info.st_ino))+ }+ return (descriptor, identities)+ } catch {+ close(descriptor)+ throw error+ }+ }++ private func measureBackup(_ name: String, in descriptor: Int32) throws -> Measurement {+ try validateCompletedBackup(name, in: descriptor)+ var measurement = Measurement()+ try walk(name, relative: name, parent: descriptor, depth: 0, measurement: &measurement)+ try validateCompletedBackup(name, in: descriptor)+ return measurement+ }++ private func validateCompletedBackup(_ name: String, in descriptor: Int32) throws {+ let backup = openat(descriptor, name, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)+ guard backup >= 0 else { throw posixError() }+ defer { close(backup) }+ for marker in ["Manifest.plist", "Info.plist", "Status.plist", "Manifest.db"] {+ let info = try metadata(marker, in: backup)+ guard info.st_mode & S_IFMT == S_IFREG, info.st_flags & UInt32(SF_DATALESS) == 0 else {+ throw failure("Only completed local device backups can be reviewed", root)+ }+ }+ let status = openat(backup, "Status.plist", O_RDONLY | O_NOFOLLOW | O_CLOEXEC)+ guard status >= 0 else { throw posixError() }+ let handle = FileHandle(fileDescriptor: status, closeOnDealloc: true)+ guard let data = try handle.read(upToCount: 1_048_577), data.count <= 1_048_576,+ let values = try PropertyListSerialization.propertyList(from: data, format: nil) as? [String: Any],+ values["SnapshotState"] as? String == "finished" else {+ throw failure("This backup is incomplete or in progress. Use Finder to manage it", root)+ }+ }++ private func walk(_ name: String, relative: String, parent: Int32, depth: Int, measurement: inout Measurement) throws {+ try Task.checkCancellation()+ measurement.count += 1+ guard measurement.count <= maxEntries, depth < 128 else {+ throw failure("This backup exceeds the review limit; use Finder to manage it", root)+ }+ let before = try metadata(name, in: parent)+ if depth == 0 { measurement.rootIdentity = identity(before) }+ let kind = before.st_mode & S_IFMT+ guard kind == S_IFDIR || kind == S_IFREG,+ depth != 0 || kind == S_IFDIR,+ before.st_flags & UInt32(SF_DATALESS) == 0 else {+ throw failure("A backup contains a symbolic link, special file, or cloud-only item", root)+ }+ measurement.hasher.update(data: Data((relative + "\0" + identity(before) + "\0").utf8))+ let physicalID = "\(before.st_dev):\(before.st_ino)"+ if measurement.seenFiles.insert(physicalID).inserted {+ measurement.allocatedSize += max(0, Int64(before.st_blocks)) * 512+ }+ if kind == S_IFDIR {+ let child = openat(parent, name, O_RDONLY | O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC)+ guard child >= 0 else { throw posixError() }+ defer { close(child) }+ var opened = stat()+ guard fstat(child, &opened) == 0, identity(opened) == identity(before) else {+ throw failure("A backup changed while it was being read", root)+ }+ for childName in try names(in: child) {+ try walk(childName, relative: relative + "/" + childName, parent: child, depth: depth + 1, measurement: &measurement)+ }+ }+ guard try identity(metadata(name, in: parent)) == identity(before) else {+ throw failure("A backup changed while it was being read", root)+ }+ }++ private func names(in descriptor: Int32) throws -> [String] {+ let copy = dup(descriptor)+ guard copy >= 0 else { throw posixError() }+ guard let directory = fdopendir(copy) else {+ close(copy)+ throw posixError()+ }+ defer { closedir(directory) }+ rewinddir(directory)+ var result: [String] = []+ while true {+ try Task.checkCancellation()+ errno = 0+ guard let entry = readdir(directory) else {+ if errno != 0 { throw posixError() }+ break+ }+ let name = withUnsafePointer(to: &entry.pointee.d_name) {+ $0.withMemoryRebound(to: CChar.self, capacity: Int(entry.pointee.d_namlen) + 1) {+ String(validatingUTF8: $0)+ }+ }+ guard let name else { throw failure("A backup contains an unreadable filename", root) }+ if name != ".", name != ".." { result.append(name) }+ guard result.count <= maxEntries else { throw failure("This folder exceeds the review limit", root) }+ }+ return result.sorted()+ }++ private func metadata(_ name: String, in descriptor: Int32) throws -> stat {+ var info = stat()+ guard fstatat(descriptor, name, &info, AT_SYMLINK_NOFOLLOW) == 0 else { throw posixError() }+ return info+ }++ private func identity(_ info: stat) -> String {+ "\(info.st_dev):\(info.st_ino):\(info.st_mode):\(info.st_size):\(info.st_blocks):\(info.st_mtimespec.tv_sec):\(info.st_mtimespec.tv_nsec):\(info.st_ctimespec.tv_sec):\(info.st_ctimespec.tv_nsec):\(info.st_flags)"+ }++ private func posixError() -> POSIXError {+ POSIXError(POSIXErrorCode(rawValue: errno) ?? .EIO)+ }++ private func failure(_ message: String, _ url: URL) -> NSError {+ NSError(domain: "DeviceBackupService", code: 1, userInfo: [NSLocalizedDescriptionKey: "\(message): \(url.path)"])+ }+}diff --git a/PureMac/ViewModels/AppState.swift b/PureMac/ViewModels/AppState.swiftindex 2a9d2b6..e40fb73 100644--- a/PureMac/ViewModels/AppState.swift+++ b/PureMac/ViewModels/AppState.swift@@ -13,6 +13,7 @@ enum AppSection: Hashable {case similarPhotoscase protectioncase performance+ case appleFeaturescase appUpdatescase settingscase cleaning(CleaningCategory)@@ -51,6 +52,11 @@ final class AppState: ObservableObject {let languageAtLaunch = AppLanguage.current@Published var settingsNeedLanguageRestart = false@Published var showUpdateSettings = false+ @Published var deviceBackupRemovalInProgress = false+ @Published var deviceBackupRemovalResult: DeviceBackupRemovalResult?+ var canRemoveDeviceBackups: Bool {+ !scanState.isActive && !deviceBackupRemovalInProgress+ }typealias AppFileScanner = @MainActor (_ app: InstalledApp,_ locations: Locations,@@ -808,7 +814,7 @@ final class AppState: ObservableObject {}private func retryCleanItems(_ items: [CleanableItem]) async {- guard !scanState.isActive else { return }+ guard !scanState.isActive, !deviceBackupRemovalInProgress else { return }let generation = UUID()cleanupGeneration = generationscanState = .cleaning(progress: 0)@@ -874,12 +880,13 @@ final class AppState: ObservableObject {// MARK: - Scanningfunc startSmartScan() {- guard !scanState.isActive else { return }+ guard !scanState.isActive, !deviceBackupRemovalInProgress else { return }beginScan(categories: CleaningCategory.scannable, replacingResults: true)}func scanSingleCategory(_ category: CleaningCategory) {- guard !scanState.isActive, CleaningCategory.scannable.contains(category) else { return }+ guard !scanState.isActive, !deviceBackupRemovalInProgress,+ CleaningCategory.scannable.contains(category) else { return }beginScan(categories: [category], replacingResults: false)}@@ -935,7 +942,7 @@ final class AppState: ObservableObject {// MARK: - Cleaningfunc cleanAll(itemIDs: Set<UUID>? = nil, scheduled: Bool = false) {- guard !scanState.isActive else { return }+ guard !scanState.isActive, !deviceBackupRemovalInProgress else { return }let itemsToClean = allResults.flatMap { $0.items }.filter { item inguard itemIDs?.contains(item.id) ?? true else { return false }@@ -1007,7 +1014,8 @@ final class AppState: ObservableObject {}func cleanCategory(_ category: CleaningCategory, itemIDs: Set<UUID>? = nil) {- guard let result = categoryResults[category], !scanState.isActive else { return }+ guard let result = categoryResults[category], !scanState.isActive,+ !deviceBackupRemovalInProgress else { return }let selectedItems = result.items.filter { isItemSelected($0) && (itemIDs?.contains($0.id) ?? true) }guard !selectedItems.isEmpty else { return }@@ -1131,7 +1139,8 @@ final class AppState: ObservableObject {func canRunScheduledScan(isAppActive: Bool) -> Bool {!scanState.isActive && !(scanState == .completed && isAppActive)&& !showCleanConfirmation && !isScanningAppFiles && !isRemovingAppFiles- && !isSearchingOrphans && !PermissionCoordinator.shared.isRequesting+ && !isSearchingOrphans && !deviceBackupRemovalInProgress+ && !PermissionCoordinator.shared.isRequesting}func runScheduledScan() async {diff --git a/PureMac/Views/CategoryDetailView.swift b/PureMac/Views/CategoryDetailView.swiftindex 80de927..1f59ac1 100644--- a/PureMac/Views/CategoryDetailView.swift+++ b/PureMac/Views/CategoryDetailView.swift@@ -1,13 +1,17 @@import SwiftUIstruct CategoryDetailView: View {+ private struct CleanupSelection: Identifiable {+ let id = UUID()+ let items: [CleanableItem]+ }+@EnvironmentObject var appState: AppState@Environment(\.accessibilityReduceMotion) private var reduceMotionlet category: CleaningCategory@State private var filter = CleanupReviewFilter()- @State private var showConfirmation = false- @State private var pendingItems: [CleanableItem] = []+ @State private var pendingReview: CleanupSelection?private var result: CategoryResult? { appState.categoryResults[category] }private var visibleItems: [CleanableItem] { filter.apply(to: result?.items ?? []) }@@ -52,19 +56,12 @@ struct CategoryDetailView: View {}}.navigationTitle(Text(LocalizedStringKey(category.rawValue)))- .confirmationDialog("Remove selected files?", isPresented: $showConfirmation, titleVisibility: .visible) {- Button("Permanently remove \(pendingItems.count) items", role: .destructive) {- appState.cleanCategory(category, itemIDs: Set(pendingItems.map(\.id)))- pendingItems = []- }- Button("Cancel", role: .cancel) { pendingItems = [] }- } message: {- Text(confirmationMessage)+ .sheet(item: $pendingReview) { selection in+ removalReview(items: selection.items)}.onChange(of: category) { _ infilter = CleanupReviewFilter()- pendingItems = []- showConfirmation = false+ pendingReview = nil}}@@ -154,9 +151,14 @@ struct CategoryDetailView: View {Text("\(selectedItems.count) selected · \(ByteCountFormatter.string(fromByteCount: selectedSize, countStyle: .file))").font(.system(size: 13, weight: .semibold)).monospacedDigit()- Text(hiddenCount > 0 ? "Includes \(hiddenCount) selected items hidden by filters." : "Selected cleanup items are permanently removed.")+ Text("Cleanup permanently removes files unless marked Move to Trash.").font(.caption).foregroundStyle(.secondary)+ if hiddenCount > 0 {+ Text("Includes \(hiddenCount) selected items hidden by filters.")+ .font(.caption)+ .foregroundStyle(.secondary)+ }}Spacer(minLength: 8)if !selectedItems.isEmpty {@@ -165,8 +167,7 @@ struct CategoryDetailView: View {.disabled(appState.scanState.isActive)}Button {- pendingItems = selectedItems- showConfirmation = true+ pendingReview = CleanupSelection(items: selectedItems)} label: {Label("Review removal", systemImage: "trash").font(.system(size: 13, weight: .semibold))@@ -182,11 +183,80 @@ struct CategoryDetailView: View {.overlay(alignment: .top) { Divider() }}- private var confirmationMessage: String {- let size = ByteCountFormatter.string(fromByteCount: pendingItems.reduce(0) { $0 + $1.size }, countStyle: .file)- let names = pendingItems.prefix(5).map(\.name).joined(separator: "\n")- let more = pendingItems.count > 5 ? String(localized: "\nAnd \(pendingItems.count - 5) more.") : ""- return String(localized: "\(size) selected. This permanently removes the selected files or runs the listed cleanup actions. It cannot be undone.") + "\n\n" + names + more+ private func removalReview(items: [CleanableItem]) -> some View {+ VStack(alignment: .leading, spacing: 16) {+ VStack(alignment: .leading, spacing: 6) {+ Text("Review removal")+ .font(.title2.weight(.semibold))+ Text("\(items.count) items · \(ByteCountFormatter.string(fromByteCount: items.reduce(0) { $0 + $1.size }, countStyle: .file))")+ .monospacedDigit()+ .foregroundStyle(.secondary)+ Text("Files and cleanup actions marked Permanent cannot be undone. Items marked Move to Trash can be recovered until the Trash is emptied.")+ .font(.callout)+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)+ }+ Divider()+ ScrollView {+ LazyVStack(alignment: .leading, spacing: 0) {+ ForEach(items) { item in+ VStack(alignment: .leading, spacing: 5) {+ HStack(alignment: .firstTextBaseline, spacing: 12) {+ Text(item.name)+ .font(.body.weight(.medium))+ .fixedSize(horizontal: false, vertical: true)+ Spacer(minLength: 0)+ Text(item.formattedSize)+ .monospacedDigit()+ .foregroundStyle(.secondary)+ }+ if !item.path.isEmpty {+ Text(item.path)+ .font(.system(.caption, design: .monospaced))+ .foregroundStyle(.secondary)+ .textSelection(.enabled)+ .fixedSize(horizontal: false, vertical: true)+ }+ Text(removalMethod(item))+ .font(.caption.weight(.medium))+ .foregroundStyle(.secondary)+ }+ .padding(.vertical, 12)+ Divider()+ }+ }+ .padding(.trailing, 8)+ }+ .frame(minHeight: 160, maxHeight: 300)+ HStack {+ Spacer()+ Button("Cancel", role: .cancel) { pendingReview = nil }+ .keyboardShortcut(.cancelAction)+ Button("Remove \(items.count) items", role: .destructive) {+ let itemIDs = Set(items.map(\.id))+ pendingReview = nil+ appState.cleanCategory(category, itemIDs: itemIDs)+ }+ .buttonStyle(.borderedProminent)+ .tint(Tint.red)+ .disabled(items.isEmpty || appState.scanState.isActive)+ }+ }+ .padding(24)+ .frame(width: 580)+ }++ private func removalMethod(_ item: CleanableItem) -> String {+ if item.simctlRuntimeIdentifier != nil {+ return String(localized: "Permanent · Remove simulator runtime")+ }+ if item.isActionItem {+ return String(localized: "Permanent · Run cleanup action")+ }+ if XcodeBuildMCPDerivedDataSupport.isManagedDerivedDataPath(item.path) {+ return String(localized: "Move to Trash")+ }+ return String(localized: "Permanent · Delete files")}}diff --git a/PureMac/Views/Components/AppTheme.swift b/PureMac/Views/Components/AppTheme.swiftindex e2752c2..7815134 100644--- a/PureMac/Views/Components/AppTheme.swift+++ b/PureMac/Views/Components/AppTheme.swift@@ -124,16 +124,9 @@ struct IconTile: View {}struct AmbientBackdrop: View {- @Environment(\.colorScheme) private var colorScheme-var body: some View {- ZStack(alignment: .top) {- Color(nsColor: .windowBackgroundColor)- Rectangle()- .fill(colorScheme == .dark ? Color.white.opacity(0.018) : Color.black.opacity(0.014))- .frame(height: 96)- }- .ignoresSafeArea()+ Color(nsColor: .windowBackgroundColor)+ .ignoresSafeArea()}}@@ -145,7 +138,7 @@ struct CardSurface<Content: View>: View {var tint: Color? = nil@ViewBuilder var content: Content- private let cornerRadius: CGFloat = 14+ private let cornerRadius: CGFloat = 10var body: some View {content@@ -191,7 +184,7 @@ enum CardElevation {var ambient: Double {switch self {case .flat: return 0- case .standard: return 0.035+ case .standard: return 0case .raised: return 0.07}}@@ -231,8 +224,7 @@ struct StatusChip: View {.padding(.horizontal, 8).padding(.vertical, 4).foregroundStyle(tint)- .background(Capsule().fill(tint.opacity(0.11)))- .overlay(Capsule().strokeBorder(tint.opacity(0.15), lineWidth: 0.5))+ .background(RoundedRectangle(cornerRadius: 5).fill(tint.opacity(0.09)))}}diff --git a/PureMac/Views/DashboardView.swift b/PureMac/Views/DashboardView.swiftindex 1b5fa54..08b568a 100644--- a/PureMac/Views/DashboardView.swift+++ b/PureMac/Views/DashboardView.swift@@ -41,8 +41,8 @@ struct DashboardView: View {private var pageHeader: some View {HStack(alignment: .top, spacing: 16) {VStack(alignment: .leading, spacing: 5) {- Text("Smart Care")- .font(.system(size: 28, weight: .semibold))+ Text("Overview")+ .font(.system(size: 24, weight: .semibold)).tracking(-0.45).accessibilityAddTraits(.isHeader)Text(headerSubtitle)@@ -92,7 +92,7 @@ struct DashboardView: View {private var headerSubtitle: String {switch appState.scanState {case .idle:- return String(localized: "A clear view of reclaimable storage and the tools that manage it.")+ return String(localized: "Storage, cleanup, and system tools.")case .scanning:return String(localized: "Checking your Mac. Nothing is removed during a scan.")case .completed:@@ -141,137 +141,132 @@ struct DashboardView: View {private var idleContent: some View {VStack(alignment: .leading, spacing: 20) {- GeometryReader { geometry in- let diskWidth = min(390, max(286, geometry.size.width * 0.38))- HStack(alignment: .top, spacing: 14) {- scanIntroduction- .frame(width: geometry.size.width - diskWidth - 14, height: 246)- diskOverview- .frame(width: diskWidth, height: 246)- }- }- .frame(height: 246)-- dashboardSection("Tools", detail: "Focused utilities for storage, apps, and system maintenance")-- LazyVGrid(- columns: [GridItem(.adaptive(minimum: 210, maximum: 280), spacing: 14)],- spacing: 14- ) {- DashboardToolCard(- title: "Space Explorer",- detail: "Find what uses the most disk space",- icon: "square.3.layers.3d.down.right",- tint: Tint.accent- ) {- onNavigate(.spaceExplorer)- }- DashboardToolCard(- title: "Duplicate Finder",- detail: "Review matching files side by side",- icon: "doc.on.doc",- tint: Tint.purple- ) {- onNavigate(.duplicates)- }- DashboardToolCard(- title: "Similar Photos",- detail: "Compare visually similar photos",- icon: "photo.stack",- tint: Tint.pink- ) {- onNavigate(.similarPhotos)- }- DashboardToolCard(- title: "Uninstaller",- detail: "Remove apps and their related files",- icon: "app.dashed",- tint: Tint.blue- ) {- onNavigate(.apps)- }- DashboardToolCard(- title: "App Updates",- detail: "Check installed apps for new versions",- icon: "arrow.triangle.2.circlepath",- tint: Tint.accent- ) {- onNavigate(.appUpdates)- }- DashboardToolCard(- title: "Protection",- detail: "Review built-in privacy and safety checks",- icon: "shield.checkered",- tint: Tint.green- ) {- onNavigate(.protection)+ diskOverview+ scanIntroduction++ HStack(alignment: .top, spacing: 16) {+ VStack(alignment: .leading, spacing: 10) {+ dashboardSection("Storage")+ CardSurface(padding: 0, elevation: .flat) {+ VStack(spacing: 0) {+ DashboardToolCard(+ title: "Space Explorer",+ detail: "Browse folders by size",+ icon: "square.3.layers.3d.down.right",+ tint: Tint.accent+ ) { onNavigate(.spaceExplorer) }+ Divider().padding(.leading, 46)+ DashboardToolCard(+ title: "Duplicate Finder",+ detail: "Review files with identical contents",+ icon: "doc.on.doc",+ tint: Tint.accent+ ) { onNavigate(.duplicates) }+ Divider().padding(.leading, 46)+ DashboardToolCard(+ title: "Similar Photos",+ detail: "Compare possible matches",+ icon: "photo.stack",+ tint: Tint.accent+ ) { onNavigate(.similarPhotos) }+ }+ }}- DashboardToolCard(- title: "Performance",- detail: "Inspect memory and background activity",- icon: "gauge.with.dots.needle.67percent",- tint: Tint.cyan- ) {- onNavigate(.performance)+ .frame(maxWidth: .infinity, alignment: .topLeading)++ VStack(alignment: .leading, spacing: 10) {+ dashboardSection("Applications & system")+ CardSurface(padding: 0, elevation: .flat) {+ VStack(spacing: 0) {+ DashboardToolCard(+ title: "Apple Features",+ detail: "Review Siri, image creation, and extras",+ icon: "switch.2",+ tint: Tint.accent+ ) { onNavigate(.appleFeatures) }+ Divider().padding(.leading, 46)+ DashboardToolCard(+ title: "Uninstaller",+ detail: "Remove apps and related files",+ icon: "app.dashed",+ tint: Tint.accent+ ) { onNavigate(.apps) }+ Divider().padding(.leading, 46)+ DashboardToolCard(+ title: "App Updates",+ detail: "Check Homebrew-managed apps",+ icon: "arrow.triangle.2.circlepath",+ tint: Tint.accent+ ) { onNavigate(.appUpdates) }+ Divider().padding(.leading, 46)+ DashboardToolCard(+ title: "Protection",+ detail: "Check macOS security settings",+ icon: "shield.checkered",+ tint: Tint.accent+ ) { onNavigate(.protection) }+ Divider().padding(.leading, 46)+ DashboardToolCard(+ title: "Performance",+ detail: "View processes and startup items",+ icon: "gauge.with.dots.needle.67percent",+ tint: Tint.accent+ ) { onNavigate(.performance) }+ }+ }}+ .frame(maxWidth: .infinity, alignment: .topLeading)}}}private var scanIntroduction: some View {- CardSurface(padding: 24, elevation: .standard, tint: Tint.accent) {- VStack(alignment: .leading, spacing: 18) {- HStack {- IconTile(systemName: "sparkles", tint: Tint.accent, size: 38, corner: 10, vivid: true)- Spacer()- Text("\(CleaningCategory.scannable.count) areas")- .font(.system(size: 11, weight: .medium))- .foregroundStyle(.secondary)- }-- VStack(alignment: .leading, spacing: 8) {- Text("Find space to reclaim.")- .font(.system(size: 25, weight: .semibold))- .tracking(-0.35)- Text("PureMac checks caches, logs, developer data, downloads, and Trash. You review the result before anything is removed.")- .font(.system(size: 13))+ CardSurface(padding: 18, elevation: .flat) {+ HStack(alignment: .center, spacing: 20) {+ VStack(alignment: .leading, spacing: 6) {+ Text("Review cleanup")+ .font(.system(size: 16, weight: .semibold))+ Text("Check \(CleaningCategory.scannable.count) categories for caches, logs, and other removable files. Review the results before deleting anything.")+ .font(.system(size: 12)).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)}+ .frame(maxWidth: .infinity, alignment: .leading)- Spacer()-- HStack(spacing: 12) {- Button {- appState.startSmartScan()- } label: {- Label("Scan this Mac", systemImage: "magnifyingglass")- }- .buttonStyle(.borderedProminent)- .controlSize(.large)- .tint(Tint.accent)-- Label("Local and private", systemImage: "lock")- .font(.system(size: 11.5, weight: .medium))- .foregroundStyle(.secondary)+ Button {+ appState.startSmartScan()+ } label: {+ Label("Scan this Mac", systemImage: "magnifyingglass")}+ .buttonStyle(.borderedProminent)+ .controlSize(.large)+ .tint(Tint.accent)+ .accessibilityIdentifier("dashboard.scan")}- .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading)}}private var diskOverview: some View {- CardSurface(padding: 22, elevation: .standard) {- VStack(alignment: .leading, spacing: 16) {- HStack {- VStack(alignment: .leading, spacing: 3) {+ CardSurface(padding: 20, elevation: .flat) {+ VStack(alignment: .leading, spacing: 14) {+ HStack(alignment: .firstTextBaseline) {+ VStack(alignment: .leading, spacing: 4) {Text("Mac storage")- .font(.system(size: 15, weight: .semibold))- Text("\(appState.diskInfo.formattedFree) available")- .font(.system(size: 11.5))- .foregroundStyle(.secondary)+ .font(.system(size: 13, weight: .semibold))+ HStack(alignment: .firstTextBaseline, spacing: 6) {+ Text(appState.diskInfo.formattedFree)+ .font(.system(size: 26, weight: .semibold))+ .monospacedDigit()+ Text("available")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }}Spacer()+ Text("\(usedPercent)% used")+ .font(.system(size: 12))+ .monospacedDigit()+ .foregroundStyle(.secondary)Button {appState.loadDiskInfo()} label: {@@ -279,53 +274,50 @@ struct DashboardView: View {}.buttonStyle(.borderless).help("Refresh disk information")+ .accessibilityLabel("Refresh disk information")}- HStack(spacing: 16) {- ZStack {- StorageDonut(- segments: diskSegments,- lineWidth: 13,- highlightedID: hoveredSegment- )- VStack(spacing: 0) {- Text("\(usedPercent)%")- .font(.system(size: 24, weight: .semibold, design: .rounded))- .monospacedDigit()- Text("USED")- .font(.system(size: 8.5, weight: .semibold))- .tracking(0.8)- .foregroundStyle(.tertiary)- }- }- .frame(width: 108, height: 108)-- VStack(alignment: .leading, spacing: 12) {- diskLegendRow(- id: "used",- color: Color.primary.opacity(0.56),- label: "Used",- value: appState.diskInfo.formattedUsed+ StackedMeter(+ segments: diskSegments.map {+ StackedMeter.Segment(id: $0.id, value: $0.value, color: $0.color)+ },+ height: 10,+ highlightedID: hoveredSegment+ )+ .accessibilityHidden(true)++ HStack(spacing: 24) {+ diskLegendRow(+ id: "used",+ color: Color.primary.opacity(0.56),+ label: "Used",+ value: ByteCountFormatter.string(+ fromByteCount: max(0, appState.diskInfo.usedSpace - appState.diskInfo.purgeableSpace),+ countStyle: .file)- if appState.diskInfo.purgeableSpace > 0 {- diskLegendRow(- id: "purgeable",- color: Tint.cyan,- label: "Purgeable",- value: appState.diskInfo.formattedPurgeable- )- }+ )+ if appState.diskInfo.purgeableSpace > 0 {diskLegendRow(- id: "free",- color: Tint.accent,- label: "Available",- value: appState.diskInfo.formattedFree+ id: "purgeable",+ color: Tint.cyan,+ label: "Purgeable",+ value: appState.diskInfo.formattedPurgeable)}+ diskLegendRow(+ id: "free",+ color: Tint.accent,+ label: "Available",+ value: appState.diskInfo.formattedFree+ )}+ if appState.diskInfo.purgeableSpace > 0 {+ Text("Purgeable space is managed by macOS and is not included in cleanup.")+ .font(.system(size: 11))+ .foregroundStyle(.secondary)+ }}- .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)}}@@ -398,35 +390,34 @@ struct DashboardView: View {private var scanningContent: some View {VStack(alignment: .leading, spacing: 20) {- CardSurface(padding: 28, elevation: .standard, tint: Tint.accent) {- HStack(spacing: 34) {- ScanningGauge(progress: appState.scanProgress, tint: Tint.accent)- .frame(width: 164, height: 164)-- VStack(alignment: .leading, spacing: 12) {- Text("Scanning your Mac")- .font(.system(size: 25, weight: .semibold))- .tracking(-0.35)- Text(LocalizedStringKey(appState.currentScanCategory))- .font(.system(size: 13, weight: .medium))- .foregroundStyle(Tint.accent)- ScanPathTicker(ticker: appState.scanTicker)- .frame(maxWidth: 520, alignment: .leading)- ProgressView(value: appState.scanProgress)- .progressViewStyle(.linear)- .tint(Tint.accent)- .frame(maxWidth: 480)- HStack(spacing: 10) {- Button("Stop scan", role: .cancel) {- appState.cancelScan()- }- .buttonStyle(.bordered)- Text("Stopping keeps the results found so far.")- .font(.system(size: 10.5))- .foregroundStyle(.tertiary)+ CardSurface(padding: 20, elevation: .flat) {+ VStack(alignment: .leading, spacing: 14) {+ HStack {+ VStack(alignment: .leading, spacing: 5) {+ Text("Scanning your Mac")+ .font(.system(size: 18, weight: .semibold))+ Text(LocalizedStringKey(appState.currentScanCategory))+ .font(.system(size: 12))+ .foregroundStyle(.secondary)}+ Spacer()+ Text(appState.scanProgress, format: .percent.precision(.fractionLength(0)))+ .font(.system(size: 18, weight: .medium))+ .monospacedDigit()+ }+ ProgressView(value: appState.scanProgress)+ .progressViewStyle(.linear)+ .tint(Tint.accent)+ ScanPathTicker(ticker: appState.scanTicker)+ HStack(spacing: 10) {+ Button("Stop scan", role: .cancel) {+ appState.cancelScan()+ }+ .buttonStyle(.bordered)+ Text("Stopping keeps the results found so far.")+ .font(.system(size: 11))+ .foregroundStyle(.secondary)}- Spacer()}}@@ -439,18 +430,18 @@ struct DashboardView: View {private var resultsContent: some View {VStack(alignment: .leading, spacing: 20) {- CardSurface(padding: 24, elevation: .standard, tint: appState.scanWasCancelled ? Tint.orange : Tint.accent) {+ CardSurface(padding: 20, elevation: .flat) {HStack(alignment: .center, spacing: 24) {IconTile(systemName: appState.scanWasCancelled ? "stop.circle" : "checklist",tint: appState.scanWasCancelled ? Tint.orange : Tint.accent,- size: 52,- corner: 14+ size: 32,+ corner: 8)VStack(alignment: .leading, spacing: 5) {Text(appState.scanWasCancelled ? "Scan stopped" : "Scan complete")- .font(.system(size: 23, weight: .semibold))+ .font(.system(size: 18, weight: .semibold)).tracking(-0.3)Text(resultSummary).font(.system(size: 12.5))@@ -514,7 +505,9 @@ struct DashboardView: View {private var emptyResults: some View {CardSurface(padding: 28, elevation: .flat) {HStack(spacing: 18) {- SuccessMedal(tint: Tint.green, size: 72)+ Image(systemName: "checkmark.circle")+ .font(.system(size: 28))+ .foregroundStyle(.secondary)VStack(alignment: .leading, spacing: 5) {Text(appState.scanWasCancelled ? "No results yet" : "Nothing to clean").font(.system(size: 18, weight: .semibold))@@ -552,42 +545,39 @@ struct DashboardView: View {}private var cleaningContent: some View {- CardSurface(padding: 34, elevation: .standard, tint: Tint.accent) {- VStack(spacing: 22) {- ScanningGauge(progress: appState.cleanProgress, tint: Tint.accent, label: "CLEANING")- .frame(width: 170, height: 170)- VStack(spacing: 6) {+ CardSurface(padding: 20, elevation: .flat) {+ VStack(alignment: .leading, spacing: 16) {+ HStack {Text("Cleaning selected items")- .font(.system(size: 24, weight: .semibold))- Text("Keep PureMac open until this pass finishes.")- .font(.system(size: 12.5))- .foregroundStyle(.secondary)+ .font(.system(size: 18, weight: .semibold))+ Spacer()+ Text(appState.cleanProgress, format: .percent.precision(.fractionLength(0)))+ .font(.system(size: 18, weight: .medium))+ .monospacedDigit()}ProgressView(value: appState.cleanProgress).tint(Tint.accent)- .frame(maxWidth: 460)+ Text("Keep PureMac open until cleanup finishes.")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)}- .frame(maxWidth: .infinity, minHeight: 380)+ .frame(maxWidth: .infinity, alignment: .leading)}}private var cleanedContent: some View {- CardSurface(- padding: 38,- elevation: .standard,- tint: appState.lastCleanupHadFailures ? Tint.orange : Tint.green- ) {- HStack(spacing: 34) {- SuccessMedal(tint: appState.lastCleanupHadFailures ? Tint.orange : Tint.green, size: 126)+ CardSurface(padding: 24, elevation: .flat) {+ HStack(alignment: .top, spacing: 16) {+ Image(systemName: appState.lastCleanupHadFailures ? "exclamationmark.circle" : "checkmark.circle")+ .font(.system(size: 28))+ .foregroundStyle(appState.lastCleanupHadFailures ? Tint.orange : Tint.accent)VStack(alignment: .leading, spacing: 9) {Text(appState.lastCleanupHadFailures ? "Some items need attention" : "Cleanup complete")- .font(.system(size: 25, weight: .semibold))+ .font(.system(size: 20, weight: .semibold))if appState.totalFreedSpace > 0 {- CountUpBytes(bytes: appState.totalFreedSpace)- .font(.system(size: 38, weight: .semibold, design: .rounded))- Text("reclaimed")- .font(.system(size: 12.5))- .foregroundStyle(.secondary)+ Text("\(ByteCountFormatter.string(fromByteCount: appState.totalFreedSpace, countStyle: .file)) removed")+ .font(.system(size: 16, weight: .medium))+ .monospacedDigit()}if let cleanError = appState.cleanError {Text(cleanError)@@ -599,13 +589,12 @@ struct DashboardView: View {appState.scanState = .idle}.buttonStyle(.borderedProminent)- .controlSize(.large).tint(Tint.accent).padding(.top, 5)}Spacer()}- .frame(maxWidth: .infinity, minHeight: 320, alignment: .leading)+ .frame(maxWidth: .infinity, alignment: .leading)}}@@ -664,29 +653,34 @@ private struct DashboardToolCard: View {var body: some View {Button(action: action) {- CardSurface(padding: 16, elevation: .flat, tint: hovering ? tint : nil) {- HStack(spacing: 12) {- IconTile(systemName: icon, tint: tint, size: 36, corner: 10)- VStack(alignment: .leading, spacing: 3) {- Text(title)- .font(.system(size: 13.5, weight: .semibold))- .foregroundStyle(.primary)- Text(detail)- .font(.system(size: 10.5))- .foregroundStyle(.secondary)- .lineLimit(2)- }- Spacer(minLength: 5)- Image(systemName: "chevron.right")- .font(.system(size: 9, weight: .semibold))- .foregroundStyle(.tertiary)+ HStack(spacing: 12) {+ Image(systemName: icon)+ .font(.system(size: 17))+ .foregroundStyle(hovering ? tint : .secondary)+ .frame(width: 20)+ VStack(alignment: .leading, spacing: 3) {+ Text(title)+ .font(.system(size: 12.5, weight: .medium))+ .foregroundStyle(.primary)+ Text(detail)+ .font(.system(size: 11))+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)}- .frame(maxWidth: .infinity, minHeight: 46, alignment: .leading)+ Spacer(minLength: 5)+ Image(systemName: "chevron.right")+ .font(.system(size: 9, weight: .semibold))+ .foregroundStyle(.tertiary)}+ .frame(maxWidth: .infinity, minHeight: 35, alignment: .leading)+ .padding(.horizontal, 14)+ .padding(.vertical, 11)+ .background(hovering ? Color.primary.opacity(0.035) : .clear)+ .contentShape(Rectangle())}.buttonStyle(.plain)- .contentShape(RoundedRectangle(cornerRadius: 14, style: .continuous)).onHover { hovering = $0 }+ .accessibilityElement(children: .combine)}}diff --git a/PureMac/Views/MainWindow.swift b/PureMac/Views/MainWindow.swiftindex 6349eeb..cd888cb 100644--- a/PureMac/Views/MainWindow.swift+++ b/PureMac/Views/MainWindow.swift@@ -89,8 +89,8 @@ struct MainWindow: View {Section {navRow(section: .cleaning(.smartScan),- label: "Smart Care",- icon: "sparkles",+ label: "Overview",+ icon: "internaldrive",tint: Tint.accent,badge: dashboardBadge,emphasized: true@@ -109,6 +109,13 @@ struct MainWindow: View {tint: Tint.cyan,badge: nil)+ navRow(+ section: .appleFeatures,+ label: "Apple Features",+ icon: "switch.2",+ tint: Tint.accent,+ badge: nil+ )} header: {sectionLabel("Care")}@@ -173,7 +180,10 @@ struct MainWindow: View {}} label: {HStack(spacing: 10) {- IconTile(systemName: "trash.slash", tint: Tint.accent, size: 24)+ Image(systemName: "trash.slash")+ .font(.system(size: 16))+ .foregroundStyle(.secondary)+ .frame(width: 20)Text("Cleanup").font(.system(size: 12.5, weight: .medium)).foregroundStyle(sidebarLabelColor)@@ -197,7 +207,10 @@ struct MainWindow: View {}} label: {HStack(spacing: 10) {- IconTile(systemName: "wrench.and.screwdriver", tint: .secondary, size: 24)+ Image(systemName: "wrench.and.screwdriver")+ .font(.system(size: 16))+ .foregroundStyle(.secondary)+ .frame(width: 20)Text("Developer Cleanup").font(.system(size: 12.5, weight: .medium)).foregroundStyle(sidebarLabelColor)@@ -241,10 +254,9 @@ struct MainWindow: View {private func sectionLabel(_ text: LocalizedStringKey) -> some View {Text(text)- .font(.system(size: 10, weight: .semibold))- .tracking(0.7)- .foregroundStyle(.tertiary)- .textCase(.uppercase)+ .font(.system(size: 11, weight: .semibold))+ .foregroundStyle(.secondary)+ .textCase(nil)}private func navRow(@@ -282,6 +294,7 @@ struct MainWindow: View {.cleaning(.smartScan),.protection,.performance,+ .appleFeatures,.apps,.appUpdates,.orphans,@@ -313,6 +326,7 @@ struct MainWindow: View {case .similarPhotos: return "sidebar.similarPhotos"case .protection: return "sidebar.protection"case .performance: return "sidebar.performance"+ case .appleFeatures: return "sidebar.appleFeatures"case .settings: return "sidebar.settings"case .appUpdates: return "sidebar.appUpdates"case .cleaning(let category): return "sidebar.cleaning.\(category.id)"@@ -422,6 +436,8 @@ struct MainWindow: View {ProtectionView()case .performance:PerformanceView()+ case .appleFeatures:+ AppleFeaturesView()case .appUpdates:AppUpdatesView()case .settings:@@ -435,7 +451,7 @@ struct MainWindow: View {case nil:EmptyStateView("PureMac",- systemImage: "sparkles",+ systemImage: "internaldrive",description: "Select a tool from the sidebar.")}@@ -498,16 +514,13 @@ private struct SidebarNavRow: View {var body: some View {HStack(spacing: 10) {- IconTile(- systemName: icon,- tint: tint,- size: 24,- corner: 7,- glow: isSelected,- vivid: emphasized && isSelected- )+ Image(systemName: icon)+ .font(.system(size: 16, weight: isSelected ? .medium : .regular))+ .foregroundStyle(isSelected ? Tint.accent : .secondary)+ .frame(width: 20)+ .accessibilityHidden(true)Text(label)- .font(.system(size: 12.5, weight: isSelected ? .semibold : .medium))+ .font(.system(size: 12.5, weight: isSelected || emphasized ? .semibold : .regular)).foregroundStyle(labelColor).lineLimit(1)Spacer(minLength: 5)@@ -527,14 +540,6 @@ private struct SidebarNavRow: View {RoundedRectangle(cornerRadius: 9, style: .continuous).fill(rowFill)}- .overlay(alignment: .leading) {- if isSelected {- Capsule()- .fill(tint)- .frame(width: 2.5, height: 18)- .padding(.leading, 2)- }- }.contentShape(RoundedRectangle(cornerRadius: 9, style: .continuous)).animation(reduceMotion ? nil : MotionTokens.snappy, value: hovering).animation(reduceMotion ? nil : MotionTokens.snappy, value: isSelected)@@ -543,7 +548,7 @@ private struct SidebarNavRow: View {private var rowFill: Color {if isSelected {- return tint.opacity(colorScheme == .dark ? 0.13 : 0.10)+ return Tint.accent.opacity(colorScheme == .dark ? 0.16 : 0.10)}if hovering {return Color.primary.opacity(0.035)diff --git a/PureMac/Views/Tools/AppleFeaturesView.swift b/PureMac/Views/Tools/AppleFeaturesView.swiftnew file mode 100644index 0000000..b95c165--- /dev/null+++ b/PureMac/Views/Tools/AppleFeaturesView.swift@@ -0,0 +1,667 @@+import AppKit+import SwiftUI++struct AppleFeaturesView: View {+ @EnvironmentObject private var appState: AppState+ private enum Page: String, CaseIterable {+ case features = "Features"+ case storage = "Storage"+ }++ private struct BackupSelection: Identifiable {+ let id = UUID()+ let backups: [DeviceBackup]+ }++ private let version = ProcessInfo.processInfo.operatingSystemVersion+ @State private var page = Page.features+ @State private var search = ""+ @State private var inventory: [AppleStorageItem]?+ @State private var inventoryTask: Task<Void, Never>?+ @State private var inventoryRunning = false+ @State private var inventoryNotice: String?+ @State private var backupService = DeviceBackupService()+ @State private var backups: [DeviceBackup] = []+ @State private var backupIssues: [String] = []+ @State private var backupSelection: Set<URL> = []+ @State private var backupTask: Task<Void, Never>?+ @State private var backupsRunning = false+ @State private var backupsScanned = false+ @State private var removalTask: Task<Void, Never>?+ @State private var removalNotice: String?+ @State private var pendingRemoval: BackupSelection?+ @State private var errorMessage: String?++ private var removalRunning: Bool { appState.deviceBackupRemovalInProgress }++ private var features: [AppleFeature] {+ AppleFeatureCatalog.features(for: version).filter {+ search.isEmpty || "\($0.title) \($0.summary) \($0.steps)".localizedCaseInsensitiveContains(search)+ }+ }++ var body: some View {+ ScrollView {+ VStack(alignment: .leading, spacing: 20) {+ VStack(alignment: .leading, spacing: 6) {+ Text("Apple Features")+ .font(.system(size: 24, weight: .semibold))+ .accessibilityAddTraits(.isHeader)+ Text("Review optional features and the storage used by Apple downloads.")+ .font(.system(size: 13))+ .foregroundStyle(.secondary)+ }++ Picker("Apple Features section", selection: $page) {+ ForEach(Page.allCases, id: \.self) { page in+ Text(LocalizedStringKey(page.rawValue)).tag(page)+ }+ }+ .pickerStyle(.segmented)+ .labelsHidden()+ .frame(maxWidth: 280)+ .disabled(removalRunning)++ if removalRunning {+ HStack(spacing: 10) {+ ProgressView().controlSize(.small)+ Text("Finishing backup removal. New scans are available when it stops.")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }+ }+ if let result = appState.deviceBackupRemovalResult {+ DeviceBackupRemovalReport(result: result) {+ appState.deviceBackupRemovalResult = nil+ }+ }++ if page == .features {+ featuresContent+ } else {+ storageContent+ }+ }+ .frame(maxWidth: 960, alignment: .leading)+ .padding(24)+ .frame(maxWidth: .infinity, alignment: .top)+ }+ .navigationTitle("Apple Features")+ .alert("Couldn't complete the action", isPresented: Binding(+ get: { errorMessage != nil },+ set: { if !$0 { errorMessage = nil } }+ )) {+ Button("OK", role: .cancel) { errorMessage = nil }+ } message: {+ Text(errorMessage ?? "")+ }+ .sheet(item: $pendingRemoval) { selection in+ DeviceBackupConfirmation(backups: selection.backups, canRemove: appState.canRemoveDeviceBackups) {+ pendingRemoval = nil+ removeBackups(selection.backups)+ }+ }+ .onDisappear {+ inventoryTask?.cancel()+ backupTask?.cancel()+ removalTask?.cancel()+ }+ }++ private var featuresContent: some View {+ VStack(alignment: .leading, spacing: 14) {+ Text("Changes are made in Apple's settings. PureMac does not detect or verify whether a feature is enabled.")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)++ HStack(spacing: 8) {+ Image(systemName: "magnifyingglass")+ .foregroundStyle(.secondary)+ TextField("Find a feature", text: $search)+ .textFieldStyle(.plain)+ .accessibilityIdentifier("appleFeatures.search")+ if !search.isEmpty {+ Button {+ search = ""+ } label: {+ Image(systemName: "xmark.circle.fill")+ }+ .buttonStyle(.plain)+ .foregroundStyle(.secondary)+ .accessibilityLabel("Clear search")+ }+ }+ .padding(9)+ .background(Color(nsColor: .controlBackgroundColor), in: RoundedRectangle(cornerRadius: 7))+ .overlay(RoundedRectangle(cornerRadius: 7).strokeBorder(Color.primary.opacity(0.12), lineWidth: 0.5))++ if features.isEmpty {+ Text("No features match your search.")+ .font(.system(size: 13))+ .foregroundStyle(.secondary)+ .padding(.vertical, 20)+ } else {+ CardSurface(padding: 0, elevation: .flat) {+ VStack(spacing: 0) {+ ForEach(Array(features.enumerated()), id: \.element.id) { index, feature in+ AppleFeatureRow(feature: feature, version: version, openDestination: openDestination, openGuide: openURL)+ if index < features.count - 1 { Divider() }+ }+ }+ }+ }++ Text("Availability also depends on your Mac model, language, region, account, and device management. Apple Intelligence requires a supported Mac with Apple silicon. Setting names can vary between macOS versions.")+ .font(.system(size: 11))+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)+ }+ }++ private var storageContent: some View {+ VStack(alignment: .leading, spacing: 20) {+ HStack(alignment: .top, spacing: 16) {+ VStack(alignment: .leading, spacing: 5) {+ Text("Apple downloads")+ .font(.system(size: 16, weight: .semibold))+ .accessibilityAddTraits(.isHeader)+ Text("Measure known locations without deleting files. These sizes are not a recoverable-space estimate.")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)+ }+ Spacer(minLength: 8)+ Button(inventory == nil ? "Measure storage" : "Measure again", action: scanInventory)+ .buttonStyle(.bordered)+ .disabled(inventoryRunning || removalRunning)+ .accessibilityIdentifier("appleFeatures.measureStorage")+ }++ if inventoryRunning {+ HStack(spacing: 10) {+ ProgressView().controlSize(.small)+ Text("Measuring Apple storage…")+ .font(.system(size: 12))+ Spacer()+ Button("Stop") { inventoryTask?.cancel() }+ .buttonStyle(.borderless)+ }+ }+ if let inventoryNotice {+ Text(inventoryNotice)+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }+ if let inventory {+ CardSurface(padding: 0, elevation: .flat) {+ VStack(spacing: 0) {+ ForEach(Array(inventory.enumerated()), id: \.element.id) { index, item in+ AppleStorageRow(item: item, reveal: reveal, openDestination: openDestination)+ if index < inventory.count - 1 { Divider() }+ }+ }+ }+ }++ HStack(spacing: 14) {+ Button("Storage settings") { openDestination("com.apple.settings.Storage") }+ Button("Wallpaper settings") { openDestination("com.apple.Wallpaper-Settings.extension") }+ }+ .buttonStyle(.borderless)+ .font(.system(size: 12))++ Divider()+ backupContent+ }+ }++ private var backupContent: some View {+ VStack(alignment: .leading, spacing: 14) {+ HStack(alignment: .top, spacing: 16) {+ VStack(alignment: .leading, spacing: 5) {+ Text("iPhone and iPad backups")+ .font(.system(size: 16, weight: .semibold))+ .accessibilityAddTraits(.isHeader)+ Text("Review complete local backups individually. Selected backups move to the Trash after confirmation.")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)+ }+ Spacer(minLength: 8)+ Button(backupsScanned ? "Scan again" : "Find backups", action: scanBackups)+ .buttonStyle(.bordered)+ .disabled(backupsRunning || removalRunning)+ .accessibilityIdentifier("appleFeatures.findBackups")+ }+ if backupsRunning || removalRunning {+ HStack(spacing: 10) {+ ProgressView().controlSize(.small)+ Text(removalRunning ? "Checking and moving selected backups to the Trash…" : "Checking local backups…")+ .font(.system(size: 12))+ Spacer()+ if backupsRunning {+ Button("Stop") { backupTask?.cancel() }+ .buttonStyle(.borderless)+ }+ }+ }+ if let removalNotice {+ Text(removalNotice)+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }+ if appState.scanState.isActive {+ Text("Backup removal is available after the current scan or cleanup finishes.")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }+ if !backupIssues.isEmpty {+ DisclosureGroup("\(backupIssues.count) backup locations could not be included") {+ VStack(alignment: .leading, spacing: 6) {+ ForEach(Array(backupIssues.enumerated()), id: \.offset) { _, issue in+ Text(issue).textSelection(.enabled)+ }+ }+ .font(.system(size: 11))+ .foregroundStyle(.secondary)+ .padding(.top, 6)+ }+ .font(.system(size: 12))+ }+ if backupsScanned && backups.isEmpty && !backupsRunning {+ Text(backupIssues.isEmpty ? "No complete local device backups were found." : "No backups are available to select. Review the scan issues above.")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }+ if !backups.isEmpty {+ CardSurface(padding: 0, elevation: .flat) {+ VStack(spacing: 0) {+ ForEach(Array(backups.enumerated()), id: \.element.id) { index, backup in+ backupRow(backup)+ if index < backups.count - 1 { Divider().padding(.leading, 40) }+ }+ }+ }+ .disabled(backupsRunning || removalRunning)++ HStack {+ Text("\(backupSelection.count) selected")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ Spacer()+ Button("Review selected backups") {+ let selection = backups.filter { backupSelection.contains($0.id) }+ if !selection.isEmpty { pendingRemoval = BackupSelection(backups: selection) }+ }+ .buttonStyle(.bordered)+ .disabled(backupSelection.isEmpty || backupsRunning || !appState.canRemoveDeviceBackups)+ }+ }+ }+ }++ private func backupRow(_ backup: DeviceBackup) -> some View {+ HStack(alignment: .top, spacing: 12) {+ Toggle("Select backup \(backup.name)", isOn: Binding(+ get: { backupSelection.contains(backup.id) },+ set: { selected in+ if selected { backupSelection.insert(backup.id) }+ else { backupSelection.remove(backup.id) }+ }+ ))+ .labelsHidden()+ .toggleStyle(.checkbox)+ .padding(.top, 2)+ VStack(alignment: .leading, spacing: 4) {+ Text(backup.name)+ .font(.system(size: 12, weight: .medium))+ .textSelection(.enabled)+ Text(backup.url.path)+ .font(.system(size: 10.5, design: .monospaced))+ .foregroundStyle(.secondary)+ .textSelection(.enabled)+ .fixedSize(horizontal: false, vertical: true)+ Text("Modified \(backup.modifiedAt.formatted(date: .abbreviated, time: .shortened))")+ .font(.system(size: 11))+ .foregroundStyle(.secondary)+ }+ Spacer(minLength: 8)+ VStack(alignment: .trailing, spacing: 6) {+ Text(ByteCountFormatter.string(fromByteCount: backup.allocatedSize, countStyle: .file))+ .font(.system(size: 12, weight: .medium))+ .monospacedDigit()+ Button("Show in Finder") { reveal(backup.url) }+ .buttonStyle(.borderless)+ .font(.system(size: 11))+ }+ }+ .padding(14)+ }++ @MainActor+ private func scanInventory() {+ guard !inventoryRunning, !removalRunning else { return }+ inventoryRunning = true+ inventoryNotice = nil+ inventoryTask = Task { @MainActor in+ defer { inventoryRunning = false }+ do {+ let result = try await AppleStorageService.scan()+ try Task.checkCancellation()+ inventory = result+ } catch is CancellationError {+ inventoryNotice = inventory == nil ? "Storage measurement stopped." : "Storage measurement stopped. Previous results are still shown."+ } catch {+ errorMessage = error.localizedDescription+ }+ }+ }++ @MainActor+ private func scanBackups() {+ guard !backupsRunning, !removalRunning else { return }+ backupsRunning = true+ backupsScanned = false+ backups = []+ backupIssues = []+ backupSelection = []+ removalNotice = nil+ backupTask = Task { @MainActor in+ defer { backupsRunning = false }+ do {+ let result = try await backupService.scan()+ try Task.checkCancellation()+ backups = result.backups+ backupIssues = result.issues+ backupsScanned = true+ } catch is CancellationError {+ removalNotice = "Backup scan stopped. Scan again before selecting backups."+ backups = []+ backupsScanned = false+ } catch {+ errorMessage = error.localizedDescription+ }+ }+ }++ @MainActor+ private func removeBackups(_ selection: [DeviceBackup]) {+ guard !backupsRunning else { return }+ guard appState.canRemoveDeviceBackups else {+ removalNotice = "Backup removal is available after the current scan or cleanup finishes."+ return+ }+ let sharedState = appState+ sharedState.deviceBackupRemovalInProgress = true+ sharedState.deviceBackupRemovalResult = nil+ removalNotice = nil+ inventoryTask?.cancel()+ removalTask = Task { @MainActor in+ defer { sharedState.deviceBackupRemovalInProgress = false }+ do {+ let result = try await backupService.trash(selection)+ sharedState.deviceBackupRemovalResult = result+ let removed = Set(result.removedPaths)+ backups.removeAll { removed.contains($0.url.path) }+ backupSelection = []+ if !removed.isEmpty {+ inventory = nil+ inventoryNotice = "Backups changed. Measure storage again for current sizes."+ }+ } catch {+ sharedState.deviceBackupRemovalResult = DeviceBackupRemovalResult(+ removedPaths: [], errors: [error.localizedDescription]+ )+ }+ }+ }++ private func openDestination(_ destination: String) {+ if destination.hasPrefix("application:") {+ let identifier = String(destination.dropFirst("application:".count))+ guard let url = NSWorkspace.shared.urlForApplication(withBundleIdentifier: identifier) else {+ errorMessage = "The app could not be found. Open it manually and follow the steps shown."+ return+ }+ openURL(url)+ } else if let url = URL(string: "x-apple.systempreferences:\(destination)") {+ if !NSWorkspace.shared.open(url) {+ let fallback = URL(fileURLWithPath: "/System/Applications/System Settings.app")+ let opened = NSWorkspace.shared.open(fallback)+ errorMessage = opened+ ? "The settings shortcut could not be opened. System Settings is open; follow the steps shown to find the control."+ : "System Settings could not be opened. Open it from the Apple menu and follow the steps shown."+ }+ } else {+ errorMessage = "The settings shortcut is unavailable. Open System Settings from the Apple menu."+ }+ }++ private func openURL(_ url: URL) {+ if !NSWorkspace.shared.open(url) {+ errorMessage = "Could not open \(url.absoluteString). Open the app or guide manually."+ }+ }++ private func reveal(_ url: URL) {+ guard FileManager.default.fileExists(atPath: url.path) else {+ errorMessage = "This location is no longer available or cannot be accessed. Scan again to refresh the results."+ return+ }+ NSWorkspace.shared.activateFileViewerSelecting([url])+ }+}++private struct AppleFeatureRow: View {+ let feature: AppleFeature+ let version: OperatingSystemVersion+ let openDestination: (String) -> Void+ let openGuide: (URL) -> Void+ @State private var expanded = false++ private var available: Bool { feature.isAvailable(on: version) }++ var body: some View {+ DisclosureGroup(isExpanded: $expanded) {+ VStack(alignment: .leading, spacing: 12) {+ Text(feature.steps)+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)+ .textSelection(.enabled)+ HStack(spacing: 16) {+ Button(feature.destination.hasPrefix("application:") ? "Open Mail" : "Open Settings") {+ openDestination(feature.destination)+ }+ .buttonStyle(.bordered)+ .disabled(!available)+ Button("Apple guide") { openGuide(feature.guide) }+ .buttonStyle(.borderless)+ }+ .font(.system(size: 12))+ }+ .padding(.top, 10)+ .padding(.leading, 2)+ } label: {+ VStack(alignment: .leading, spacing: 5) {+ HStack {+ Text(feature.title)+ .font(.system(size: 13, weight: .medium))+ .foregroundStyle(.primary)+ Spacer()+ if !available {+ Text("Requires macOS \(feature.minimumVersion.majorVersion).\(feature.minimumVersion.minorVersion)")+ .font(.system(size: 10.5))+ .foregroundStyle(.secondary)+ }+ }+ Text(feature.summary)+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)+ }+ }+ .padding(16)+ .accessibilityIdentifier("appleFeatures.feature.\(feature.id)")+ }+}++private struct AppleStorageRow: View {+ let item: AppleStorageItem+ let reveal: (URL) -> Void+ let openDestination: (String) -> Void++ private var sizeDescription: String {+ switch item.status {+ case .notPresent: return String(localized: "Not found")+ case .unavailable: return String(localized: "Unavailable")+ case .complete, .partial:+ guard let bytes = item.allocatedBytes else { return String(localized: "Unknown") }+ if bytes == 0 {+ return item.status == .partial ? String(localized: "Not fully measured") : String(localized: "0 bytes")+ }+ let size = ByteCountFormatter.string(fromByteCount: bytes, countStyle: .file)+ return item.status == .partial ? String(format: String(localized: "At least %@"), size) : size+ }+ }++ var body: some View {+ VStack(alignment: .leading, spacing: 8) {+ HStack(alignment: .firstTextBaseline) {+ Text(item.title)+ .font(.system(size: 13, weight: .medium))+ Spacer()+ Text(sizeDescription)+ .font(.system(size: 12, weight: .medium))+ .monospacedDigit()+ }+ Text(item.detail)+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)+ Text(item.path)+ .font(.system(size: 10.5, design: .monospaced))+ .foregroundStyle(.secondary)+ .textSelection(.enabled)+ .fixedSize(horizontal: false, vertical: true)+ if item.status == .partial {+ Text("Partial measurement: \(item.skippedCount) skipped, \(item.inaccessibleCount) inaccessible.\(item.reachedLimit ? " Entry limit reached." : "")")+ .font(.system(size: 11))+ .foregroundStyle(Tint.orange)+ } else if item.status == .unavailable {+ Text("This location could not be measured. Permissions or protected system storage may prevent access.")+ .font(.system(size: 11))+ .foregroundStyle(.secondary)+ }+ HStack(spacing: 16) {+ Button("Show in Finder") { reveal(item.url) }+ .disabled(item.status == .notPresent || item.status == .unavailable)+ if item.kind == .screenSavers {+ Button("Wallpaper settings") { openDestination("com.apple.Wallpaper-Settings.extension") }+ } else {+ Button("Storage settings") { openDestination("com.apple.settings.Storage") }+ }+ }+ .font(.system(size: 11))+ .buttonStyle(.borderless)+ }+ .padding(16)+ }+}++private struct DeviceBackupRemovalReport: View {+ let result: DeviceBackupRemovalResult+ let dismiss: () -> Void++ var body: some View {+ CardSurface(padding: 16, elevation: .flat) {+ VStack(alignment: .leading, spacing: 10) {+ HStack {+ Text("\(result.removedPaths.count) backups moved to the Trash")+ .font(.system(size: 13, weight: .medium))+ Spacer()+ Button("Dismiss report", action: dismiss)+ .buttonStyle(.borderless)+ .font(.system(size: 11))+ }+ Text("Moving backups to the Trash does not free disk space. Emptying the Trash is a separate action.")+ .font(.system(size: 11))+ .foregroundStyle(.secondary)+ ForEach(Array(result.errors.enumerated()), id: \.offset) { _, error in+ Text(error)+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ .textSelection(.enabled)+ }+ if !result.removedPaths.isEmpty {+ DisclosureGroup("Moved paths") {+ VStack(alignment: .leading, spacing: 6) {+ ForEach(result.removedPaths, id: \.self) { path in+ Text(path)+ .font(.system(size: 10.5, design: .monospaced))+ .textSelection(.enabled)+ .fixedSize(horizontal: false, vertical: true)+ }+ }+ .padding(.top, 6)+ }+ .font(.system(size: 11))+ }+ }+ }+ }+}++private struct DeviceBackupConfirmation: View {+ let backups: [DeviceBackup]+ let canRemove: Bool+ let confirm: () -> Void+ @Environment(\.dismiss) private var dismiss++ var body: some View {+ VStack(alignment: .leading, spacing: 16) {+ Text("Move \(backups.count) backups to the Trash?")+ .font(.system(size: 19, weight: .semibold))+ Text("Removing your only backup prevents you from restoring that device from this Mac. Disconnect devices and stop any active backups before continuing.")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)+ ScrollView {+ VStack(alignment: .leading, spacing: 12) {+ ForEach(backups) { backup in+ VStack(alignment: .leading, spacing: 4) {+ Text(backup.url.path)+ .font(.system(size: 11, design: .monospaced))+ .textSelection(.enabled)+ .fixedSize(horizontal: false, vertical: true)+ Text(ByteCountFormatter.string(fromByteCount: backup.allocatedSize, countStyle: .file))+ .font(.system(size: 11))+ .foregroundStyle(.secondary)+ }+ }+ }+ .frame(maxWidth: .infinity, alignment: .leading)+ }+ .frame(maxHeight: 220)+ Text("PureMac rechecks each selected backup before moving it. Emptying the Trash is a separate action.")+ .font(.system(size: 11))+ .foregroundStyle(.secondary)+ if !canRemove {+ Text("Wait for the current scan or cleanup to finish before moving backups.")+ .font(.system(size: 12))+ .foregroundStyle(.secondary)+ }+ HStack {+ Spacer()+ Button("Cancel", role: .cancel) { dismiss() }+ .keyboardShortcut(.cancelAction)+ Button("Move to Trash", role: .destructive, action: confirm)+ .keyboardShortcut(.defaultAction)+ .disabled(!canRemove)+ }+ }+ .padding(24)+ .frame(width: 560)+ }+}diff --git a/PureMac/Views/Tools/DuplicateFinderView.swift b/PureMac/Views/Tools/DuplicateFinderView.swiftindex bc033ff..8e1c644 100644--- a/PureMac/Views/Tools/DuplicateFinderView.swift+++ b/PureMac/Views/Tools/DuplicateFinderView.swift@@ -144,7 +144,7 @@ struct DuplicateFinderView: View {}Text("Find copies that are exactly the same").font(.system(size: 18, weight: .semibold))- Text("Choose a folder. PureMac compares file sizes first, then verifies matching files byte for byte. Nothing is selected or removed automatically.")+ Text("Choose a folder. PureMac compares file sizes and SHA-256 content hashes. Nothing is selected or removed automatically.").font(.callout).foregroundStyle(.secondary).multilineTextAlignment(.center)diff --git a/PureMac/Views/Tools/SimilarPhotosView.swift b/PureMac/Views/Tools/SimilarPhotosView.swiftindex 0ac82b7..cd0046f 100644--- a/PureMac/Views/Tools/SimilarPhotosView.swift+++ b/PureMac/Views/Tools/SimilarPhotosView.swift@@ -219,27 +219,20 @@ struct SimilarPhotosView: View {}private var idleState: some View {- CardSurface(padding: 32, elevation: .standard, tint: Tint.pink) {- VStack(spacing: 15) {- IconTile(systemName: "photo.on.rectangle.angled", tint: Tint.pink, size: 62, corner: 17)+ CardSurface(padding: 20, elevation: .flat) {+ VStack(alignment: .leading, spacing: 10) {Text("Choose a folder of photos")- .font(.system(size: 19, weight: .semibold))- Text("PureMac builds small local thumbnails, compares their visual structure and color, then groups likely matches for review.")+ .font(.system(size: 16, weight: .semibold))+ Text("Compare local photos by appearance and review likely matches side by side. Photos are never uploaded or deleted.").font(.system(size: 13)).foregroundStyle(.secondary)- .multilineTextAlignment(.center)- .frame(maxWidth: 520)- HStack(spacing: 8) {- StatusChip(label: String(localized: "Review only"), systemImage: "eye", tint: Tint.green)- StatusChip(label: String(localized: "500 photo limit"), systemImage: "photo.stack", tint: Tint.pink)- StatusChip(label: String(localized: "Local files"), systemImage: "lock.shield", tint: Tint.blue)- }- Text("Symbolic links, app packages, hidden files and cloud-only placeholders are skipped. Photos are never uploaded or deleted.")- .font(.system(size: 11.5))- .foregroundStyle(.tertiary)- .multilineTextAlignment(.center)+ .fixedSize(horizontal: false, vertical: true)+ Text("Up to 500 photos and 10,000 directory entries per scan. Symbolic links, packages, hidden files, and cloud-only items are skipped.")+ .font(.caption)+ .foregroundStyle(.secondary)+ .fixedSize(horizontal: false, vertical: true)}- .frame(maxWidth: .infinity, minHeight: 300)+ .frame(maxWidth: .infinity, alignment: .leading)}}@@ -343,41 +336,34 @@ struct SimilarPhotosView: View {}private func summaryCard(_ result: SimilarPhotoScanResult) -> some View {- CardSurface(padding: 18, elevation: .standard, tint: Tint.pink) {+ CardSurface(padding: 16, elevation: .flat) {HStack(spacing: 20) {VStack(alignment: .leading, spacing: 3) {Text("\(result.groups.count)")- .font(.system(size: 32, weight: .bold, design: .rounded))+ .font(.system(size: 21, weight: .semibold)).monospacedDigit()- .foregroundStyle(Tint.pink)Text(result.groups.count == 1 ? "similar group" : "similar groups").font(.system(size: 12.5)).foregroundStyle(.secondary)}Divider()- .frame(height: 50)+ .frame(height: 38)- VStack(alignment: .leading, spacing: 8) {- HStack(spacing: 8) {- StatusChip(label: String(localized: "\(result.photosAnalyzed) analyzed"), systemImage: "viewfinder", tint: Tint.pink)- StatusChip(label: String(localized: "\(result.matchedPhotoCount) matched"), systemImage: "photo.stack", tint: Tint.blue)- }- HStack(spacing: 8) {- StatusChip(label: Self.format(result.matchedPhotoSize), systemImage: "internaldrive", tint: Tint.purple)- if result.skippedItems > 0 {- StatusChip(label: String(localized: "\(result.skippedItems) skipped"), systemImage: "forward", tint: Tint.orange)- }- }+ VStack(alignment: .leading, spacing: 5) {+ Text("\(result.photosAnalyzed) analyzed · \(result.matchedPhotoCount) matched")+ .font(.system(size: 13, weight: .medium))+ Text("\(Self.format(result.matchedPhotoSize)) in matched photos · \(result.skippedItems) skipped")+ .font(.caption)+ .foregroundStyle(.secondary)}+ .monospacedDigit()Spacer()- StatusChip(- label: result.isPartial ? String(localized: "Sample limit reached") : String(localized: "Scan complete"),- systemImage: result.isPartial ? "exclamationmark.triangle" : "checkmark.circle",- tint: result.isPartial ? Tint.orange : Tint.green- )+ if result.isPartial {+ StatusChip(label: String(localized: "Sample limit reached"), systemImage: "exclamationmark.triangle", tint: Tint.orange)+ }}}}diff --git a/PureMac/Views/Tools/SpaceExplorerView.swift b/PureMac/Views/Tools/SpaceExplorerView.swiftindex 029185a..995ef9e 100644--- a/PureMac/Views/Tools/SpaceExplorerView.swift+++ b/PureMac/Views/Tools/SpaceExplorerView.swift@@ -340,47 +340,37 @@ struct SpaceExplorerView: View {}private func summaryCard(_ result: StorageScanResult) -> some View {- CardSurface(padding: 18, elevation: .standard, tint: Tint.accent) {- HStack(alignment: .center, spacing: 18) {+ CardSurface(padding: 16, elevation: .flat) {+ HStack(alignment: .center, spacing: 20) {VStack(alignment: .leading, spacing: 3) {Text(Self.format(result.totalAllocatedSize))- .font(.system(size: 30, weight: .bold, design: .rounded))+ .font(.system(size: 21, weight: .semibold)).monospacedDigit()- .foregroundStyle(Tint.accent)Text("allocated in this folder").font(.system(size: 12.5)).foregroundStyle(.secondary)}Divider()- .frame(height: 48)+ .frame(height: 38)- VStack(alignment: .leading, spacing: 8) {- HStack(spacing: 8) {- StatusChip(label: StorageEntryRow.fileCountLabel(result.fileCount), systemImage: "doc", tint: Tint.accent)- StatusChip(label: StorageEntryRow.folderCountLabel(result.directoryCount), systemImage: "folder", tint: Tint.accent)- }- HStack(spacing: 8) {- StatusChip(- label: String(localized: "\(result.skippedCount) skipped"),- systemImage: "forward",- tint: result.skippedCount == 0 ? Tint.green : Tint.orange- )- StatusChip(- label: String(localized: "\(result.inaccessibleCount) inaccessible"),- systemImage: "lock",- tint: result.inaccessibleCount == 0 ? Tint.green : Tint.orange- )+ VStack(alignment: .leading, spacing: 5) {+ HStack(spacing: 12) {+ Text(StorageEntryRow.fileCountLabel(result.fileCount))+ Text(StorageEntryRow.folderCountLabel(result.directoryCount))}+ .font(.system(size: 13, weight: .medium))+ Text("\(result.skippedCount) skipped · \(result.inaccessibleCount) inaccessible")+ .font(.caption)+ .foregroundStyle(.secondary)}+ .monospacedDigit()Spacer()- StatusChip(- label: result.isPartial ? String(localized: "Partial result") : String(localized: "Complete"),- systemImage: result.isPartial ? "exclamationmark.triangle" : "checkmark.circle",- tint: result.isPartial ? Tint.orange : Tint.green- )+ if result.isPartial {+ StatusChip(label: String(localized: "Partial result"), systemImage: "exclamationmark.triangle", tint: Tint.orange)+ }}}}diff --git a/PureMacTests/AIAppsCleanupTests.swift b/PureMacTests/AIAppsCleanupTests.swiftnew file mode 100644index 0000000..a53cbf0--- /dev/null+++ b/PureMacTests/AIAppsCleanupTests.swift@@ -0,0 +1,174 @@+import XCTest+@testable import PureMac++final class AIAppsCleanupTests: XCTestCase {+ private let fileManager = FileManager.default+ private var fixtureHome: URL!++ override func setUpWithError() throws {+ fixtureHome = fileManager.temporaryDirectory+ .appendingPathComponent("PureMac-AIApps-\(UUID().uuidString)", isDirectory: true)+ .resolvingSymlinksInPath()+ try fileManager.createDirectory(at: fixtureHome, withIntermediateDirectories: true)+ }++ override func tearDownWithError() throws {+ if let fixtureHome, fileManager.fileExists(atPath: fixtureHome.path) {+ try fileManager.removeItem(at: fixtureHome)+ }+ }++ func testEveryScannedAIAppTargetCanBeCleaned() async throws {+ let paths = [+ ".ollama/logs",+ ".ollama/history",+ ".lmstudio/server-logs",+ ".lmstudio/conversations",+ "Library/Caches/ollama",+ "Library/Caches/com.electron.ollama",+ "Library/WebKit/com.electron.ollama",+ "Library/Saved Application State/com.electron.ollama.savedState",+ ]+ for path in paths {+ try createData(at: path, directory: path != ".ollama/history")+ }++ let scan = await ScanEngine(homeDirectory: fixtureHome).scanCategory(.aiApps)+ XCTAssertEqual(Set(scan.items.map(\.path)), Set(paths.map { fixtureHome.appendingPathComponent($0).path }))++ let result = await CleaningEngine(homeDirectory: fixtureHome).cleanItems(scan.items) { _ in }++ XCTAssertEqual(result.itemsCleaned, paths.count)+ XCTAssertTrue(result.errors.isEmpty, "\(result.errors)")+ XCTAssertTrue(result.requiresAdmin.isEmpty)+ for path in paths {+ XCTAssertFalse(fileManager.fileExists(atPath: fixtureHome.appendingPathComponent(path).path))+ }+ }++ func testDefaultSelectionPreservesHistoryConversationsAndModels() async throws {+ let retained = [".ollama/history", ".lmstudio/conversations", ".ollama/models", ".lmstudio/models", ".ollama/id_ed25519"]+ for path in retained + [".ollama/logs", ".lmstudio/server-logs"] {+ try createData(at: path, directory: path != ".ollama/history" && path != ".ollama/id_ed25519")+ }++ let scan = await ScanEngine(homeDirectory: fixtureHome).scanCategory(.aiApps)+ let history = try XCTUnwrap(scan.items.first { $0.path.hasSuffix("/.ollama/history") })+ let conversations = try XCTUnwrap(scan.items.first { $0.path.hasSuffix("/.lmstudio/conversations") })+ XCTAssertFalse(history.isSelected)+ XCTAssertFalse(conversations.isSelected)++ let result = await CleaningEngine(homeDirectory: fixtureHome).cleanCategory(scan) { _ in }++ XCTAssertEqual(result.itemsCleaned, 2)+ XCTAssertTrue(result.errors.isEmpty)+ for path in retained {+ XCTAssertTrue(fileManager.fileExists(atPath: fixtureHome.appendingPathComponent(path).path))+ }+ }++ func testAIAppCategoryRefusesModelsKeysAncestorsSiblingsAndUnrelatedCaches() async throws {+ let denied = [+ ".ollama/models", ".ollama/id_ed25519", ".lmstudio/models", ".lmstudio/config.json",+ ".ollama/logs-backup", ".lmstudio/server-logs-backup", "Library/Caches/unrelated",+ ]+ for path in denied {+ try createData(at: path)+ }+ let requested = denied + [".ollama", ".lmstudio", "Library/Caches"]+ let items = requested.map { item(at: fixtureHome.appendingPathComponent($0).path) }++ let result = await CleaningEngine(homeDirectory: fixtureHome).cleanItems(items) { _ in }++ XCTAssertEqual(result.itemsCleaned, 0)+ XCTAssertEqual(result.errors.count, requested.count)+ XCTAssertTrue(result.requiresAdmin.isEmpty)+ for path in requested {+ XCTAssertTrue(fileManager.fileExists(atPath: fixtureHome.appendingPathComponent(path).path))+ }+ }++ func testAIAppCleanupRejectsSymlinkedTargetsAndParents() async throws {+ try createData(at: "Library/Caches/foreign")+ let foreign = fixtureHome.appendingPathComponent("Library/Caches/foreign")+ let ollama = fixtureHome.appendingPathComponent(".ollama")+ try fileManager.createDirectory(at: ollama, withIntermediateDirectories: true)+ let logs = ollama.appendingPathComponent("logs")+ try fileManager.createSymbolicLink(at: logs, withDestinationURL: foreign)++ let lmstudio = fixtureHome.appendingPathComponent(".lmstudio")+ try createData(at: "foreign-studio/server-logs")+ try fileManager.createSymbolicLink(at: lmstudio, withDestinationURL: fixtureHome.appendingPathComponent("foreign-studio"))+ let linkedLogs = lmstudio.appendingPathComponent("server-logs")++ let result = await CleaningEngine(homeDirectory: fixtureHome)+ .cleanItems([item(at: logs.path), item(at: linkedLogs.path)]) { _ in }++ XCTAssertEqual(result.itemsCleaned, 0)+ XCTAssertEqual(result.errors.count, 2)+ XCTAssertTrue(fileManager.fileExists(atPath: foreign.appendingPathComponent("data.bin").path))+ XCTAssertTrue(fileManager.fileExists(atPath: fixtureHome.appendingPathComponent("foreign-studio/server-logs/data.bin").path))+ }++ func testAIAppCleanupRejectsVirtualActionsAndUnnormalizedPaths() async throws {+ try createData(at: ".ollama/logs")+ let logs = fixtureHome.appendingPathComponent(".ollama/logs").path+ let paths = [+ CleanableItem.simctlRuntimePathPrefix + UUID().uuidString,+ "", logs + "\0", fixtureHome.path + "/.ollama/../.ollama/logs",+ ]++ let result = await CleaningEngine(homeDirectory: fixtureHome).cleanItems(paths.map { item(at: $0) }) { _ in }++ XCTAssertEqual(result.itemsCleaned, 0)+ XCTAssertEqual(result.errors.count, paths.count)+ XCTAssertTrue(fileManager.fileExists(atPath: logs))+ }++ func testAIAppCleanupNeverUsesAdministratorRemoval() async throws {+ try createData(at: ".ollama/logs")+ let logs = fixtureHome.appendingPathComponent(".ollama/logs").path++ let result = await CleaningEngine(homeDirectory: fixtureHome)+ .cleanWithAdminPrivileges(items: [item(at: logs)])++ XCTAssertEqual(result.itemsCleaned, 0)+ XCTAssertEqual(result.errors.count, 1)+ XCTAssertTrue(result.requiresAdmin.isEmpty)+ XCTAssertTrue(fileManager.fileExists(atPath: logs))+ }++ func testAIAppPermissionFailureDoesNotRequestAdministratorRemoval() async throws {+ try createData(at: ".ollama/logs")+ let logs = fixtureHome.appendingPathComponent(".ollama/logs")+ try fileManager.setAttributes([.posixPermissions: 0o500], ofItemAtPath: logs.path)+ defer {+ do {+ try fileManager.setAttributes([.posixPermissions: 0o700], ofItemAtPath: logs.path)+ } catch {+ XCTFail("Could not restore fixture permissions: \(error)")+ }+ }++ let result = await CleaningEngine(homeDirectory: fixtureHome)+ .cleanItems([item(at: logs.path)]) { _ in }++ XCTAssertEqual(result.itemsCleaned, 0)+ XCTAssertEqual(result.freedSpace, 0)+ XCTAssertTrue(result.cleanedPaths.isEmpty)+ XCTAssertTrue(result.requiresAdmin.isEmpty)+ XCTAssertEqual(result.errors, ["AI app cleanup requires access as the current user: \(logs.path)"])+ XCTAssertTrue(fileManager.fileExists(atPath: logs.appendingPathComponent("data.bin").path))+ }++ private func createData(at relativePath: String, directory: Bool = true) throws {+ let url = fixtureHome.appendingPathComponent(relativePath)+ let file = directory ? url.appendingPathComponent("data.bin") : url+ try fileManager.createDirectory(at: file.deletingLastPathComponent(), withIntermediateDirectories: true)+ try Data(repeating: 0xAB, count: 4096).write(to: file)+ }++ private func item(at path: String) -> CleanableItem {+ CleanableItem(name: "AI app data", path: path, size: 4096, category: .aiApps, isSelected: true, lastModified: nil)+ }+}diff --git a/PureMacTests/AppleFeatureCatalogTests.swift b/PureMacTests/AppleFeatureCatalogTests.swiftnew file mode 100644index 0000000..9c2f653--- /dev/null+++ b/PureMacTests/AppleFeatureCatalogTests.swift@@ -0,0 +1,38 @@+import XCTest+@testable import PureMac++final class AppleFeatureCatalogTests: XCTestCase {+ private func version(_ major: Int, _ minor: Int = 0) -> OperatingSystemVersion {+ OperatingSystemVersion(majorVersion: major, minorVersion: minor, patchVersion: 0)+ }++ func testAvailabilityUsesMinorVersionForAppleIntelligence() throws {+ let features = AppleFeatureCatalog.features(for: version(15))+ let intelligence = try XCTUnwrap(features.first { $0.id == "intelligence" })+ let images = try XCTUnwrap(features.first { $0.id == "images" })+ XCTAssertFalse(intelligence.isAvailable(on: version(15)))+ XCTAssertTrue(intelligence.isAvailable(on: version(15, 1)))+ XCTAssertFalse(images.isAvailable(on: version(15, 1)))+ XCTAssertTrue(images.isAvailable(on: version(15, 2)))+ XCTAssertTrue(features.first { $0.id == "siri" }!.isAvailable(on: version(13)))+ }++ func testCurrentMacOSUsesSeparateControlsAndCurrentRestrictionNames() throws {+ let features = AppleFeatureCatalog.features(for: version(27))+ let intelligence = try XCTUnwrap(features.first { $0.id == "intelligence" })+ XCTAssertTrue(intelligence.steps.contains("separate"))+ XCTAssertFalse(intelligence.steps.contains("turn off Apple Intelligence"))+ XCTAssertTrue(features.first { $0.id == "extensions" }!.steps.contains("Set Extensions to Blocked"))+ XCTAssertTrue(features.first { $0.id == "images" }!.steps.contains("Enable All Restrictions"))+ XCTAssertTrue(features.first { $0.id == "images" }!.steps.contains("Blocked"))+ }++ func testCatalogHasUniqueIDsAndOnlyOfficialSupportLinks() {+ for major in [13, 14, 15, 26, 27] {+ let features = AppleFeatureCatalog.features(for: version(major))+ XCTAssertEqual(Set(features.map(\.id)).count, features.count)+ XCTAssertTrue(features.allSatisfy { $0.guide.scheme == "https" && $0.guide.host == "support.apple.com" })+ XCTAssertTrue(features.allSatisfy { !$0.steps.isEmpty })+ }+ }+}diff --git a/PureMacTests/AppleStorageServiceTests.swift b/PureMacTests/AppleStorageServiceTests.swiftnew file mode 100644index 0000000..313a08b--- /dev/null+++ b/PureMacTests/AppleStorageServiceTests.swift@@ -0,0 +1,149 @@+import Darwin+import XCTest+@testable import PureMac++final class AppleStorageServiceTests: XCTestCase {+ private var root: URL!++ override func setUpWithError() throws {+ root = FileManager.default.homeDirectoryForCurrentUser+ .appendingPathComponent("Library/Caches", isDirectory: true)+ .appendingPathComponent("PureMac-AppleStorage-\(UUID().uuidString)", isDirectory: true)+ try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)+ }++ override func tearDownWithError() throws {+ if let root { try FileManager.default.removeItem(at: root) }+ }++ func testEmptyAndMissingFoldersHaveDifferentStates() async throws {+ let missing = root.appendingPathComponent("Missing")+ let items = try await AppleStorageService.scan(locations: [location(root), location(missing)])++ XCTAssertEqual(items[0].status, .complete)+ XCTAssertEqual(items[0].allocatedBytes, 0)+ XCTAssertEqual(items[1].status, .notPresent)+ XCTAssertNil(items[1].allocatedBytes)+ }++ func testMeasuresAllocatedBytesAndCountsHardLinksOnce() async throws {+ let file = root.appendingPathComponent("payload")+ try Data(repeating: 0x31, count: 32_768).write(to: file)+ try FileManager.default.linkItem(at: file, to: root.appendingPathComponent("hard-link"))+ let sparse = root.appendingPathComponent("sparse")+ XCTAssertTrue(FileManager.default.createFile(atPath: sparse.path, contents: nil))+ let handle = try FileHandle(forWritingTo: sparse)+ try handle.truncate(atOffset: 64 * 1_024 * 1_024)+ try handle.close()+ var fileStat = stat()+ var sparseStat = stat()+ XCTAssertEqual(lstat(file.path, &fileStat), 0)+ XCTAssertEqual(lstat(sparse.path, &sparseStat), 0)++ let item = try await scan(root)++ XCTAssertEqual(item.status, .complete)+ XCTAssertEqual(item.allocatedBytes, Int64(fileStat.st_blocks + sparseStat.st_blocks) * 512)+ XCTAssertLessThan(try XCTUnwrap(item.allocatedBytes), 64 * 1_024 * 1_024)+ XCTAssertEqual(item.scannedCount, 3)+ }++ func testSymlinksAndPackagesAreSkippedAndReportedAsPartial() async throws {+ let outside = root.appendingPathComponent("Outside")+ try FileManager.default.createDirectory(at: outside, withIntermediateDirectories: true)+ try Data(repeating: 0x41, count: 131_072).write(to: outside.appendingPathComponent("payload"))+ let scanned = root.appendingPathComponent("Scanned")+ try FileManager.default.createDirectory(at: scanned, withIntermediateDirectories: true)+ try FileManager.default.createSymbolicLink(at: scanned.appendingPathComponent("link"), withDestinationURL: outside)+ let package = scanned.appendingPathComponent("Example.app/Contents")+ try FileManager.default.createDirectory(at: package, withIntermediateDirectories: true)+ try Data(repeating: 0x42, count: 65_536).write(to: package.appendingPathComponent("payload"))++ let item = try await scan(scanned)++ XCTAssertEqual(item.status, .partial)+ XCTAssertEqual(item.skippedCount, 2)+ XCTAssertEqual(item.allocatedBytes, 0)+ }++ func testSymbolicLinkRootAndAncestorAreUnavailable() async throws {+ let actual = root.appendingPathComponent("Actual/Nested")+ try FileManager.default.createDirectory(at: actual, withIntermediateDirectories: true)+ let link = root.appendingPathComponent("Linked")+ try FileManager.default.createSymbolicLink(at: link, withDestinationURL: actual.deletingLastPathComponent())++ for url in [link, link.appendingPathComponent("Nested")] {+ let item = try await scan(url)+ XCTAssertEqual(item.status, .unavailable)+ XCTAssertNil(item.allocatedBytes)+ XCTAssertEqual(item.skippedCount, 1)+ }+ }++ func testKnownModelPackagesAreMeasuredWithoutOpeningOtherPackages() async throws {+ let model = root.appendingPathComponent("model.mlmodelc")+ try FileManager.default.createDirectory(at: model, withIntermediateDirectories: true)+ let payload = model.appendingPathComponent("weights.bin")+ try Data(repeating: 0x32, count: 65_536).write(to: payload)+ var metadata = stat()+ XCTAssertEqual(lstat(payload.path, &metadata), 0)++ let items = try await AppleStorageService.scan(locations: [AppleStorageLocation(kind: .intelligenceModels, url: root)])+ let item = try XCTUnwrap(items.first)++ XCTAssertEqual(item.status, .complete)+ XCTAssertGreaterThanOrEqual(try XCTUnwrap(item.allocatedBytes), Int64(metadata.st_blocks) * 512)+ XCTAssertEqual(item.skippedCount, 0)+ }++ func testEntryLimitProducesLowerBoundRatherThanCompleteSize() async throws {+ for index in 0..<4 {+ try Data(repeating: UInt8(index), count: 8_192).write(to: root.appendingPathComponent("\(index)"))+ }++ let items = try await AppleStorageService.scan(locations: [location(root)], maxEntriesPerLocation: 2)+ let item = try XCTUnwrap(items.first)++ XCTAssertEqual(item.status, .partial)+ XCTAssertTrue(item.reachedLimit)+ XCTAssertEqual(item.scannedCount, 2)+ XCTAssertNotNil(item.allocatedBytes)+ }++ func testUnreadableFolderIsUnavailableNotEmpty() async throws {+ guard geteuid() != 0 else { throw XCTSkip("Root can read permission-restricted fixtures") }+ let locked = root.appendingPathComponent("Locked")+ try FileManager.default.createDirectory(at: locked, withIntermediateDirectories: true)+ XCTAssertEqual(chmod(locked.path, 0), 0)+ defer { _ = chmod(locked.path, S_IRWXU) }++ let item = try await scan(locked)++ XCTAssertEqual(item.status, .unavailable)+ XCTAssertNil(item.allocatedBytes)+ XCTAssertGreaterThan(item.inaccessibleCount, 0)+ }++ func testCancellationPropagatesInsteadOfReturningPartialSuccess() async throws {+ let locations = [location(root)]+ let task = Task {+ withUnsafeCurrentTask { $0?.cancel() }+ return try await AppleStorageService.scan(locations: locations)+ }++ do {+ _ = try await task.value+ XCTFail("Expected cancellation")+ } catch is CancellationError {+ }+ }++ private func location(_ url: URL) -> AppleStorageLocation {+ AppleStorageLocation(kind: .deviceBackups, url: url)+ }++ private func scan(_ url: URL) async throws -> AppleStorageItem {+ let items = try await AppleStorageService.scan(locations: [location(url)])+ return try XCTUnwrap(items.first)+ }+}diff --git a/PureMacTests/DeviceBackupCoordinationTests.swift b/PureMacTests/DeviceBackupCoordinationTests.swiftnew file mode 100644index 0000000..69d7d03--- /dev/null+++ b/PureMacTests/DeviceBackupCoordinationTests.swift@@ -0,0 +1,57 @@+import XCTest+@testable import PureMac++@MainActor+final class DeviceBackupCoordinationTests: XCTestCase {+ func testScheduledScanWaitsUntilBackupRemovalFinishes() {+ let state = AppState(performStartupTasks: false)+ XCTAssertTrue(state.canRunScheduledScan(isAppActive: false))++ state.deviceBackupRemovalInProgress = true+ XCTAssertFalse(state.canRunScheduledScan(isAppActive: false))+ XCTAssertFalse(state.canRunScheduledScan(isAppActive: true))++ state.deviceBackupRemovalInProgress = false+ XCTAssertTrue(state.canRunScheduledScan(isAppActive: false))+ }++ func testBackupRemovalWaitsForActiveScanOrCleanup() {+ let state = AppState(performStartupTasks: false)+ XCTAssertTrue(state.canRemoveDeviceBackups)++ state.scanState = .scanning(progress: 0.5, currentCategory: "Trash Bins")+ XCTAssertFalse(state.canRemoveDeviceBackups)+ state.scanState = .cleaning(progress: 0.5)+ XCTAssertFalse(state.canRemoveDeviceBackups)+ state.scanState = .completed+ XCTAssertTrue(state.canRemoveDeviceBackups)+ state.deviceBackupRemovalInProgress = true+ XCTAssertFalse(state.canRemoveDeviceBackups)+ }++ func testManualScansDoNotStartDuringBackupRemoval() {+ let state = AppState(performStartupTasks: false)+ state.deviceBackupRemovalInProgress = true+ state.startSmartScan()+ XCTAssertEqual(state.scanState, .idle)+ state.scanSingleCategory(.trashBins)+ XCTAssertEqual(state.scanState, .idle)+ }++ func testManualAndScheduledCleanupWaitForBackupRemoval() {+ let state = AppState(performStartupTasks: false)+ let item = CleanableItem(name: "Fixture", path: "/fixtures/backup", size: 4096,+ category: .trashBins, isSelected: true, lastModified: nil)+ state.categoryResults[.trashBins] = CategoryResult(category: .trashBins, items: [item], totalSize: item.size)+ state.scanState = .completed+ state.deviceBackupRemovalInProgress = true++ state.cleanAll()+ XCTAssertEqual(state.scanState, .completed)+ state.cleanAll(scheduled: true)+ XCTAssertEqual(state.scanState, .completed)+ state.cleanCategory(.trashBins)+ XCTAssertEqual(state.scanState, .completed)+ XCTAssertEqual(state.categoryResults[.trashBins]?.items.map(\.id), [item.id])+ }+}diff --git a/PureMacTests/DeviceBackupServiceTests.swift b/PureMacTests/DeviceBackupServiceTests.swiftnew file mode 100644index 0000000..180a5f5--- /dev/null+++ b/PureMacTests/DeviceBackupServiceTests.swift@@ -0,0 +1,238 @@+import Darwin+import XCTest+@testable import PureMac++final class DeviceBackupServiceTests: XCTestCase {+ private var home: URL!+ private var backupRoot: URL { home.appendingPathComponent("Library/Application Support/MobileSync/Backup") }++ override func setUpWithError() throws {+ home = FileManager.default.homeDirectoryForCurrentUser+ .appendingPathComponent("Library/Caches", isDirectory: true)+ .appendingPathComponent("PureMacBackupTests-\(UUID().uuidString)")+ try FileManager.default.createDirectory(at: backupRoot, withIntermediateDirectories: true)+ }++ override func tearDownWithError() throws {+ if let home { try FileManager.default.removeItem(at: home) }+ }++ func testScanMeasuresAllocatedStorageAndListsOnlyChildFolders() async throws {+ let backup = try makeBackup("phone")+ let file = backup.appendingPathComponent("payload")+ try Data(repeating: 7, count: 8192).write(to: file)+ try FileManager.default.linkItem(at: file, to: backup.appendingPathComponent("same-storage"))+ try Data("ignore".utf8).write(to: backupRoot.appendingPathComponent("not-a-folder"))++ let result = try await service().scan()++ let item = try XCTUnwrap(result.backups.first)+ XCTAssertEqual(result.backups.count, 1)+ XCTAssertEqual(item.url, backup)+ let markerSize = try ["Manifest.plist", "Info.plist", "Status.plist", "Manifest.db"].reduce(Int64(0)) {+ try $0 + allocatedBytes(backup.appendingPathComponent($1))+ }+ XCTAssertEqual(item.allocatedSize, try allocatedBytes(backup) + allocatedBytes(file) + markerSize)+ XCTAssertTrue(result.issues.isEmpty)+ }++ func testValidSelectionUsesTrashAndReportsFailuresWithoutPermanentFallback() async throws {+ let first = try makeBackup("phone")+ let second = try makeBackup("tablet")+ let trash = home.appendingPathComponent("FixtureTrash")+ try FileManager.default.createDirectory(at: trash, withIntermediateDirectories: true)+ let instance = service { url in+ if url == second { throw POSIXError(.EACCES) }+ try FileManager.default.moveItem(at: url, to: trash.appendingPathComponent(url.lastPathComponent))+ }+ let scan = try await instance.scan()++ let result = try await instance.trash(scan.backups)++ XCTAssertEqual(result.removedPaths, [first.path])+ XCTAssertEqual(result.errors.count, 1)+ XCTAssertTrue(FileManager.default.fileExists(atPath: trash.appendingPathComponent("phone").path))+ XCTAssertTrue(FileManager.default.fileExists(atPath: second.path))+ XCTAssertTrue(FileManager.default.fileExists(atPath: backupRoot.path))+ }++ func testNestedSymlinkRejectsEntireBackupWithoutFollowingTarget() async throws {+ let backup = try makeBackup("phone")+ let target = home.appendingPathComponent("private-data")+ try FileManager.default.createDirectory(at: target, withIntermediateDirectories: true)+ try FileManager.default.createSymbolicLink(at: backup.appendingPathComponent("linked"), withDestinationURL: target)++ let result = try await service().scan()++ XCTAssertTrue(result.backups.isEmpty)+ XCTAssertEqual(result.issues.count, 1)+ XCTAssertTrue(FileManager.default.fileExists(atPath: target.path))+ }++ func testSymlinkedBackupRootIsRejected() async throws {+ let target = home.appendingPathComponent("elsewhere")+ try FileManager.default.moveItem(at: backupRoot, to: target)+ try FileManager.default.createSymbolicLink(at: backupRoot, withDestinationURL: target)++ let result = try await service().scan()++ XCTAssertTrue(result.backups.isEmpty)+ XCTAssertEqual(result.issues.count, 1)+ }++ func testSymlinkedParentIsRejected() async throws {+ let library = home.appendingPathComponent("Library")+ let target = home.appendingPathComponent("MovedLibrary")+ try FileManager.default.moveItem(at: library, to: target)+ try FileManager.default.createSymbolicLink(at: library, withDestinationURL: target)++ let result = try await service().scan()++ XCTAssertTrue(result.backups.isEmpty)+ XCTAssertEqual(result.issues.count, 1)+ }++ func testChangedDescendantRefusesTrash() async throws {+ let backup = try makeBackup("phone")+ let payload = backup.appendingPathComponent("payload")+ try Data("old".utf8).write(to: payload)+ let instance = service { _ in XCTFail("Changed backup must not reach Trash") }+ let scan = try await instance.scan()+ try Data("changed content".utf8).write(to: payload)++ let result = try await instance.trash(scan.backups)++ XCTAssertTrue(result.removedPaths.isEmpty)+ XCTAssertEqual(result.errors.count, 1)+ }++ func testReplacedBackupAndAddedSymlinkRefuseTrash() async throws {+ let backup = try makeBackup("phone")+ let instance = service { _ in XCTFail("Replaced backup must not reach Trash") }+ let scan = try await instance.scan()+ let moved = home.appendingPathComponent("old-backup")+ try FileManager.default.moveItem(at: backup, to: moved)+ try FileManager.default.createSymbolicLink(at: backup, withDestinationURL: moved)++ let result = try await instance.trash(scan.backups)++ XCTAssertTrue(result.removedPaths.isEmpty)+ XCTAssertEqual(result.errors.count, 1)+ XCTAssertTrue(FileManager.default.fileExists(atPath: moved.path))+ }++ func testExclusionAddedAfterScanProtectsBackupAndItsContainingFolder() async throws {+ let backup = try makeBackup("phone")+ let selected = try await service().scan().backups+ let instance = DeviceBackupService(+ homeDirectory: home,+ trashHandler: { _ in XCTFail("Excluded backup must not reach Trash") },+ exclusions: { [backup.appendingPathComponent("preserve").path] }+ )++ let result = try await instance.trash(selected)+ let scan = try await instance.scan()++ XCTAssertTrue(result.removedPaths.isEmpty)+ XCTAssertEqual(result.errors.count, 1)+ XCTAssertTrue(scan.backups.isEmpty)+ XCTAssertEqual(scan.issues.count, 1)+ }++ func testBackupFromAnotherRootCannotBeTrashed() async throws {+ _ = try makeBackup("phone")+ let scan = try await service().scan()+ let instance = DeviceBackupService(+ homeDirectory: home.appendingPathComponent("another-home"),+ trashHandler: { _ in XCTFail("Foreign backup must not reach Trash") },+ exclusions: { [] }+ )++ let result = try await instance.trash(scan.backups)++ XCTAssertTrue(result.removedPaths.isEmpty)+ XCTAssertEqual(result.errors.count, 1)+ }++ func testScanLimitNeverReturnsPartiallyMeasuredBackup() async throws {+ let backup = try makeBackup("phone")+ try Data("payload".utf8).write(to: backup.appendingPathComponent("payload"))+ let instance = DeviceBackupService(homeDirectory: home, exclusions: { [] }, maxEntries: 1)++ let result = try await instance.scan()++ XCTAssertTrue(result.backups.isEmpty)+ XCTAssertEqual(result.issues.count, 1)+ }++ func testMissingBackupRootIsEmpty() async throws {+ try FileManager.default.removeItem(at: backupRoot)++ let result = try await service().scan()++ XCTAssertTrue(result.backups.isEmpty)+ XCTAssertTrue(result.issues.isEmpty)+ }++ func testUnrecognizedAndInProgressFoldersAreNotOffered() async throws {+ try FileManager.default.createDirectory(at: backupRoot.appendingPathComponent("unrecognized"), withIntermediateDirectories: true)+ let inProgress = try makeBackup("active")+ let status = try PropertyListSerialization.data(fromPropertyList: ["SnapshotState": "in-progress"], format: .binary, options: 0)+ try status.write(to: inProgress.appendingPathComponent("Status.plist"))++ let result = try await service().scan()++ XCTAssertTrue(result.backups.isEmpty)+ XCTAssertEqual(result.issues.count, 2)+ }++ func testBackupThatBecomesActiveIsNotTrashed() async throws {+ let backup = try makeBackup("phone")+ let instance = service { _ in XCTFail("An active backup must not reach Trash") }+ let scan = try await instance.scan()+ let status = try PropertyListSerialization.data(fromPropertyList: ["SnapshotState": "in-progress"], format: .binary, options: 0)+ try status.write(to: backup.appendingPathComponent("Status.plist"))++ let result = try await instance.trash(scan.backups)++ XCTAssertTrue(result.removedPaths.isEmpty)+ XCTAssertEqual(result.errors.count, 1)+ }++ func testCancellationPreservesPartialRemovalReport() async throws {+ _ = try makeBackup("phone")+ _ = try makeBackup("tablet")+ let instance = service { _ in+ withUnsafeCurrentTask { $0?.cancel() }+ }+ let scan = try await instance.scan()+ let task = Task { try await instance.trash(scan.backups) }++ let result = try await task.value++ XCTAssertEqual(result.removedPaths.count, 1)+ XCTAssertEqual(result.errors.count, 1)+ XCTAssertTrue(result.errors[0].contains("cancelled"))+ }++ private func service(trashHandler: ((URL) throws -> Void)? = nil) -> DeviceBackupService {+ DeviceBackupService(homeDirectory: home, trashHandler: trashHandler, exclusions: { [] })+ }++ private func makeBackup(_ name: String) throws -> URL {+ let url = backupRoot.appendingPathComponent(name, isDirectory: true)+ try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)+ let marker = try PropertyListSerialization.data(fromPropertyList: ["Fixture": true], format: .binary, options: 0)+ for name in ["Manifest.plist", "Info.plist"] { try marker.write(to: url.appendingPathComponent(name)) }+ let status = try PropertyListSerialization.data(fromPropertyList: ["SnapshotState": "finished"], format: .binary, options: 0)+ try status.write(to: url.appendingPathComponent("Status.plist"))+ try Data("fixture manifest".utf8).write(to: url.appendingPathComponent("Manifest.db"))+ return url+ }++ private func allocatedBytes(_ url: URL) throws -> Int64 {+ var info = stat()+ guard lstat(url.path, &info) == 0 else { throw POSIXError(.EIO) }+ return Int64(info.st_blocks) * 512+ }+}diff --git a/README.md b/README.mdindex d07ea07..fb60792 100644--- a/README.md+++ b/README.md@@ -1,9 +1,9 @@<p align="center">- <img src="screenshots/smart-care.png" alt="PureMac Smart Care - storage overview and cleanup review" width="820">+ <img src="screenshots/smart-care.png" alt="PureMac Overview - storage and cleanup review" width="820"></p><p align="center">- <img src="screenshots/smart-care-dark.png" alt="PureMac Smart Care in dark appearance" width="820">+ <img src="screenshots/smart-care-dark.png" alt="PureMac Overview in dark appearance" width="820"></p><p align="center">@@ -152,6 +152,12 @@ Smart Scan checks each category in sequence and reports progress as files are fo### Storage and file review+**Apple Features** brings together the supported controls for Siri, Apple Intelligence, Image Playground, Genmoji, writing assistance, summaries, inline predictions, analytics, and personalized ads. Instructions follow the installed macOS version and open the relevant Settings pane or app. PureMac cannot reliably read or change these protected switches itself; opening Settings never marks a feature disabled.++The **Storage** tab in Apple Features measures known model assets, downloaded screen savers, GarageBand support files, Apple Loops, and local device backups. Missing, inaccessible, and partial results are distinguished. System-managed content is shown for review and is excluded from cleanup totals. Model storage is not promised as recoverable space. See the [Apple controls and storage research](docs/APPLE-FEATURES.md) for sources and version limits.++Local iPhone and iPad backups have a separate manual review. Nothing is preselected or scheduled. Selected backups move to the Trash after confirmation and fresh checks for changes, symbolic links, and exclusions. Keep any backup you may need to restore a device; space is not reclaimed until the Trash is emptied.+**Space Explorer** measures the allocated space inside a folder you choose. Drill into directories, compare their sizes, and reveal an item in Finder. Packages are measured without exposing their contents as navigable folders. Skipped and inaccessible items are reported.**Duplicate Finder** groups files with matching sizes and SHA-256 content hashes. Hard links are not counted as separate recoverable copies. Every group keeps one protected copy; selected extras move to the Trash only after confirmation and a fresh identity/content check. Emptying the Trash is a separate step.@@ -206,9 +212,13 @@ Give it a minute to re-seed, then open PureMac once. If it still sticks, a resta## Screenshots-| Smart Care | Dark appearance |+| Overview | Dark appearance |+|---|---|+|  |  |++| Apple Features | Apple Storage ||---|---|-|  |  |+|  |  || Space Explorer | Duplicate Finder ||---|---|diff --git a/docs/APPLE-FEATURES.md b/docs/APPLE-FEATURES.mdnew file mode 100644index 0000000..1957bf6--- /dev/null+++ b/docs/APPLE-FEATURES.md@@ -0,0 +1,86 @@+# Apple feature and storage research++Checked 2026-10-24 against Apple documentation. These are supported user workflows, not proof of a public API for changing the setting or of a setting's state on a particular Mac.++## Consumer controls++| Feature | Supported route | Boundary |+|---|---|---|+| Apple Intelligence | On macOS 15/26, System Settings > Apple Intelligence & Siri > Apple Intelligence. | Version-specific guide confirms off switch. Do not promise immediate model removal or a fixed number of GB. |+| Siri | System Settings > Apple Intelligence & Siri (or Siri), then switch Siri off. | Independent of Apple Intelligence, Dictation, and Siri history. Current macOS 27 guide uses Turn Off Siri. |+| Image Playground and Genmoji | Screen Time > Content & Privacy > enable restrictions > Intelligence & Siri > Image Creation off (26). | Restricts image creation; not an uninstall. Image Wand is iPhone/iPad only in this guide. |+| Writing Tools | Same Screen Time panel > Writing Tools off (26). | Restricts use; no storage savings promised. |+| ChatGPT integration | Apple Intelligence & Siri > ChatGPT > Use ChatGPT off; Setup Prompts off also prevents suggestions to configure it (26). | Screen Time > Intelligence Extensions off blocks extension access. Does not uninstall ChatGPT app. |+| Notification summaries | System Settings > Notifications > Summarize Notifications off. | Separate per-feature setting, especially relevant on 27. |+| Mail summaries | Mail > Settings > Viewing > Summarize Message Previews off. | App-owned setting; no system storage claim. |+| Inline text predictions | Keyboard > Text Input > Edit > Show inline predictive text off. | Separate from Apple Intelligence and autocorrection; language availability varies. |+| Apple analytics | Privacy & Security > Analytics & Improvements. | Review Share Mac Analytics, Improve Siri Dictation, and other sharing choices individually. |+| Personalized ads | Privacy & Security > Apple Advertising > Personalized Ads off. | Changes targeting; does not promise fewer ads. |++Sources:+- Apple Intelligence toggle, version 26: https://support.apple.com/guide/mac-help/mchl46361784/26/mac/26+- Siri settings, version 26: https://support.apple.com/guide/mac-help/mchl3fd7fc15/26/mac/26+- Screen Time restrictions, version 26: https://support.apple.com/guide/mac-help/mchlb2e44f94/26/mac/26+- ChatGPT, version 26: https://support.apple.com/guide/mac-help/mchlfc5cf131/26/mac/26+- Current per-feature controls: https://support.apple.com/guide/mac-help/mchlb2e44f94/mac+- Current Siri restrictions: https://support.apple.com/guide/mac-help/z25xrnykpuln/mac+- Inline predictions: https://support.apple.com/guide/mac-help/mchlp2299/mac+- Analytics and advertising: https://support.apple.com/guide/mac-help/mchl211c911f/27/mac/27+- Advertising details: https://support.apple.com/105131++macOS 27 reorganizes controls. Current Apple guides use System Settings > Siri > Turn Off Siri and Screen Time > Content & Privacy Restrictions > Siri > Don't Allow Siri / per-capability restrictions. Do not display 26 navigation unconditionally on 27.++Native verification on macOS 27.0.1 confirmed that Screen Time requires All Restrictions enabled before the Siri sheet controls become available. Its capabilities include Writing Assistance, Image Creation, and Extensions (including ChatGPT). The sheet states that the Siri version setting applies to the Apple Account across devices. Verification opened the panels without changing any setting.++## Model storage and protected apps++Opening https://support.apple.com/en-us/121115 currently returns the macOS 27 article. It describes system-integrated models and storage requirements; it no longer promises that turning a switch off deletes all models. Search-engine snippets still contain the older 26-era model-removal sentence. The live document wins. Do not hardcode a recoverable number, equate a disabled feature with deleted models, or delete MobileAsset/system model folders.++Apple states that macOS-required apps, including apps in /System, cannot be deleted through Finder. Ordinary downloaded apps can be moved to Trash; optional Apple apps outside protected system locations should be reviewed individually. Source: https://support.apple.com/102610++## Profiles and management++Apple's deployment table says legacy Writing Tools, Image Playground, and Genmoji restrictions (macOS 15+) require supervision: https://support.apple.com/guide/deployment/depba790e53/web++However, Apple's developer Restrictions metadata and official device-management schema do not flag those macOS keys as supervised (they do for iOS/visionOS), while the payload permits manual installation. `allowAssistant` is macOS 14+; `allowImagePlayground`, `allowGenmoji`, `allowWritingTools` are macOS 15+; `allowExternalIntelligenceIntegrations` is macOS 15.2+. All are deprecated from macOS 26.4. Sources:+- https://developer.apple.com/documentation/devicemanagement/restrictions+- https://github.com/apple/device-management/blob/release/mdm/profiles/com.apple.applicationaccess.yaml++Therefore do not claim every legacy profile is MDM-only, but also do not claim a manually installed profile enforces these controls without testing the target OS. New declarative Apple Intelligence configuration requires macOS 26.4+, supervision, and Device Enrollment or Automated Device Enrollment: https://support.apple.com/guide/deployment/apple-intelligence-declarative-configuration-dep9520d6032/web++No documented consumer API for changing or reliably reading these switches was established by this review. Hidden defaults writes, launchctl unloads, killing daemons, or installing a profile are not proof that the effective feature is disabled. Settings guidance is supported today; automatic changes need separate effective-state verification.++## Real optional storage++| Content | Apple-supported management | Product implication |+|---|---|---|+| GarageBand/Logic/MainStage sound content | General > Storage > Music Creation | Review in Storage; shared sound libraries can be used by more than one app. |+| Local iPhone/iPad backups | Finder device > General > Manage Backups; files at ~/Library/Application Support/MobileSync/Backup/ | User data, never generic junk or automatic selection. |+| Downloaded music/TV/books/podcasts | Corresponding Storage category or owning app | Remove local downloads through the app; do not conflate with deleting library/iCloud items. |+| Downloaded speech voices | Accessibility > Read & Speak > System voice info; swipe a downloaded voice left and delete | Use settings; preserve accessibility functionality and shared assets. |+| Xcode optional components/runtimes | Xcode > Settings > Components > info > Delete or Turn Off | Xcode owns supported component removal and reports recoverable size. |++Sources:+- https://support.apple.com/guide/mac-help/mchl3d437fbc/mac+- https://support.apple.com/108809+- https://support.apple.com/guide/mac-help/mchlp2290/mac+- https://developer.apple.com/documentation/xcode/downloading-and-installing-additional-xcode-components++No Apple-supported direct filesystem deletion workflow for downloaded aerial screen saver assets was established. An inventory can report their allocated storage with explicit access/measurement limits; do not promise cleanup or savings simply because the directory exists.++## Implemented boundaries++The Apple Features page opens settings and explains the remaining manual steps. It does not write undocumented preferences, install profiles, stop system services, infer enabled state from files, or remove protected apps. Version checks only determine whether to offer a settings shortcut; model, language, region, and management restrictions still affect availability.++Apple Storage measures allocated blocks in five known locations. Hard links are counted once per location. Symbolic links and cloud-only items are skipped, inaccessible entries and entry limits produce partial results, and absent locations are distinct from measured zero. Compiled model/resource packages are traversed only in the model inventory. No inventory result enters ordinary cleanup or scheduled cleaning.++Device backup removal is a separate user-level Trash workflow. It requires local regular Info.plist, Manifest.plist, Manifest.db and Status.plist files and a finished SnapshotState, then checks the full directory metadata again before removal. Legacy or incomplete backup formats remain available through Finder. Selections start empty, exclusions apply, and changed folders, symbolic links and scans exceeding 500,000 entries or 128 levels are refused. Navigating away cancels remaining work and preserves the partial result for review. FileManager's final Trash call is path-based, so a race remains after the last validation. No administrator or permanent-delete fallback exists. Space is retained until the Trash is emptied.++## Manual validation before claiming a change++1. Record macOS version and architecture; check feature availability in System Settings. Intel Macs and older macOS versions must not present unavailable Apple Intelligence controls as enabled.+2. Open each PureMac settings action and confirm the intended pane opens. If a deep link fails, show the manual route. Opening Settings must not mark the feature disabled.+3. On a disposable test account, change one supported setting, reopen the corresponding Apple UI, and check the affected behavior. Test Siri separately from Apple Intelligence, image creation, Writing Tools, extensions, and summaries. Restore the previous choice after testing.+4. For storage inventory, test an absent directory, unreadable directory, symlink, empty directory, and cancelled scan. Unknown/partial results must remain distinguishable from zero usage. Do not add review-only content to cleanup selections or scheduled cleaning.+5. Confirm system apps and OS-owned models cannot enter removal, ordinary Apple app removal uses an explicit review, and no SIP change or profile installation occurs as a side effect.+6. Recheck the feature on each supported OS version after Apple updates. A preference value or completed shell command alone does not establish that a restriction is effective.diff --git a/project.yml b/project.ymlindex 8339481..b1f6a8b 100644--- a/project.yml+++ b/project.yml@@ -19,8 +19,8 @@ settings:CODE_SIGN_ENTITLEMENTS: "PureMac/PureMac.entitlements"INFOPLIST_FILE: "PureMac/Info.plist"PRODUCT_BUNDLE_IDENTIFIER: "com.puremac.app"- MARKETING_VERSION: "3.1.0"- CURRENT_PROJECT_VERSION: "30"+ MARKETING_VERSION: "3.2.0"+ CURRENT_PROJECT_VERSION: "31"GENERATE_INFOPLIST_FILE: "NO"ASSETCATALOG_COMPILER_APPICON_NAME: "AppIcon"COMBINE_HIDPI_IMAGES: "YES"diff --git a/screenshots/apple-features.png b/screenshots/apple-features.pngnew file mode 100644index 0000000..05a6913Binary files /dev/null and b/screenshots/apple-features.png differdiff --git a/screenshots/apple-storage.png b/screenshots/apple-storage.pngnew file mode 100644index 0000000..71fb25aBinary files /dev/null and b/screenshots/apple-storage.png differdiff --git a/screenshots/smart-care-dark.png b/screenshots/smart-care-dark.pngindex b9ee52e..b03aa37 100644Binary files a/screenshots/smart-care-dark.png and b/screenshots/smart-care-dark.png differdiff --git a/screenshots/smart-care.png b/screenshots/smart-care.pngindex dfd890a..a96a3f5 100644Binary files a/screenshots/smart-care.png and b/screenshots/smart-care.png differ