Skip to content

Free, open-source macOS cleaner. CleanMyMac alternative with zero telemetry. Native SwiftUI, scheduled auto-cleaning, Xcode/Homebrew/system cache cleanup. MIT licensed.

feat: v2.0.0 - Complete architecture overhaul

moamenf2eeceeb8295
diff --git a/.gitignore b/.gitignore
index 11e0107..f99a2eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,3 +40,8 @@ fastlane/
fastlane/README.md
asc_api.py
ExportOptions.plist
+
+# Build artifacts
+*.dmg
+*.zip
+build/
diff --git a/PureMac.xcodeproj/project.pbxproj b/PureMac.xcodeproj/project.pbxproj
index 1e7df29..9a24225 100644
--- a/PureMac.xcodeproj/project.pbxproj
+++ b/PureMac.xcodeproj/project.pbxproj
@@ -7,46 +7,64 @@
objects = {
/* Begin PBXBuildFile section */
- 015C7A8CE16D49F2C445C02A /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01E751C3B9ED986F1E6D3C8F /* SettingsView.swift */; };
- 0A7B70CBA747ED9FEE20C51A /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5402892366B3F00417FD05F9 /* SidebarView.swift */; };
+ 013EF7B96BF046D4DB38FBC5 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 241E0895B09C71AB423B2F9E /* Localizable.strings */; };
+ 1B0D043102FDB245312A5147 /* AppFilesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798B80977D14647A5691B0A0 /* AppFilesView.swift */; };
+ 2253F11BDF561B617439C96B /* FullDiskAccessManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E866A1541D289C69144A5E62 /* FullDiskAccessManager.swift */; };
27F449EDD1B082FE11FEC9DF /* SchedulerService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28181F034530331A550C6A3D /* SchedulerService.swift */; };
340E424F759ACCDE7372F99F /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5ADDC35F31E40780FB5D017 /* Theme.swift */; };
+ 47C5ECD49C4DD75F271DB6CE /* StringNormalization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D3AC5F17D7CA94FAB1E8D7A /* StringNormalization.swift */; };
48D1431A7C99C19EEBDB056B /* CleaningEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A8DE5D45BA19E2670B57DC5 /* CleaningEngine.swift */; };
+ 4F754D89F4CE5142BE384062 /* AppConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = F31F91226CDCFBB8E303B7DA /* AppConstants.swift */; };
+ 75B5F0401D37F2872B1AD85A /* AppListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60E6BC61614B27C065BB18C9 /* AppListView.swift */; };
+ 76B132F9C499225D33E0D075 /* EmptyStateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 424F7B28624C271620E13BBC /* EmptyStateView.swift */; };
826A750D2D7EC14C2AE306A3 /* Models.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3667D46D8E2004EB4D73835A /* Models.swift */; };
- A221744A723582A6D075A7A0 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86105573F4051764E9E46626 /* ContentView.swift */; };
+ 8947F0CE448791BD50EECF46 /* Conditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB94E06E145558123BB5BFB3 /* Conditions.swift */; };
+ 93743B036059418560D876E6 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A8D39C3C250F26302EC45AB /* SettingsView.swift */; };
+ 9AA80E035DF7B33F6EE118DF /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = CED1B71D5F9510582E869CFD /* AppState.swift */; };
+ 9BB5AAA574AFED6C27A3F8E2 /* AppPathFinder.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC0FEE7141871ED5F9E36121 /* AppPathFinder.swift */; };
A89DF967EC9E5E8123B2925A /* SmartScanView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11BA091943263913276F3CCF /* SmartScanView.swift */; };
- AA0000000000000000000004 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AA0000000000000000000003 /* Localizable.strings */; };
B52938BBD11842631314543D /* CategoryDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10B0AF194677EAC1D5568785 /* CategoryDetailView.swift */; };
- B8A524AF7F7DCDFCFCA9EDF6 /* AppViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD7FDA1B749FFA61DFB52AB5 /* AppViewModel.swift */; };
+ CDCDFEBA39A3290101F86AC6 /* MainWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F510F232341EE18F11DC934 /* MainWindow.swift */; };
+ D50EB059E741011EB2523731 /* ScanError.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEF15CB1B8EFCA78EF491824 /* ScanError.swift */; };
D9445C2641A8637B65DA5ACE /* ScanEngine.swift in Sources */ = {isa = PBXBuildFile; fileRef = A711CDF5285F68775D9B5513 /* ScanEngine.swift */; };
- D9D4E0FA2F8C135400ABB13C /* AppConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9D4E0F92F8C135400ABB13C /* AppConstants.swift */; };
DDD6BA35DBF32E7A6B5F6F8B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B2EA41E1096FA8E3B916AD13 /* Assets.xcassets */; };
+ DDDA5879006CB97D5D7BDD87 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5785762276FB5E3209C6DE4D /* Logger.swift */; };
+ E60B0A2C5D0A6CAE35BF4DFB /* Locations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77D3D9A9BC52839E6D0A22BC /* Locations.swift */; };
EDEF28CAD23E936FBED1783B /* PureMacApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63581B70F9B10231964E3602 /* PureMacApp.swift */; };
- F1A2B3C4D5E6F70819203142 /* FullDiskAccessManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1B2C3D4E5F607182930A1B2 /* FullDiskAccessManager.swift */; };
+ FDA30FE6349CA01C8D859F04 /* OrphanListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B71E8F62DB76D85F41F9A2E9 /* OrphanListView.swift */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
- 01E751C3B9ED986F1E6D3C8F /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
+ 02E502E2B5C6AECC76E5CFEF /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
10B0AF194677EAC1D5568785 /* CategoryDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CategoryDetailView.swift; sourceTree = "<group>"; };
11BA091943263913276F3CCF /* SmartScanView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SmartScanView.swift; sourceTree = "<group>"; };
+ 1D3AC5F17D7CA94FAB1E8D7A /* StringNormalization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringNormalization.swift; sourceTree = "<group>"; };
+ 2641C6376DD6F5889F35510E /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
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>"; };
311078221878708524283765 /* PureMac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PureMac.app; sourceTree = BUILT_PRODUCTS_DIR; };
3667D46D8E2004EB4D73835A /* Models.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Models.swift; sourceTree = "<group>"; };
+ 3A8D39C3C250F26302EC45AB /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
+ 424F7B28624C271620E13BBC /* EmptyStateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyStateView.swift; sourceTree = "<group>"; };
46660271CFF167AB0FE7371D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
- 5402892366B3F00417FD05F9 /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = "<group>"; };
5664D2BDAEAA9AE3A53DB364 /* PureMac.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = PureMac.entitlements; sourceTree = "<group>"; };
+ 5785762276FB5E3209C6DE4D /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
+ 60E6BC61614B27C065BB18C9 /* AppListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppListView.swift; sourceTree = "<group>"; };
63581B70F9B10231964E3602 /* PureMacApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PureMacApp.swift; sourceTree = "<group>"; };
- 86105573F4051764E9E46626 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
- A1B2C3D4E5F607182930A1B2 /* FullDiskAccessManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullDiskAccessManager.swift; sourceTree = "<group>"; };
+ 77D3D9A9BC52839E6D0A22BC /* Locations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Locations.swift; sourceTree = "<group>"; };
+ 798B80977D14647A5691B0A0 /* AppFilesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppFilesView.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>"; };
A711CDF5285F68775D9B5513 /* ScanEngine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScanEngine.swift; sourceTree = "<group>"; };
- AA0000000000000000000001 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
- AA0000000000000000000002 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
- AA0000000000000000000005 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
+ AC0FEE7141871ED5F9E36121 /* AppPathFinder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppPathFinder.swift; sourceTree = "<group>"; };
B2EA41E1096FA8E3B916AD13 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ B71E8F62DB76D85F41F9A2E9 /* OrphanListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrphanListView.swift; sourceTree = "<group>"; };
C5ADDC35F31E40780FB5D017 /* Theme.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = "<group>"; };
- D9D4E0F92F8C135400ABB13C /* AppConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppConstants.swift; sourceTree = "<group>"; };
- DD7FDA1B749FFA61DFB52AB5 /* AppViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppViewModel.swift; sourceTree = "<group>"; };
+ CB94E06E145558123BB5BFB3 /* Conditions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Conditions.swift; sourceTree = "<group>"; };
+ CED1B71D5F9510582E869CFD /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = "<group>"; };
+ E866A1541D289C69144A5E62 /* FullDiskAccessManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullDiskAccessManager.swift; sourceTree = "<group>"; };
+ EEF15CB1B8EFCA78EF491824 /* ScanError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScanError.swift; sourceTree = "<group>"; };
+ F31F91226CDCFBB8E303B7DA /* AppConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppConstants.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
@@ -62,6 +80,7 @@
isa = PBXGroup;
children = (
3667D46D8E2004EB4D73835A /* Models.swift */,
+ EEF15CB1B8EFCA78EF491824 /* ScanError.swift */,
);
path = Models;
sourceTree = "<group>";
@@ -78,10 +97,12 @@
isa = PBXGroup;
children = (
10B0AF194677EAC1D5568785 /* CategoryDetailView.swift */,
- 86105573F4051764E9E46626 /* ContentView.swift */,
- 01E751C3B9ED986F1E6D3C8F /* SettingsView.swift */,
- 5402892366B3F00417FD05F9 /* SidebarView.swift */,
+ 9F510F232341EE18F11DC934 /* MainWindow.swift */,
11BA091943263913276F3CCF /* SmartScanView.swift */,
+ DAD2EC78EB98016ADA27D114 /* Apps */,
+ 8AE26715B5748307483A1A5E /* Components */,
+ 9D3C2DC382F5D4B77DFD218B /* Orphans */,
+ 7BC68AB045DA6E5299FD3CB6 /* Settings */,
);
path = Views;
sourceTree = "<group>";
@@ -90,13 +111,21 @@
isa = PBXGroup;
children = (
2A8DE5D45BA19E2670B57DC5 /* CleaningEngine.swift */,
- A1B2C3D4E5F607182930A1B2 /* FullDiskAccessManager.swift */,
+ E866A1541D289C69144A5E62 /* FullDiskAccessManager.swift */,
A711CDF5285F68775D9B5513 /* ScanEngine.swift */,
28181F034530331A550C6A3D /* SchedulerService.swift */,
);
path = Services;
sourceTree = "<group>";
};
+ 7BC68AB045DA6E5299FD3CB6 /* Settings */ = {
+ isa = PBXGroup;
+ children = (
+ 3A8D39C3C250F26302EC45AB /* SettingsView.swift */,
+ );
+ path = Settings;
+ sourceTree = "<group>";
+ };
7C1729F88C0E5563E1A3DB40 /* Extensions */ = {
isa = PBXGroup;
children = (
@@ -105,32 +134,66 @@
path = Extensions;
sourceTree = "<group>";
};
+ 8AE26715B5748307483A1A5E /* Components */ = {
+ isa = PBXGroup;
+ children = (
+ 424F7B28624C271620E13BBC /* EmptyStateView.swift */,
+ );
+ path = Components;
+ sourceTree = "<group>";
+ };
+ 9D3C2DC382F5D4B77DFD218B /* Orphans */ = {
+ isa = PBXGroup;
+ children = (
+ B71E8F62DB76D85F41F9A2E9 /* OrphanListView.swift */,
+ );
+ path = Orphans;
+ sourceTree = "<group>";
+ };
A8F1C251567E5321E1CA2484 /* ViewModels */ = {
isa = PBXGroup;
children = (
- DD7FDA1B749FFA61DFB52AB5 /* AppViewModel.swift */,
+ CED1B71D5F9510582E869CFD /* AppState.swift */,
);
path = ViewModels;
sourceTree = "<group>";
};
- D9D4E0F82F8C135000ABB13C /* Core */ = {
+ D4333B07691BD85CAE0E5B15 /* Core */ = {
isa = PBXGroup;
children = (
- D9D4E0F92F8C135400ABB13C /* AppConstants.swift */,
+ F31F91226CDCFBB8E303B7DA /* AppConstants.swift */,
);
path = Core;
sourceTree = "<group>";
};
+ DAD2EC78EB98016ADA27D114 /* Apps */ = {
+ isa = PBXGroup;
+ children = (
+ 798B80977D14647A5691B0A0 /* AppFilesView.swift */,
+ 60E6BC61614B27C065BB18C9 /* AppListView.swift */,
+ );
+ path = Apps;
+ sourceTree = "<group>";
+ };
+ E05E733EFBC4EFDA12BEC43B /* Utilities */ = {
+ isa = PBXGroup;
+ children = (
+ 5785762276FB5E3209C6DE4D /* Logger.swift */,
+ );
+ path = Utilities;
+ sourceTree = "<group>";
+ };
E383F69184F4552E5A41D010 /* PureMac */ = {
isa = PBXGroup;
children = (
- D9D4E0F82F8C135000ABB13C /* Core */,
B2EA41E1096FA8E3B916AD13 /* Assets.xcassets */,
- AA0000000000000000000003 /* Localizable.strings */,
46660271CFF167AB0FE7371D /* Info.plist */,
5664D2BDAEAA9AE3A53DB364 /* PureMac.entitlements */,
63581B70F9B10231964E3602 /* PureMacApp.swift */,
+ D4333B07691BD85CAE0E5B15 /* Core */,
7C1729F88C0E5563E1A3DB40 /* Extensions */,
+ 241E0895B09C71AB423B2F9E /* Localizable.strings */,
+ F283C00EB52AB140F61500A3 /* Logic */,
3CF46713F75B81F0F86D1C6F /* Models */,
6184B2EC3D01E6E95633406E /* Services */,
A8F1C251567E5321E1CA2484 /* ViewModels */,
@@ -139,6 +202,26 @@
path = PureMac;
sourceTree = "<group>";
};
+ EC11280F62B0574E3699EFA6 /* Scanning */ = {
+ isa = PBXGroup;
+ children = (
+ AC0FEE7141871ED5F9E36121 /* AppPathFinder.swift */,
+ CB94E06E145558123BB5BFB3 /* Conditions.swift */,
+ 77D3D9A9BC52839E6D0A22BC /* Locations.swift */,
+ 1D3AC5F17D7CA94FAB1E8D7A /* StringNormalization.swift */,
+ );
+ path = Scanning;
+ sourceTree = "<group>";
+ };
+ F283C00EB52AB140F61500A3 /* Logic */ = {
+ isa = PBXGroup;
+ children = (
+ EC11280F62B0574E3699EFA6 /* Scanning */,
+ E05E733EFBC4EFDA12BEC43B /* Utilities */,
+ );
+ path = Logic;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -202,7 +285,7 @@
buildActionMask = 2147483647;
files = (
DDD6BA35DBF32E7A6B5F6F8B /* Assets.xcassets in Resources */,
- AA0000000000000000000004 /* Localizable.strings in Resources */,
+ 013EF7B96BF046D4DB38FBC5 /* Localizable.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -213,19 +296,28 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- B8A524AF7F7DCDFCFCA9EDF6 /* AppViewModel.swift in Sources */,
+ 4F754D89F4CE5142BE384062 /* AppConstants.swift in Sources */,
+ 1B0D043102FDB245312A5147 /* AppFilesView.swift in Sources */,
+ 75B5F0401D37F2872B1AD85A /* AppListView.swift in Sources */,
+ 9BB5AAA574AFED6C27A3F8E2 /* AppPathFinder.swift in Sources */,
+ 9AA80E035DF7B33F6EE118DF /* AppState.swift in Sources */,
B52938BBD11842631314543D /* CategoryDetailView.swift in Sources */,
48D1431A7C99C19EEBDB056B /* CleaningEngine.swift in Sources */,
- A221744A723582A6D075A7A0 /* ContentView.swift in Sources */,
+ 8947F0CE448791BD50EECF46 /* Conditions.swift in Sources */,
+ 76B132F9C499225D33E0D075 /* EmptyStateView.swift in Sources */,
+ 2253F11BDF561B617439C96B /* FullDiskAccessManager.swift in Sources */,
+ E60B0A2C5D0A6CAE35BF4DFB /* Locations.swift in Sources */,
+ DDDA5879006CB97D5D7BDD87 /* Logger.swift in Sources */,
+ CDCDFEBA39A3290101F86AC6 /* MainWindow.swift in Sources */,
826A750D2D7EC14C2AE306A3 /* Models.swift in Sources */,
- F1A2B3C4D5E6F70819203142 /* FullDiskAccessManager.swift in Sources */,
+ FDA30FE6349CA01C8D859F04 /* OrphanListView.swift in Sources */,
EDEF28CAD23E936FBED1783B /* PureMacApp.swift in Sources */,
D9445C2641A8637B65DA5ACE /* ScanEngine.swift in Sources */,
+ D50EB059E741011EB2523731 /* ScanError.swift in Sources */,
27F449EDD1B082FE11FEC9DF /* SchedulerService.swift in Sources */,
- 015C7A8CE16D49F2C445C02A /* SettingsView.swift in Sources */,
- 0A7B70CBA747ED9FEE20C51A /* SidebarView.swift in Sources */,
- D9D4E0FA2F8C135400ABB13C /* AppConstants.swift in Sources */,
+ 93743B036059418560D876E6 /* SettingsView.swift in Sources */,
A89DF967EC9E5E8123B2925A /* SmartScanView.swift in Sources */,
+ 47C5ECD49C4DD75F271DB6CE /* StringNormalization.swift in Sources */,
340E424F759ACCDE7372F99F /* Theme.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -233,12 +325,12 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
- AA0000000000000000000003 /* Localizable.strings */ = {
+ 241E0895B09C71AB423B2F9E /* Localizable.strings */ = {
isa = PBXVariantGroup;
children = (
- AA0000000000000000000001 /* en */,
- AA0000000000000000000002 /* zh-Hans */,
- AA0000000000000000000005 /* zh-Hant */,
+ 9F04B811BB0012F6D2F07F91 /* en */,
+ 2641C6376DD6F5889F35510E /* zh-Hans */,
+ 02E502E2B5C6AECC76E5CFEF /* zh-Hant */,
);
name = Localizable.strings;
sourceTree = "<group>";
@@ -250,6 +342,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "arm64 x86_64";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
@@ -281,11 +374,11 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = PureMac/PureMac.entitlements;
- CODE_SIGN_IDENTITY = "-";
+ CODE_SIGN_IDENTITY = "Developer ID Application: Moamen Basel (H3WXHVTP97)";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 4;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = H3WXHVTP97;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -307,10 +400,10 @@
GENERATE_INFOPLIST_FILE = NO;
INFOPLIST_FILE = PureMac/Info.plist;
MACOSX_DEPLOYMENT_TARGET = 13.0;
- MARKETING_VERSION = 1.0.0;
+ MARKETING_VERSION = 2.0.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
- ONLY_ACTIVE_ARCH = YES;
+ ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.puremac.app;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -326,10 +419,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = PureMac/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/../Frameworks",
- );
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = PureMac;
SDKROOT = macosx;
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -340,6 +430,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "arm64 x86_64";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
@@ -371,11 +462,11 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = PureMac/PureMac.entitlements;
- CODE_SIGN_IDENTITY = "-";
+ CODE_SIGN_IDENTITY = "Developer ID Application: Moamen Basel (H3WXHVTP97)";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 4;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = H3WXHVTP97;
ENABLE_NS_ASSERTIONS = NO;
@@ -391,9 +482,10 @@
GENERATE_INFOPLIST_FILE = NO;
INFOPLIST_FILE = PureMac/Info.plist;
MACOSX_DEPLOYMENT_TARGET = 13.0;
- MARKETING_VERSION = 1.0.0;
+ MARKETING_VERSION = 2.0.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
+ ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.puremac.app;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
@@ -409,10 +501,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
COMBINE_HIDPI_IMAGES = YES;
INFOPLIST_FILE = PureMac/Info.plist;
- LD_RUNPATH_SEARCH_PATHS = (
- "$(inherited)",
- "@executable_path/../Frameworks",
- );
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_NAME = PureMac;
SDKROOT = macosx;
SWIFT_EMIT_LOC_STRINGS = YES;
diff --git a/PureMac/Extensions/Theme.swift b/PureMac/Extensions/Theme.swift
index 544589e..c3525cf 100644
--- a/PureMac/Extensions/Theme.swift
+++ b/PureMac/Extensions/Theme.swift
@@ -1,134 +1,12 @@
import SwiftUI
-// MARK: - Color Theme
-
-extension Color {
- // Background colors
- static let pmBackground = Color(hex: "0f0f1a")
- static let pmSidebar = Color(hex: "161627")
- static let pmCard = Color(hex: "1c1c35")
- static let pmCardHover = Color(hex: "252545")
-
- // Accent colors
- static let pmAccent = Color(hex: "6366f1")
- static let pmAccentLight = Color(hex: "818cf8")
- static let pmAccentDark = Color(hex: "4f46e5")
-
- // Gradient colors
- static let pmGradientStart = Color(hex: "6366f1")
- static let pmGradientEnd = Color(hex: "a855f7")
- static let pmGradientAlt = Color(hex: "ec4899")
-
- // Status colors
- static let pmSuccess = Color(hex: "10b981")
- static let pmWarning = Color(hex: "f59e0b")
- static let pmDanger = Color(hex: "ef4444")
- static let pmInfo = Color(hex: "3b82f6")
-
- // Text colors
- static let pmTextPrimary = Color(hex: "f1f5f9")
- static let pmTextSecondary = Color(hex: "94a3b8")
- static let pmTextMuted = Color(hex: "64748b")
-
- // Separator
- static let pmSeparator = Color(hex: "2d2d50")
-
- init(hex: String) {
- let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
- var int: UInt64 = 0
- Scanner(string: hex).scanHexInt64(&int)
- let a, r, g, b: UInt64
- switch hex.count {
- case 6:
- (a, r, g, b) = (255, (int >> 16) & 0xFF, (int >> 8) & 0xFF, int & 0xFF)
- case 8:
- (a, r, g, b) = ((int >> 24) & 0xFF, (int >> 16) & 0xFF, (int >> 8) & 0xFF, int & 0xFF)
- default:
- (a, r, g, b) = (255, 0, 0, 0)
- }
- self.init(
- .sRGB,
- red: Double(r) / 255,
- green: Double(g) / 255,
- blue: Double(b) / 255,
- opacity: Double(a) / 255
- )
- }
-}
-
-// MARK: - Gradients
-
-struct AppGradients {
- static let primary = LinearGradient(
- colors: [.pmGradientStart, .pmGradientEnd],
- startPoint: .topLeading,
- endPoint: .bottomTrailing
- )
-
- static let accent = LinearGradient(
- colors: [.pmAccent, .pmGradientEnd],
- startPoint: .leading,
- endPoint: .trailing
- )
-
- static let danger = LinearGradient(
- colors: [.pmDanger, Color(hex: "dc2626")],
- startPoint: .leading,
- endPoint: .trailing
- )
-
- static let success = LinearGradient(
- colors: [.pmSuccess, Color(hex: "059669")],
- startPoint: .leading,
- endPoint: .trailing
- )
-
- static let background = LinearGradient(
- colors: [Color(hex: "0f0f1a"), Color(hex: "1a1a2e")],
- startPoint: .top,
- endPoint: .bottom
- )
-
- static let sidebar = LinearGradient(
- colors: [Color(hex: "131325"), Color(hex: "1a1a35")],
- startPoint: .top,
- endPoint: .bottom
- )
-
- static let scanRing = AngularGradient(
- colors: [.pmGradientStart, .pmGradientEnd, .pmGradientAlt, .pmGradientStart],
- center: .center
- )
-}
-
-// MARK: - Shadows
+// PureMac uses system colors exclusively.
+// The app respects the user's system appearance (light/dark/accent color).
extension View {
- func pmShadow(radius: CGFloat = 10, y: CGFloat = 4) -> some View {
- self.shadow(color: .black.opacity(0.3), radius: radius, x: 0, y: y)
- }
-
- func pmGlow(color: Color = .pmAccent, radius: CGFloat = 20) -> some View {
- self.shadow(color: color.opacity(0.3), radius: radius, x: 0, y: 0)
+ func cardBackground() -> some View {
+ self
+ .padding()
+ .background(.regularMaterial, in: RoundedRectangle(cornerRadius: 8))
}
}
-
-// MARK: - Text Styles
-
-extension Font {
- static let pmTitle = Font.system(size: 28, weight: .bold, design: .rounded)
- static let pmHeadline = Font.system(size: 20, weight: .semibold, design: .rounded)
- static let pmSubheadline = Font.system(size: 16, weight: .medium, design: .rounded)
- static let pmBody = Font.system(size: 14, weight: .regular, design: .rounded)
- static let pmCaption = Font.system(size: 12, weight: .medium, design: .rounded)
- static let pmLargeNumber = Font.system(size: 42, weight: .bold, design: .rounded)
- static let pmMediumNumber = Font.system(size: 24, weight: .bold, design: .rounded)
-}
-
-// MARK: - Animation
-
-extension Animation {
- static let pmSpring = Animation.spring(response: 0.5, dampingFraction: 0.8, blendDuration: 0)
- static let pmSmooth = Animation.easeInOut(duration: 0.3)
- static let pmSlow = Animation.easeInOut(duration: 0.6)
-}
diff --git a/PureMac/Logic/Scanning/AppPathFinder.swift b/PureMac/Logic/Scanning/AppPathFinder.swift
new file mode 100644
index 0000000..48e7a26
--- /dev/null
+++ b/PureMac/Logic/Scanning/AppPathFinder.swift
@@ -0,0 +1,372 @@
+//
+// AppPathFinder.swift
+// PureMac
+//
+// Heuristic file discovery engine that locates all filesystem artifacts
+// belonging to a given macOS application. Uses multi-level matching
+// against bundle identifiers, app names, entitlements, and team IDs
+// with configurable sensitivity.
+//
+
+import Foundation
+import AppKit
+
+class AppPathFinder {
+
+ // MARK: - Types
+
+ struct AppInfo {
+ let appName: String
+ let bundleIdentifier: String
+ let path: URL
+ let entitlements: [String]?
+ let teamIdentifier: String?
+ }
+
+ enum Sensitivity {
+ case strict // Exact bundle ID + exact name match only
+ case enhanced // + partial matching, bundle components, stripped version
+ case deep // + company name, entitlements, team ID
+ }
+
+ // MARK: - Properties
+
+ private let appInfo: AppInfo
+ private let locations: Locations
+ private let sensitivity: Sensitivity
+ private var collectionSet: Set<URL> = []
+ private let collectionQueue = DispatchQueue(label: "com.puremac.pathfinder.collection")
+
+ // Pre-computed cached identifiers (computed once in init, used in hot loop)
+ private let normalizedBundleID: String
+ private let bundleLastTwo: String
+ private let normalizedAppName: String
+ private let appNameLettersOnly: String
+ private let pathComponentName: String
+ private let companyName: String?
+ private let baseBundleID: String?
+ private let strippedAppName: String?
+ private let normalizedEntitlements: [String]
+ private let normalizedTeamID: String?
+
+ // MARK: - Initialization
+
+ init(appInfo: AppInfo, locations: Locations, sensitivity: Sensitivity = .enhanced) {
+ self.appInfo = appInfo
+ self.locations = locations
+ self.sensitivity = sensitivity
+
+ self.normalizedBundleID = appInfo.bundleIdentifier.normalizedForMatching()
+ self.bundleLastTwo = appInfo.bundleIdentifier.bundleLastTwoComponents
+ self.normalizedAppName = appInfo.appName.normalizedForMatching()
+ self.appNameLettersOnly = appInfo.appName.lettersOnly
+ self.pathComponentName = appInfo.path.lastPathComponent
+ .replacingOccurrences(of: ".app", with: "")
+ .normalizedForMatching()
+ self.companyName = appInfo.bundleIdentifier.bundleCompanyName
+ self.baseBundleID = appInfo.bundleIdentifier.baseBundleIdentifier?.normalizedForMatching()
+
+ let stripped = appInfo.appName.strippingTrailingVersion().normalizedForMatching()
+ self.strippedAppName = (stripped != normalizedAppName && !stripped.isEmpty) ? stripped : nil
+
+ self.normalizedEntitlements = appInfo.entitlements?.compactMap { e in
+ let n = e.normalizedForMatching()
+ return n.isEmpty ? nil : n
+ } ?? []
+
+ self.normalizedTeamID = appInfo.teamIdentifier?.normalizedForMatching()
+ }
+
+ // MARK: - Public API
+
+ /// Find all files related to this app synchronously.
+ func findPaths() -> Set<URL> {
+ collectionSet.insert(appInfo.path)
+
+ for location in locations.appSearch.paths {
+ let isLibRoot = isLibraryDirectory(location)
+ let maxDepth = isLibRoot ? 2 : 1
+ processLocation(location, currentDepth: 0, maxDepth: maxDepth, isLibraryRootSearch: isLibRoot)
+ }
+
+ let containers = discoverContainers()
+ collectionSet.formUnion(containers)
+
+ applyConditions()
+
+ return filterSubpaths(collectionSet)
+ }
+
+ /// Find all files related to this app with parallel location processing.
+ func findPathsAsync(completion: @escaping (Set<URL>) -> Void) {
+ collectionSet.insert(appInfo.path)
+
+ let group = DispatchGroup()
+ for location in locations.appSearch.paths {
+ group.enter()
+ DispatchQueue.global(qos: .userInitiated).async {
+ let isLibRoot = self.isLibraryDirectory(location)
+ let maxDepth = isLibRoot ? 2 : 1
+ self.processLocation(location, currentDepth: 0, maxDepth: maxDepth, isLibraryRootSearch: isLibRoot)
+ group.leave()
+ }
+ }
+
+ group.notify(queue: .global(qos: .userInitiated)) {
+ let containers = self.discoverContainers()
+ self.collectionQueue.sync {
+ self.collectionSet.formUnion(containers)
+ }
+ self.applyConditions()
+ let result = self.filterSubpaths(self.collectionSet)
+ DispatchQueue.main.async {
+ completion(result)
+ }
+ }
+ }
+
+ // MARK: - Location Processing
+
+ private func processLocation(_ location: String, currentDepth: Int, maxDepth: Int, isLibraryRootSearch: Bool) {
+ guard let contents = try? FileManager.default.contentsOfDirectory(atPath: location) else {
+ return
+ }
+
+ var localResults: [URL] = []
+ var subdirs: [URL] = []
+
+ for item in contents {
+ let itemURL = URL(fileURLWithPath: location).appendingPathComponent(item)
+ let normalizedName: String
+
+ if itemURL.hasDirectoryPath || itemURL.pathExtension.isEmpty {
+ normalizedName = item.normalizedForMatching()
+ } else {
+ normalizedName = (item as NSString).deletingPathExtension.normalizedForMatching()
+ }
+
+ var isDir: ObjCBool = false
+ guard FileManager.default.fileExists(atPath: itemURL.path, isDirectory: &isDir) else { continue }
+
+ if shouldSkipItem(normalizedName, at: itemURL) { continue }
+
+ if matchesApp(normalizedName: normalizedName, itemURL: itemURL) {
+ let itemToAdd: URL
+
+ // For depth-2 matches in Library root, add the parent directory when
+ // it is a vendor folder (not a standard Library subdirectory).
+ if isLibraryRootSearch && currentDepth == 2 {
+ let parent = itemURL.deletingLastPathComponent()
+ let parentName = parent.lastPathComponent
+ if !Locations.standardLibrarySubdirectories.contains(parentName) {
+ itemToAdd = parent
+ } else {
+ itemToAdd = itemURL
+ }
+ } else {
+ itemToAdd = itemURL
+ }
+
+ localResults.append(itemToAdd)
+ }
+
+ // Recurse into subdirectories up to maxDepth
+ if isDir.boolValue && currentDepth < maxDepth {
+ if isLibraryRootSearch && currentDepth == 0 {
+ if !skipDeepSearch.contains(itemURL.lastPathComponent) {
+ subdirs.append(itemURL)
+ }
+ } else {
+ subdirs.append(itemURL)
+ }
+ }
+ }
+
+ collectionQueue.sync {
+ collectionSet.formUnion(localResults)
+ }
+
+ for subdir in subdirs {
+ processLocation(subdir.path, currentDepth: currentDepth + 1, maxDepth: maxDepth, isLibraryRootSearch: isLibraryRootSearch)
+ }
+ }
+
+ // MARK: - Matching Engine
+
+ /// Multi-level heuristic matcher. Returns true if the normalized filename
+ /// belongs to the target app at the current sensitivity level.
+ private func matchesApp(normalizedName: String, itemURL: URL) -> Bool {
+ // Per-app condition overrides take priority
+ for condition in appConditions {
+ if normalizedBundleID.contains(condition.bundleID) {
+ if condition.excludeTerms.contains(where: { normalizedName.contains($0) }) {
+ return false
+ }
+ if condition.includeTerms.contains(where: { normalizedName.contains($0) }) {
+ return true
+ }
+ }
+ }
+
+ // Entitlement-based matching
+ for entitlement in normalizedEntitlements {
+ let match = sensitivity == .strict
+ ? normalizedName == entitlement
+ : normalizedName.contains(entitlement)
+ if match { return true }
+ }
+
+ // Level 1: Full bundle identifier
+ let fullBundleMatch = normalizedName.contains(normalizedBundleID)
+
+ // Level 2: App name
+ let isStrict = sensitivity == .strict
+ let appNameMatch = !normalizedAppName.isEmpty && (isStrict
+ ? normalizedName == normalizedAppName
+ : normalizedName.contains(normalizedAppName))
+
+ // Level 3: Path component name (the .app directory name without extension)
+ let pathMatch = !pathComponentName.isEmpty && (isStrict
+ ? normalizedName == pathComponentName
+ : normalizedName.contains(pathComponentName))
+
+ // Level 4: Letters-only app name
+ let lettersMatch = !appNameLettersOnly.isEmpty && (isStrict
+ ? normalizedName == appNameLettersOnly
+ : normalizedName.contains(appNameLettersOnly))
+
+ if (normalizedBundleID.count >= 5 && fullBundleMatch) || appNameMatch || pathMatch || lettersMatch {
+ return true
+ }
+
+ // Enhanced mode: additional partial matching strategies
+ if sensitivity != .strict {
+ // Level 5: Last two bundle ID components
+ if normalizedName.contains(bundleLastTwo) { return true }
+
+ // Level 6: Base bundle ID (strips .helper/.agent/.daemon suffixes)
+ if let base = baseBundleID, !base.isEmpty, normalizedName.contains(base) { return true }
+
+ // Level 7: Version-stripped app name
+ if let stripped = strippedAppName, normalizedName.contains(stripped) { return true }
+ }
+
+ // Deep mode: broadest matching heuristics
+ if sensitivity == .deep {
+ // Level 8: Company name extracted from bundle ID
+ if let company = companyName, !company.isEmpty, normalizedName.contains(company) { return true }
+
+ // Level 9: Team identifier from code signature
+ if let teamID = normalizedTeamID, !teamID.isEmpty, normalizedName.contains(teamID) { return true }
+ }
+
+ return false
+ }
+
+ // MARK: - Skip Logic
+
+ private func shouldSkipItem(_ normalizedName: String, at url: URL) -> Bool {
+ if collectionSet.contains(url) { return true }
+
+ for skip in skipConditions {
+ for path in skip.skipPaths {
+ if url.path.hasPrefix(path) { return true }
+ }
+ if skip.skipPrefixes.contains(where: { normalizedName.hasPrefix($0) }) {
+ if !skip.allowPrefixes.contains(where: { normalizedName.hasPrefix($0) }) {
+ return true
+ }
+ }
+ }
+ return false
+ }
+
+ // MARK: - Container Discovery
+
+ /// Discovers sandboxed app containers that belong to this app by checking
+ /// both UUID-named containers (via metadata plist) and name-matched containers.
+ private func discoverContainers() -> [URL] {
+ var containers: [URL] = []
+
+ guard let containersPath = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask)
+ .first?.appendingPathComponent("Containers") else { return containers }
+
+ guard let dirs = try? FileManager.default.contentsOfDirectory(
+ at: containersPath, includingPropertiesForKeys: nil, options: .skipsHiddenFiles
+ ) else { return containers }
+
+ for dir in dirs {
+ let dirName = dir.lastPathComponent
+
+ // UUID-named containers: read the metadata plist for the owning bundle ID
+ if dirName.count == 36 && dirName.contains("-") {
+ let metaPlist = dir.appendingPathComponent(".com.apple.containermanagerd.metadata.plist")
+ if let meta = NSDictionary(contentsOf: metaPlist),
+ let bundleID = meta["MCMMetadataIdentifier"] as? String,
+ bundleID == appInfo.bundleIdentifier {
+ containers.append(dir)
+ }
+ }
+
+ // Named containers matching the bundle ID directly
+ if dirName.normalizedForMatching() == normalizedBundleID {
+ containers.append(dir)
+ }
+ }
+
+ return containers
+ }
+
+ // MARK: - Condition Application
+
+ /// Applies per-app force-include and force-exclude path overrides after
+ /// the main scan has completed.
+ private func applyConditions() {
+ for condition in appConditions {
+ if normalizedBundleID.contains(condition.bundleID) {
+ if let paths = condition.forceIncludePaths {
+ for path in paths {
+ if FileManager.default.fileExists(atPath: path.path) {
+ collectionSet.insert(path)
+ }
+ }
+ }
+ if let paths = condition.forceExcludePaths {
+ for path in paths {
+ collectionSet.remove(path)
+ }
+ }
+ }
+ }
+ }
+
+ // MARK: - Helpers
+
+ private func isLibraryDirectory(_ location: String) -> Bool {
+ location == "\(home)/Library" || location == "/Library"
+ }
+
+ /// Removes child paths when a parent is already in the set, and discards
+ /// results that consist solely of a Trash item.
+ private func filterSubpaths(_ urls: Set<URL>) -> Set<URL> {
+ let sorted = urls.map { $0.standardizedFileURL }.sorted { $0.path < $1.path }
+ var filtered: [URL] = []
+
+ for url in sorted {
+ // Remove any existing entries that are children of this URL
+ filtered.removeAll { $0.path.hasPrefix(url.path + "/") }
+
+ // Only add if this URL is not a child of an existing entry
+ if !filtered.contains(where: { url.path.hasPrefix($0.path + "/") }) {
+ filtered.append(url)
+ }
+ }
+
+ // A single result pointing into the Trash is not meaningful
+ if filtered.count == 1, let first = filtered.first, first.path.contains(".Trash") {
+ return []
+ }
+
+ return Set(filtered)
+ }
+}
diff --git a/PureMac/Logic/Scanning/Conditions.swift b/PureMac/Logic/Scanning/Conditions.swift
new file mode 100644
index 0000000..0ed4451
--- /dev/null
+++ b/PureMac/Logic/Scanning/Conditions.swift
@@ -0,0 +1,461 @@
+//
+// Conditions.swift
+// PureMac
+//
+// Per-app matching rules and system-level skip conditions for the heuristic scan engine.
+// These define edge cases where bundle ID and app name matching alone is insufficient.
+//
+
+import Foundation
+
+// MARK: - AppCondition
+
+/// Defines per-app overrides for the heuristic file matcher.
+///
+/// Some apps use naming conventions that collide with other apps (e.g. "Xcode" vs "Xcodes"),
+/// or scatter files under unexpected names. This struct lets the scanner include additional
+/// search terms, exclude false positives, and force-include/exclude specific filesystem paths.
+struct AppCondition: Codable {
+ let bundleID: String
+ let includeTerms: [String]
+ let excludeTerms: [String]
+ let forceIncludePaths: [URL]?
+ let forceExcludePaths: [URL]?
+
+ init(
+ bundleID: String,
+ includeTerms: [String],
+ excludeTerms: [String],
+ forceIncludePaths: [String]? = nil,
+ forceExcludePaths: [String]? = nil
+ ) {
+ self.bundleID = bundleID.normalizedForMatching()
+ self.includeTerms = includeTerms.map { $0.normalizedForMatching() }
+ self.excludeTerms = excludeTerms.map { $0.normalizedForMatching() }
+ self.forceIncludePaths = forceIncludePaths?.compactMap { path in
+ let url = URL(fileURLWithPath: path)
+ return FileManager.default.fileExists(atPath: url.path) ? url : nil
+ }
+ self.forceExcludePaths = forceExcludePaths?.compactMap { path in
+ let url = URL(fileURLWithPath: path)
+ return FileManager.default.fileExists(atPath: url.path) ? url : nil
+ }
+ }
+}
+
+// MARK: - SkipCondition
+
+/// Defines prefixes and paths that should be skipped during scanning.
+///
+/// `skipPrefixes` - Normalized filename prefixes that are always skipped (e.g. system plists).
+/// `allowPrefixes` - Exceptions to skipPrefixes for Apple apps we DO want to scan.
+/// `skipPaths` - Absolute paths that should never appear in scan results.
+struct SkipCondition {
+ let skipPrefixes: [String]
+ let allowPrefixes: [String]
+ let skipPaths: [String]
+}
+
+// MARK: - App Conditions Database
+
+/// Per-app matching overrides.
+/// Each entry handles a specific app whose files cannot be reliably found by bundle ID alone.
+let appConditions: [AppCondition] = [
+
+ // ---------------------------------------------------------------
+ // Apple Developer Tools
+ // ---------------------------------------------------------------
+
+ // Xcode: includes simulator containers, DerivedData markers, and Apple DT prefixes.
+ // Must exclude Xcodes.app (third-party Xcode version manager) and Xcode cleaner utilities.
+ AppCondition(
+ bundleID: "com.apple.dt.xcode",
+ includeTerms: ["com.apple.dt", "xcode", "simulator"],
+ excludeTerms: [
+ "com.robotsandpencils.xcodesapp",
+ "com.xcodesorg.xcodesapp",
+ "com.oneminutegames.xcodecleaner",
+ "io.hyperapp.xcodecleaner",
+ "available-xcodes",
+ "xcodes",
+ "cleaner for xcode"
+ ],
+ forceIncludePaths: [
+ "\(home)/Library/Containers/com.apple.iphonesimulator.ShareExtension"
+ ]
+ ),
+
+ // Xcodes.app (robotsandpencils variant)
+ AppCondition(
+ bundleID: "com.robotsandpencils.xcodesapp",
+ includeTerms: [],
+ excludeTerms: [
+ "com.apple.dt.xcode",
+ "com.oneminutegames.xcodecleaner",
+ "io.hyperapp.xcodecleaner"
+ ]
+ ),
+
+ // Xcodes.app (xcodesorg variant)
+ AppCondition(
+ bundleID: "com.xcodesorg.xcodesapp",
+ includeTerms: [],
+ excludeTerms: [
+ "com.apple.dt.xcode",
+ "com.oneminutegames.xcodecleaner",
+ "io.hyperapp.xcodecleaner"
+ ]
+ ),
+
+ // Xcode Cleaner (hyperapp)
+ AppCondition(
+ bundleID: "io.hyperapp.xcodecleaner",
+ includeTerms: [],
+ excludeTerms: [
+ "com.robotsandpencils.xcodesapp",
+ "com.oneminutegames.xcodecleaner",
+ "com.apple.dt.xcode",
+ "xcodes.json"
+ ]
+ ),
+
+ // ---------------------------------------------------------------
+ // Communication & Video Conferencing
+ // ---------------------------------------------------------------
+
+ // Zoom: uses "us.zoom.xos" bundle but files are often named just "zoom".
+ AppCondition(
+ bundleID: "us.zoom.xos",
+ includeTerms: ["zoom"],
+ excludeTerms: []
+ ),
+
+ // Microsoft Teams: exclude general Office shared frameworks.
+ AppCondition(
+ bundleID: "com.microsoft.teams2",
+ includeTerms: [],
+ excludeTerms: ["office"]
+ ),
+
+ // ---------------------------------------------------------------
+ // Web Browsers
+ // ---------------------------------------------------------------
+
+ // Brave Browser
+ AppCondition(
+ bundleID: "com.brave.browser",
+ includeTerms: ["brave"],
+ excludeTerms: []
+ ),
+
+ // Google Chrome: include "google" and "chrome" but exclude iTerm's chromefeaturestate
+ // and unrelated "monochrome" matches.
+ AppCondition(
+ bundleID: "com.google.chrome",
+ includeTerms: ["google", "chrome"],
+ excludeTerms: ["iterm", "chromefeaturestate", "monochrome"]
+ ),
+
+ // Microsoft Edge: exclude other Microsoft products that share the "com.microsoft" prefix.
+ AppCondition(
+ bundleID: "com.microsoft.edgemac",
+ includeTerms: [],
+ excludeTerms: ["vscode", "rdc", "appcenter", "office", "oneauth"]
+ ),
+
+ // Mozilla Firefox (release)
+ AppCondition(
+ bundleID: "org.mozilla.firefox",
+ includeTerms: ["firefox"],
+ excludeTerms: ["thunderbird"]
+ ),
+
+ // Mozilla Firefox Nightly
+ AppCondition(
+ bundleID: "org.mozilla.firefox.nightly",
+ includeTerms: ["mozilla", "firefox"],
+ excludeTerms: ["thunderbird"]
+ ),
+
+ // Mozilla Thunderbird
+ AppCondition(
+ bundleID: "org.mozilla.thunderbird",
+ includeTerms: [],
+ excludeTerms: ["firefox"]
+ ),
+
+ // Arc Browser: uses Firestore for sync; force-include its App Support and Caches folders.
+ AppCondition(
+ bundleID: "company.thebrowser.Browser",
+ includeTerms: ["firestore"],
+ excludeTerms: [],
+ forceIncludePaths: [
+ "\(home)/Library/Application Support/Arc/",
+ "\(home)/Library/Caches/Arc/"
+ ]
+ ),
+
+ // ---------------------------------------------------------------
+ // Developer Tools & IDEs
+ // ---------------------------------------------------------------
+
+ // VS Code: force-include the "Code" support directory.
+ // Must exclude VS Code Insiders to prevent cross-contamination.
+ AppCondition(
+ bundleID: "com.microsoft.VSCode",
+ includeTerms: ["vscode"],
+ excludeTerms: ["vscodeinsiders", "insiders"],
+ forceIncludePaths: [
+ "\(home)/Library/Application Support/Code/"
+ ]
+ ),
+
+ // VS Code Insiders: separate from stable VS Code.
+ AppCondition(
+ bundleID: "com.microsoft.VSCodeInsiders",
+ includeTerms: ["vscodeinsiders", "insiders"],
+ excludeTerms: [],
+ forceIncludePaths: [
+ "\(home)/Library/Application Support/Code - Insiders/"
+ ]
+ ),
+
+ // GitHub Desktop: uses "comgithubelectron" in some legacy cache paths.
+ AppCondition(
+ bundleID: "com.github.githubclient",
+ includeTerms: ["comgithubelectron"],
+ excludeTerms: []
+ ),
+
+ // JetBrains IDEs (IntelliJ, PyCharm, WebStorm, etc.): share common directories.
+ // The bundle ID prefix "jetbrains" matches all JetBrains products.
+ AppCondition(
+ bundleID: "jetbrains",
+ includeTerms: ["jcef"],
+ excludeTerms: [],
+ forceIncludePaths: [
+ "\(home)/Library/Application Support/JetBrains/",
+ "\(home)/Library/Caches/JetBrains/",
+ "\(home)/Library/Logs/JetBrains/"
+ ]
+ ),
+
+ // Native Instruments (Native Access, Kontakt, etc.)
+ AppCondition(
+ bundleID: "com.native-instruments.nativeaccess",
+ includeTerms: ["comnative", "nativeinstruments"],
+ excludeTerms: []
+ ),
+
+ // ---------------------------------------------------------------
+ // Productivity & Utilities
+ // ---------------------------------------------------------------
+
+ // Logi Options+: "logi" prefix collides with "login" and "logic".
+ AppCondition(
+ bundleID: "com.logi.optionsplus",
+ includeTerms: ["logi", "logipluginservice"],
+ excludeTerms: ["login", "logic"]
+ ),
+
+ // 1Password: uses shared Chromium-based browser engine paths.
+ AppCondition(
+ bundleID: "com.1password.1password",
+ includeTerms: ["waveboxapp", "sidekick"],
+ excludeTerms: []
+ ),
+
+ // Stats (system monitor): exclude "video" to avoid matching video-stats plists.
+ AppCondition(
+ bundleID: "eu.exelban.stats",
+ includeTerms: [],
+ excludeTerms: ["video"]
+ ),
+
+ // BatteryToolkit: plist prefix uses concatenated form "memhaeuser".
+ AppCondition(
+ bundleID: "me.mhaeuser.BatteryToolkit",
+ includeTerms: ["memhaeuser"],
+ excludeTerms: []
+ ),
+
+ // Okta Verify
+ AppCondition(
+ bundleID: "com.okta.mobile",
+ includeTerms: ["okta"],
+ excludeTerms: []
+ ),
+
+ // ---------------------------------------------------------------
+ // Virtualization & Remote Access
+ // ---------------------------------------------------------------
+
+ // BlueStacks: uses interprocess communication files with non-obvious names.
+ AppCondition(
+ bundleID: "com.now.gg.BlueStacks",
+ includeTerms: ["bst_boost_interprocess"],
+ excludeTerms: []
+ ),
+
+ // StrongDM: Electron app with "sdm" bundle but files named "strongdm".
+ AppCondition(
+ bundleID: "com.electron.sdm",
+ includeTerms: ["strongdm"],
+ excludeTerms: []
+ ),
+
+ // ---------------------------------------------------------------
+ // Social & Messaging
+ // ---------------------------------------------------------------
+
+ // Facebook Archon (Workplace): includes login helper with different naming.
+ AppCondition(
+ bundleID: "com.facebook.archon.developerid",
+ includeTerms: ["archon.loginhelper"],
+ excludeTerms: []
+ ),
+]
+
+// MARK: - Skip Conditions
+
+/// System-level skip rules applied globally during scanning.
+/// Prevents the scanner from matching macOS system files, the Trash, and known false positives.
+let skipConditions: [SkipCondition] = [
+ SkipCondition(
+ skipPrefixes: [
+ "mobiledocuments",
+ "reminders",
+ "dsstore",
+ "comapplepasswordmanager"
+ ],
+ allowPrefixes: [
+ "comappleconfigurator",
+ "comappledt",
+ "comappleiwork",
+ "comapplesfsymbols",
+ "comappletestflight",
+ "comapplesharedfilelist",
+ "comapplelssharedfilelist"
+ ],
+ skipPaths: [
+ "\(home)/.Trash",
+ "/Library/SystemExtensions",
+ "/System/Volumes/Preboot/Cryptexes/App/System/Library/CoreServices/PasswordManagerBrowserExtensionHelper.app/Contents/MacOS/PasswordManagerBrowserExtensionHelper",
+ "\(home)/Library/Application Support/Chromium/NativeMessagingHosts/com.apple.passwordmanager.json",
+ "\(home)/Library/Application Support/Google/Chrome/NativeMessagingHosts/com.apple.passwordmanager.json"
+ ]
+ )
+]
+
+// MARK: - Deep Search Exclusions
+
+/// Library subdirectories excluded from depth=2 (deep) search.
+/// These are macOS system directories that never contain third-party app files.
+/// Searching them wastes time and produces false positives.
+let skipDeepSearch: Set<String> = [
+
+ // Core System
+ "Apple", "Audio", "Bluetooth", "ColorSync", "Components", "CoreAnalytics",
+ "CoreMediaIO", "DirectoryServices", "Filesystems", "GPUBundles", "Graphics",
+ "KernelCollections", "OSAnalytics", "OpenDirectory", "Sandbox", "Security",
+ "SystemExtensions", "SystemMigration", "SystemProfiler", "StagedDriverExtensions",
+ "StagedExtensions", "StartupItems",
+
+ // User Data & System Services
+ "Accessibility", "Accounts", "AppleMediaServices", "Assistant", "Assistants",
+ "Autosave Information", "Biome", "Calendars", "CallServices", "CloudStorage",
+ "Contacts", "Cookies", "DataAccess", "DataDeliveryServices", "DoNotDisturb",
+ "DuetExpertCenter", "Finance", "FinanceBackup", "FrontBoard", "GameKit",
+ "GroupContainersAlias", "HomeKit", "IdentityServices", "IntelligencePlatform",
+ "Intents", "KeyboardServices", "LanguageModeling", "LockdownMode", "Mail",
+ "MediaAnalysis", "Messages", "Metadata", "Mobile Documents", "MobileDevice",
+ "News", "Passes", "PersonalizationPortrait", "Photos", "PrivateCloudCompute",
+ "Reminders", "ResponseKit", "Safari", "SafariSafeBrowsing", "SafariSandboxBroker",
+ "ScreenRecordings", "StatusKit", "Suggestions", "SyncedPreferences", "Translation",
+ "UnifiedAssetFramework", "Weather", "homeenergyd", "studentd",
+
+ // Development & System Tools
+ "Developer", "Perl", "Ruby", "Java", "Python", "Catacomb", "InstallerSandboxes",
+ "Trial", "Updates", "Staging", "ContainerManager", "Daemon Containers",
+
+ // Additional System Directories
+ "ColorPickers", "Colors", "Compositions", "Contextual Menu Items", "Documentation",
+ "DriverExtensions", "Favorites", "FontCollections", "Fonts", "Image Capture",
+ "Input Methods", "Jupyter", "Keyboard", "Keyboard Layouts", "Keychains",
+ "Managed Preferences", "PDF Services", "Printers", "QuickLook", "Receipts",
+ "Screen Savers", "ScriptingAdditions", "Scripts", "Sharing", "Shortcuts",
+ "Sounds", "Speech", "Spelling", "Spotlight", "User Pictures", "User Template",
+ "Video", "WebServer", "Workflows",
+
+ // Apple Service Bundles (com.apple.*)
+ "com.apple.AppleMediaServices", "com.apple.WatchListKit", "com.apple.aiml.instrumentation",
+ "com.apple.appleaccountd", "com.apple.bluetooth.services.cloud", "com.apple.bluetoothuser",
+ "com.apple.familycircled", "com.apple.iTunesCloud", "com.apple.internal.ck",
+
+ // iCloud & Sync Infrastructure
+ "com.apple.cloudpaird", "com.apple.iCloudHelper", "com.apple.nsurlsessiond",
+ "com.apple.sbd", "com.apple.touristd",
+
+ // System Agents & Daemons
+ "com.apple.AMPLibraryAgent", "com.apple.bird", "com.apple.coreduetd",
+ "com.apple.homed", "com.apple.photoanalysisd", "com.apple.routined",
+ "com.apple.siriactionsd", "com.apple.suggestd",
+
+ // Frameworks & Runtime (never user-facing)
+ "com.apple.AppStoreComponents", "com.apple.ScreenTimeUI",
+ "com.apple.TelephonyUtilities", "com.apple.WebInspector"
+]
+
+// MARK: - Reverse Search Exclusions
+
+/// Normalized prefixes of files and folders to skip during orphan (reverse) search.
+/// These are macOS system items, Apple daemons, and infrastructure that should never
+/// be flagged as orphaned third-party app files.
+let skipReverse: [String] = [
+ // Apple & System
+ "apple", "temporary", "btserver", "proapps", "scripteditor", "ilife",
+ "livefsd", "siritoday", "addressbook", "animoji", "appstore",
+ "askpermission", "callhistory", "clouddocs", "diskimages", "dock",
+ "facetime", "fileprovider", "instruments", "knowledge", "mobilesync",
+ "syncservices", "homeenergyd", "icloud", "icdd", "networkserviceproxy",
+ "familycircle", "geoservices", "installation", "passkit",
+ "sharedimagecache", "desktop", "mbuseragent", "swiftpm", "baseband",
+ "coresimulator", "photoslegacyupgrade", "photosupgrade", "siritts",
+ "ipod", "globalpreferences",
+
+ // Analytics & Telemetry
+ "apmanalytics", "apmexperiment", "avatarcache", "byhost",
+ "contextstoreagent", "mobilemeaccounts", "mobiledocuments", "mobile",
+ "intentbuilderc", "loginwindow", "momc", "replayd", "sharedfilelistd",
+
+ // Build Tools & Compilers
+ "clang", "audiocomponent", "csexattrcryptoservice",
+ "livetranscriptionagent", "sandboxhelper", "statuskitagent",
+
+ // System Daemons
+ "betaenrollmentd", "contentlinkingd", "diagnosticextensionsd", "gamed",
+ "heard", "homed", "itunescloudd", "lldb", "mds", "mediaanalysisd",
+ "metrickitd", "mobiletimerd", "proactived", "ptpcamerad", "studentd",
+ "talagent", "watchlistd", "apptranslocation", "xcrun",
+
+ // Generic Infrastructure
+ "ds_store", "caches", "crashreporter", "trash",
+
+ // PureMac itself (never flag our own files)
+ "puremac",
+
+ // Common SDKs and Shared Components
+ "amsdatamigratortool", "arfilecache", "assistant", "chromium",
+ "cloudkit", "webkit", "databases", "diagnostic", "cache", "gamekit",
+ "homebrew", "logi", "microsoft", "mozilla", "sync", "google",
+ "sentinel", "hexnode", "sentry", "tvappservices", "reminders", "pbs",
+ "notarytool", "differentialprivacy", "storeassetd", "webpush",
+ "storedownloadd", "fsck", "crash", "python", "discrecording",
+ "photossearch", "pylint", "jamf", "scopedbookmarkagent", "anonymous",
+ "identifier", "isolated", "nobackup", "privacypreservingmeasurement",
+ "symbols", "stickersd", "privatecloudcomputed", "tipsd",
+ "controlcenter", "contactsd", "staticcheck", "index", "segment",
+ "sparkle", "summaryevents", "launchdarkly", "identityservicesd",
+ "embeddedbinaryvalidationutility", "aaprofilepicture", "minilauncher",
+ "jna", "automator", "locationaccessstored", "spotlight", "cef"
+]
diff --git a/PureMac/Logic/Scanning/Locations.swift b/PureMac/Logic/Scanning/Locations.swift
new file mode 100644
index 0000000..9bb9067
--- /dev/null
+++ b/PureMac/Logic/Scanning/Locations.swift
@@ -0,0 +1,163 @@
+//
+// Locations.swift
+// PureMac
+//
+// Defines all macOS filesystem locations where applications leave files.
+// Used by the heuristic scan engine to discover app-related artifacts.
+//
+
+import Foundation
+
+let home = FileManager.default.homeDirectoryForCurrentUser.path
+
+class Locations: ObservableObject {
+
+ struct SearchCategory {
+ let name: String
+ var paths: [String]
+ }
+
+ // Standard macOS Library subdirectories.
+ // Used to determine if depth=2 matches should add the parent directory (vendor folders)
+ // or the matched item itself (standard system folders).
+ static let standardLibrarySubdirectories: Set<String> = [
+ "Application Scripts", "Application Support", "Caches",
+ "Containers", "Group Containers", "HTTPStorages",
+ "Internet Plug-Ins", "LaunchAgents", "LaunchDaemons",
+ "Logs", "Preferences", "PreferencePanes",
+ "PrivilegedHelperTools", "Saved Application State",
+ "Services", "WebKit", "Extensions", "Frameworks"
+ ]
+
+ let cacheDir: String
+ let tempDir: String
+ var appSearch: SearchCategory
+ var reverseSearch: SearchCategory
+
+ init() {
+ let (cacheDir, tempDir) = Locations.darwinCT()
+ self.cacheDir = cacheDir
+ self.tempDir = tempDir
+
+ self.appSearch = SearchCategory(name: "Apps", paths: [
+ // User home
+ "\(home)",
+ "\(home)/.config",
+ "\(home)/Documents",
+ "\(home)/Desktop",
+ "\(home)/Applications",
+ // User Library
+ "\(home)/Library",
+ "\(home)/Library/Application Scripts",
+ "\(home)/Library/Application Support",
+ "\(home)/Library/Application Support/CrashReporter",
+ "\(home)/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments",
+ "\(home)/Library/Containers",
+ "\(home)/Library/Caches",
+ "\(home)/Library/Caches/com.apple.helpd/Generated",
+ "\(home)/Library/Caches/com.crashlytics",
+ "\(home)/Library/Caches/com.google.SoftwareUpdate",
+ "\(home)/Library/Caches/com.google.Keystone",
+ "\(home)/Library/Caches/org.sparkle-project.Sparkle",
+ "\(home)/Library/Caches/com.segment.analytics",
+ "\(home)/Library/Caches/SentryCrash",
+ "\(home)/Library/Caches/Rollbar",
+ "\(home)/Library/Caches/Amplitude",
+ "\(home)/Library/Caches/Realm",
+ "\(home)/Library/Caches/Parse",
+ "\(home)/Library/Group Containers",
+ "\(home)/Library/HTTPStorages",
+ "\(home)/Library/Internet Plug-Ins",
+ "\(home)/Library/LaunchAgents",
+ "\(home)/Library/Logs",
+ "\(home)/Library/Logs/DiagnosticReports",
+ "\(home)/Library/Preferences",
+ "\(home)/Library/PreferencePanes",
+ "\(home)/Library/Preferences/ByHost",
+ "\(home)/Library/Saved Application State",
+ "\(home)/Library/Services",
+ "\(home)/Library/WebKit",
+ // System-wide
+ "/Applications",
+ "/Users/Shared",
+ "/Users/Shared/Library/Application Support",
+ "/Library",
+ "/Library/Application Support",
+ "/Library/Application Support/CrashReporter",
+ "/Library/Caches",
+ "/Library/Extensions",
+ "/Library/Internet Plug-Ins",
+ "/Library/LaunchAgents",
+ "/Library/LaunchDaemons",
+ "/Library/Logs",
+ "/Library/Logs/DiagnosticReports",
+ "/Library/Preferences",
+ "/Library/PrivilegedHelperTools",
+ "/private/var/db/receipts",
+ "/private/tmp",
+ "/usr/local/bin",
+ "/usr/local/etc",
+ "/usr/local/opt",
+ "/usr/local/sbin",
+ "/usr/local/share",
+ "/usr/local/var",
+ cacheDir,
+ tempDir
+ ])
+
+ // Dynamically append Application Support subfolders for deeper search
+ let subfolders = Locations.listAppSupportDirectories()
+ for folder in subfolders {
+ self.appSearch.paths.append("\(home)/Library/Application Support/\(folder)")
+ }
+
+ self.reverseSearch = SearchCategory(name: "Reverse", paths: [
+ "\(home)/Library/Application Scripts",
+ "\(home)/Library/Application Support",
+ "\(home)/Library/Application Support/Caches",
+ "\(home)/Library/Application Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments",
+ "\(home)/Library/Containers",
+ "\(home)/Library/Caches",
+ "\(home)/Library/HTTPStorages",
+ "\(home)/Library/Internet Plug-Ins",
+ "\(home)/Library/LaunchAgents",
+ "\(home)/Library/Logs",
+ "\(home)/Library/Preferences",
+ "\(home)/Library/PreferencePanes",
+ "\(home)/Library/Preferences/ByHost",
+ "\(home)/Library/Saved Application State",
+ "\(home)/Library/WebKit",
+ "/Users/Shared/Library/Application Support",
+ "/Library/Application Support",
+ "/Library/Application Support/CrashReporter",
+ "/Library/Internet Plug-Ins",
+ "/Library/LaunchAgents",
+ "/Library/LaunchDaemons",
+ "/Library/PrivilegedHelperTools",
+ ])
+ }
+
+ static func darwinCT() -> (String, String) {
+ var cacheDir = ""
+ var tempDir = ""
+ if let cfCacheDir = NSSearchPathForDirectoriesInDomains(.cachesDirectory, .userDomainMask, true).first {
+ cacheDir = cfCacheDir
+ }
+ if let cfTempDir = ProcessInfo.processInfo.environment["TMPDIR"] {
+ tempDir = cfTempDir
+ }
+ return (cacheDir, tempDir)
+ }
+
+ static func listAppSupportDirectories() -> [String] {
+ let appSupportPath = "\(home)/Library/Application Support"
+ guard let contents = try? FileManager.default.contentsOfDirectory(atPath: appSupportPath) else {
+ return []
+ }
+ return contents.filter { item in
+ var isDir: ObjCBool = false
+ let fullPath = (appSupportPath as NSString).appendingPathComponent(item)
+ return FileManager.default.fileExists(atPath: fullPath, isDirectory: &isDir) && isDir.boolValue
+ }
+ }
+}
diff --git a/PureMac/Logic/Scanning/StringNormalization.swift b/PureMac/Logic/Scanning/StringNormalization.swift
new file mode 100644
index 0000000..df84029
--- /dev/null
+++ b/PureMac/Logic/Scanning/StringNormalization.swift
@@ -0,0 +1,50 @@
+import Foundation
+
+extension String {
+
+ func normalizedForMatching() -> String {
+ self.lowercased()
+ .replacingOccurrences(of: " ", with: "")
+ .replacingOccurrences(of: "-", with: "")
+ .replacingOccurrences(of: "_", with: "")
+ .replacingOccurrences(of: ".", with: "")
+ }
+
+ func strippingTrailingVersion() -> String {
+ self.replacingOccurrences(
+ of: #"\s+\d+(\.\d+)*\s*$"#,
+ with: "",
+ options: .regularExpression
+ ).trimmingCharacters(in: .whitespaces)
+ }
+
+ var lettersOnly: String {
+ self.filter { $0.isLetter }.lowercased()
+ }
+
+ var bundleCompanyName: String? {
+ let components = self.components(separatedBy: ".")
+ guard components.count == 3 else { return nil }
+ let company = components[1]
+ return company.isEmpty ? nil : company.normalizedForMatching()
+ }
+
+ var bundleLastTwoComponents: String {
+ let components = self.components(separatedBy: ".")
+ .compactMap { $0 != "-" ? $0.lowercased() : nil }
+ return components.suffix(2).joined()
+ }
+
+ var baseBundleIdentifier: String? {
+ let components = self.components(separatedBy: ".")
+ let suffixes: Set<String> = [
+ "helper", "agent", "daemon", "service", "xpc",
+ "launcher", "updater", "installer", "uninstaller",
+ "login", "extension", "plugin"
+ ]
+ guard components.count >= 4,
+ let last = components.last?.lowercased(),
+ suffixes.contains(last) else { return nil }
+ return components.dropLast().joined(separator: ".")
+ }
+}
diff --git a/PureMac/Logic/Utilities/Logger.swift b/PureMac/Logic/Utilities/Logger.swift
new file mode 100644
index 0000000..594584c
--- /dev/null
+++ b/PureMac/Logic/Utilities/Logger.swift
@@ -0,0 +1,59 @@
+import Foundation
+import os
+
+struct LogEntry: Identifiable, Sendable {
+ let id = UUID()
+ let timestamp = Date()
+ let message: String
+ let level: LogLevel
+ let source: String
+}
+
+enum LogLevel: String, Sendable, CaseIterable {
+ case debug
+ case info
+ case warning
+ case error
+
+ fileprivate var osLogType: OSLogType {
+ switch self {
+ case .debug: return .debug
+ case .info: return .info
+ case .warning: return .default
+ case .error: return .error
+ }
+ }
+}
+
+@MainActor
+final class Logger: ObservableObject {
+
+ static let shared = Logger()
+
+ @Published private(set) var entries: [LogEntry] = []
+
+ private static let maxEntries = 1000
+
+ private let osLogger: os.Logger
+
+ private init() {
+ let subsystem = Bundle.main.bundleIdentifier ?? "com.puremac.app"
+ self.osLogger = os.Logger(subsystem: subsystem, category: "general")
+ }
+
+ nonisolated func log(_ message: String, level: LogLevel = .info, source: String = #function) {
+ osLogger.log(level: level.osLogType, "\(message, privacy: .public)")
+
+ let entry = LogEntry(message: message, level: level, source: source)
+ Task { @MainActor [weak self] in
+ self?.append(entry)
+ }
+ }
+
+ private func append(_ entry: LogEntry) {
+ entries.append(entry)
+ if entries.count > Self.maxEntries {
+ entries.removeFirst(entries.count - Self.maxEntries)
+ }
+ }
+}
diff --git a/PureMac/Models/Models.swift b/PureMac/Models/Models.swift
index 78a9572..cbe4a43 100644
--- a/PureMac/Models/Models.swift
+++ b/PureMac/Models/Models.swift
@@ -6,7 +6,6 @@ enum CleaningCategory: String, CaseIterable, Identifiable, Codable {
case smartScan = "Smart Scan"
case systemJunk = "System Junk"
case userCache = "User Cache"
- case aiApps = "AI Apps"
case mailAttachments = "Mail Files"
case trashBins = "Trash Bins"
case largeFiles = "Large & Old Files"
@@ -21,7 +20,6 @@ enum CleaningCategory: String, CaseIterable, Identifiable, Codable {
case .smartScan: return "sparkles"
case .systemJunk: return "gearshape.fill"
case .userCache: return "internaldrive.fill"
- case .aiApps: return "cpu.fill"
case .mailAttachments: return "envelope.fill"
case .trashBins: return "trash.fill"
case .largeFiles: return "doc.fill"
@@ -36,7 +34,6 @@ enum CleaningCategory: String, CaseIterable, Identifiable, Codable {
case .smartScan: return "Scan everything at once"
case .systemJunk: return "System caches, logs, and temporary files"
case .userCache: return "Application caches and browser data"
- case .aiApps: return "Logs, caches, and temporary files from local AI apps"
case .mailAttachments: return "Downloaded mail attachments"
case .trashBins: return "Files in your Trash"
case .largeFiles: return "Files over 100 MB or older than 1 year"
@@ -48,16 +45,15 @@ enum CleaningCategory: String, CaseIterable, Identifiable, Codable {
var color: Color {
switch self {
- case .smartScan: return .pmAccent
- case .systemJunk: return .pmGradientEnd
- case .userCache: return .pmInfo
- case .aiApps: return Color(hex: "14b8a6")
- case .mailAttachments: return .pmWarning
- case .trashBins: return .pmDanger
- case .largeFiles: return Color(hex: "f97316")
- case .purgeableSpace: return .pmSuccess
- case .xcodeJunk: return Color(hex: "06b6d4")
- case .brewCache: return Color(hex: "84cc16")
+ case .smartScan: return .accentColor
+ case .systemJunk: return .purple
+ case .userCache: return .blue
+ case .mailAttachments: return .orange
+ case .trashBins: return .red
+ case .largeFiles: return .yellow
+ case .purgeableSpace: return .green
+ case .xcodeJunk: return .cyan
+ case .brewCache: return .mint
}
}
@@ -92,7 +88,7 @@ struct CleanableItem: Identifiable, Hashable {
let path: String
let size: Int64
let category: CleaningCategory
- let isSelected: Bool
+ var isSelected: Bool
let lastModified: Date?
var formattedSize: String {
diff --git a/PureMac/Models/ScanError.swift b/PureMac/Models/ScanError.swift
new file mode 100644
index 0000000..2dc567f
--- /dev/null
+++ b/PureMac/Models/ScanError.swift
@@ -0,0 +1,27 @@
+import Foundation
+
+enum ScanError: LocalizedError {
+ case permissionDenied(path: String)
+ case directoryEnumerationFailed(path: String, underlying: Error)
+ case processExecutionFailed(tool: String, underlying: Error)
+ case invalidData(context: String)
+ case helperToolUnavailable
+ case operationCancelled
+
+ var errorDescription: String? {
+ switch self {
+ case .permissionDenied(let path):
+ return "Permission denied when accessing '\(path)'. Grant Full Disk Access in System Settings."
+ case .directoryEnumerationFailed(let path, let underlying):
+ return "Failed to enumerate directory '\(path)': \(underlying.localizedDescription)"
+ case .processExecutionFailed(let tool, let underlying):
+ return "Failed to execute '\(tool)': \(underlying.localizedDescription)"
+ case .invalidData(let context):
+ return "Invalid data encountered: \(context)"
+ case .helperToolUnavailable:
+ return "The privileged helper tool is not installed or unavailable."
+ case .operationCancelled:
+ return "The operation was cancelled."
+ }
+ }
+}
diff --git a/PureMac/PureMacApp.swift b/PureMac/PureMacApp.swift
index 0b3c5ee..f1e9620 100644
--- a/PureMac/PureMacApp.swift
+++ b/PureMac/PureMacApp.swift
@@ -1,17 +1,28 @@
+import AppKit
import SwiftUI
+class AppDelegate: NSObject, NSApplicationDelegate {
+ func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { true }
+
+ func applicationDidFinishLaunching(_ notification: Notification) {
+ NSWindow.allowsAutomaticWindowTabbing = false
+ }
+}
+
@main
struct PureMacApp: App {
- @StateObject private var appViewModel = AppViewModel()
+ @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
+ @StateObject private var appState = AppState()
var body: some Scene {
WindowGroup {
- ContentView()
- .environmentObject(appViewModel)
+ MainWindow()
+ .environmentObject(appState)
.frame(minWidth: 900, minHeight: 600)
- .preferredColorScheme(.dark)
}
- .windowStyle(.hiddenTitleBar)
+ .windowStyle(.automatic)
+ .windowToolbarStyle(.unified)
+ .windowResizability(.contentMinSize)
.defaultSize(width: 1000, height: 680)
.commands {
CommandGroup(replacing: .newItem) {}
@@ -19,7 +30,7 @@ struct PureMacApp: App {
Settings {
SettingsView()
- .environmentObject(appViewModel)
+ .environmentObject(appState)
}
}
}
diff --git a/PureMac/Services/CleaningEngine.swift b/PureMac/Services/CleaningEngine.swift
index 6022abd..169771a 100644
--- a/PureMac/Services/CleaningEngine.swift
+++ b/PureMac/Services/CleaningEngine.swift
@@ -66,6 +66,7 @@ actor CleaningEngine {
let freedSpace = afterFree - beforeFree
return max(0, freedSpace)
} catch {
+ Logger.shared.log("diskutil purge failed: \(error.localizedDescription)", level: .error)
return 0
}
}
@@ -87,7 +88,7 @@ actor CleaningEngine {
try fileManager.removeItem(atPath: fullPath)
}
} catch {
- // Partial cleanup is OK
+ Logger.shared.log("Trash cleanup incomplete: \(error.localizedDescription)", level: .warning)
}
return totalFreed
@@ -100,6 +101,7 @@ actor CleaningEngine {
let attrs = try fileManager.attributesOfFileSystem(forPath: "/")
return (attrs[.systemFreeSize] as? Int64) ?? 0
} catch {
+ Logger.shared.log("Cannot read filesystem attributes: \(error.localizedDescription)", level: .warning)
return 0
}
}
diff --git a/PureMac/Services/ScanEngine.swift b/PureMac/Services/ScanEngine.swift
index c657460..a9de03c 100644
--- a/PureMac/Services/ScanEngine.swift
+++ b/PureMac/Services/ScanEngine.swift
@@ -19,8 +19,6 @@ actor ScanEngine {
return scanSystemJunk()
case .userCache:
return scanUserCache()
- case .aiApps:
- return scanAIApps()
case .mailAttachments:
return scanMailAttachments()
case .trashBins:
@@ -52,7 +50,7 @@ actor ScanEngine {
// Purgeable = space used by local snapshots that macOS can reclaim
info.purgeableSpace = getLocalSnapshotSize()
} catch {
- // Silently fail - disk info is supplementary
+ Logger.shared.log("Disk info unavailable: \(error.localizedDescription)", level: .warning)
}
return info
}
@@ -83,43 +81,21 @@ actor ScanEngine {
private func scanUserCache() -> CategoryResult {
var items: [CleanableItem] = []
- // Exclude vendor roots claimed by dedicated categories from the broad
- // ~/Library/Caches pass, then re-add the vendor root explicitly below so
- // unrelated app caches remain visible and we only avoid double-counting.
+ // Only exclude Homebrew since it has its own dedicated scan category
let excludedRootPaths = Set([
- "\(home)/Library/Caches/com.apple.Safari",
- "\(home)/Library/Caches/Google",
- "\(home)/Library/Caches/Firefox",
- "\(home)/Library/Caches/com.spotify.client",
- "\(home)/Library/Caches/com.microsoft.VSCode",
- "\(home)/Library/Caches/Slack",
"\(home)/Library/Caches/Homebrew",
- "\(home)/Library/Caches/com.apple.dt.Xcode",
- "\(home)/Library/Caches/pip",
- "\(home)/Library/Caches/com.electron.ollama",
- "\(home)/Library/Caches/ollama",
].map(normalizePath))
- let cachePaths = [
- "\(home)/Library/Caches",
- "\(home)/Library/Caches/com.apple.Safari",
- "\(home)/Library/Caches/Google",
- "\(home)/Library/Caches/Firefox",
- "\(home)/Library/Caches/com.spotify.client",
- "\(home)/Library/Caches/com.microsoft.VSCode",
- "\(home)/Library/Caches/Slack",
- ]
-
- for path in cachePaths {
- let scanned = scanDirectory(
- path: path,
- category: .userCache,
- recursive: false,
- maxDepth: 1,
- excluding: path == "\(home)/Library/Caches" ? excludedRootPaths : Set<String>()
- )
- items.append(contentsOf: scanned)
- }
+ // Dynamically enumerate ~/Library/Caches/ so every subdirectory is visible
+ let cachePath = "\(home)/Library/Caches"
+ let scanned = scanDirectory(
+ path: cachePath,
+ category: .userCache,
+ recursive: false,
+ maxDepth: 1,
+ excluding: excludedRootPaths
+ )
+ items.append(contentsOf: scanned)
// Also scan for npm/pip/yarn caches
let devCaches = [
@@ -145,41 +121,6 @@ actor ScanEngine {
return CategoryResult(category: .userCache, items: uniqueItems, totalSize: totalSize)
}
- private func scanAIApps() -> CategoryResult {
- let targets = [
- CleanupTarget(
- name: "Ollama Logs",
- path: "\(home)/.ollama/logs"
- ),
- CleanupTarget(
- name: "Ollama Cache",
- path: "\(home)/Library/Caches/ollama"
- ),
- CleanupTarget(
- name: "Ollama Electron Cache",
- path: "\(home)/Library/Caches/com.electron.ollama"
- ),
- CleanupTarget(
- name: "Ollama WebKit Data",
- path: "\(home)/Library/WebKit/com.electron.ollama"
- ),
- CleanupTarget(
- name: "Ollama Saved State",
- path: "\(home)/Library/Saved Application State/com.electron.ollama.savedState"
- ),
- CleanupTarget(
- name: "LM Studio Server Logs",
- path: "\(home)/.lmstudio/server-logs"
- ),
- ]
-
- let items = deduplicatedItems(targets.compactMap { target in
- makeCleanupItem(name: target.name, path: target.path, category: .aiApps)
- })
- let totalSize = items.reduce(0) { $0 + $1.size }
- return CategoryResult(category: .aiApps, items: items.sorted { $0.size > $1.size }, totalSize: totalSize)
- }
-
private func scanMailAttachments() -> CategoryResult {
var items: [CleanableItem] = []
@@ -327,15 +268,44 @@ actor ScanEngine {
private func scanBrewCache() -> CategoryResult {
var items: [CleanableItem] = []
- // Homebrew cache locations (Apple Silicon + Intel)
- let brewCachePaths = [
+ // Default Homebrew download cache
+ var brewCachePaths = [
"\(home)/Library/Caches/Homebrew",
- "/opt/homebrew/Caskroom/.metadata",
- "/usr/local/Caskroom/.metadata",
- "/opt/homebrew/Cellar/.metadata",
- "/usr/local/Cellar/.metadata",
]
+ // Detect custom HOMEBREW_CACHE via `brew --cache`
+ let brewBinPaths = ["/opt/homebrew/bin/brew", "/usr/local/bin/brew"]
+ var detectedCustomCache = false
+ for brewBin in brewBinPaths {
+ guard fileManager.fileExists(atPath: brewBin) else { continue }
+ let task = Process()
+ task.executableURL = URL(fileURLWithPath: brewBin)
+ task.arguments = ["--cache"]
+ let pipe = Pipe()
+ task.standardOutput = pipe
+ task.standardError = Pipe()
+ do {
+ try task.run()
+ task.waitUntilExit()
+ let data = pipe.fileHandleForReading.readDataToEndOfFile()
+ if let output = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines),
+ !output.isEmpty {
+ let normalized = normalizePath(output)
+ if !brewCachePaths.map(normalizePath).contains(normalized) {
+ brewCachePaths.append(output)
+ }
+ detectedCustomCache = true
+ }
+ } catch {
+ Logger.shared.log("Failed to run \(brewBin) --cache: \(error.localizedDescription)", level: .warning)
+ }
+ break // Only need the first available brew binary
+ }
+
+ if !detectedCustomCache {
+ Logger.shared.log("Homebrew not found at standard paths; scanning default cache location only", level: .info)
+ }
+
for path in brewCachePaths {
if fileManager.fileExists(atPath: path) {
let size = directorySize(path: path)
@@ -408,7 +378,7 @@ actor ScanEngine {
}
}
} catch {
- // Permission denied or other error - skip silently
+ Logger.shared.log("Cannot enumerate \(path): \(error.localizedDescription)", level: .warning)
}
return items
@@ -546,17 +516,44 @@ actor ScanEngine {
}
}
} catch {
- // tmutil may require admin privileges
+ Logger.shared.log("tmutil listlocalsnapshots failed: \(error.localizedDescription)", level: .info)
}
return snapshots
}
- /// Get size of a specific local snapshot
+ /// Get size of a specific local snapshot via APFS snapshot listing
private func getSnapshotSize(name: String) -> Int64 {
- // tmutil doesn't directly report individual snapshot sizes easily
- // Use a reasonable estimate based on total snapshot usage
- // For accurate per-snapshot sizes we'd need root access
+ let task = Process()
+ task.executableURL = URL(fileURLWithPath: "/usr/sbin/diskutil")
+ task.arguments = ["apfs", "listSnapshots", "/", "-plist"]
+ let pipe = Pipe()
+ task.standardOutput = pipe
+ task.standardError = Pipe()
+
+ do {
+ try task.run()
+ task.waitUntilExit()
+ let data = pipe.fileHandleForReading.readDataToEndOfFile()
+ guard let plist = try? PropertyListSerialization.propertyList(from: data, format: nil) as? [String: Any],
+ let snapshots = plist["Snapshots"] as? [[String: Any]] else {
+ Logger.shared.log("Could not parse APFS snapshot plist for \(name)", level: .info)
+ return 0
+ }
+
+ for snapshot in snapshots {
+ if let snapshotName = snapshot["SnapshotName"] as? String,
+ snapshotName == name,
+ let dataSize = snapshot["DataSize"] as? Int64 {
+ return dataSize
+ }
+ }
+
+ Logger.shared.log("Snapshot \(name) not found in APFS listing", level: .info)
+ } catch {
+ Logger.shared.log("diskutil apfs listSnapshots failed: \(error.localizedDescription)", level: .warning)
+ }
+
return 0
}
@@ -607,7 +604,7 @@ actor ScanEngine {
}
}
} catch {
- // Silently fail
+ Logger.shared.log("Purgeable space detection failed: \(error.localizedDescription)", level: .warning)
}
return 0
diff --git a/PureMac/ViewModels/AppViewModel.swift b/PureMac/ViewModels/AppState.swift
similarity index 83%
rename from PureMac/ViewModels/AppViewModel.swift
rename to PureMac/ViewModels/AppState.swift
index 8f32f25..85a431f 100644
--- a/PureMac/ViewModels/AppViewModel.swift
+++ b/PureMac/ViewModels/AppState.swift
@@ -1,9 +1,26 @@
import SwiftUI
import Combine
+import UserNotifications
+import AppKit
+
+struct AppInfoPlaceholder: Identifiable, Hashable {
+ let id = UUID()
+ var appName: String = ""
+ var bundleIdentifier: String = ""
+ var icon: NSImage = NSImage()
+}
+
+enum AppSection: Hashable {
+ case apps
+ case orphans
+ case cleaning(CleaningCategory)
+}
@MainActor
-class AppViewModel: ObservableObject {
- // MARK: - State
+final class AppState: ObservableObject {
+
+ // MARK: - Scan / Clean State
+
@Published var selectedCategory: CleaningCategory = .smartScan
@Published var scanState: ScanState = .idle
@Published var categoryResults: [CleaningCategory: CategoryResult] = [:]
@@ -19,6 +36,17 @@ class AppViewModel: ObservableObject {
@Published var hasFullDiskAccess: Bool = true
@Published var fdaBannerDismissed: Bool = false
+ // MARK: - App Uninstaller State
+
+ @Published var installedApps: [AppInfoPlaceholder] = []
+ @Published var selectedApp: AppInfoPlaceholder?
+ @Published var discoveredFiles: [URL] = []
+ @Published var selectedFiles: Set<URL> = []
+ @Published var orphanedFiles: [URL] = []
+ @Published var isSearchingOrphans: Bool = false
+
+ // MARK: - Services
+
var scheduler = SchedulerService()
private let scanEngine = ScanEngine()
private let cleaningEngine = CleaningEngine()
@@ -37,6 +65,21 @@ class AppViewModel: ObservableObject {
CleaningCategory.scannable.compactMap { categoryResults[$0] }.filter { $0.totalSize > 0 }
}
+ var totalSelectedSize: Int64 {
+ allResults.flatMap { $0.items }.filter { isItemSelected($0) }.reduce(0) { $0 + $1.size }
+ }
+
+ // MARK: - Init
+
+ init() {
+ loadDiskInfo()
+ checkFullDiskAccess()
+ scheduler.setTrigger { [weak self] in
+ await self?.runScheduledScan()
+ }
+ scheduler.start()
+ }
+
// MARK: - Selection
func isItemSelected(_ item: CleanableItem) -> Bool {
@@ -75,19 +118,39 @@ class AppViewModel: ObservableObject {
return result.items.filter { isItemSelected($0) }.count
}
- var totalSelectedSize: Int64 {
- allResults.flatMap { $0.items }.filter { isItemSelected($0) }.reduce(0) { $0 + $1.size }
+ // MARK: - Helper Methods
+
+ func categorySize(for category: CleaningCategory) -> String {
+ guard let result = categoryResults[category], result.totalSize > 0 else { return "" }
+ return result.formattedSize
}
- // MARK: - Init
+ func categoryBinding(for category: CleaningCategory) -> Binding<Bool> {
+ Binding<Bool>(
+ get: { [weak self] in
+ guard let self else { return false }
+ return self.selectedCountInCategory(category) > 0
+ },
+ set: { [weak self] newValue in
+ guard let self else { return }
+ if newValue {
+ self.selectAllInCategory(category)
+ } else {
+ self.deselectAllInCategory(category)
+ }
+ }
+ )
+ }
- init() {
- loadDiskInfo()
- checkFullDiskAccess()
- scheduler.setTrigger { [weak self] in
- await self?.runScheduledScan()
- }
- scheduler.start()
+ func itemBinding(for item: CleanableItem) -> Binding<Bool> {
+ Binding<Bool>(
+ get: { [weak self] in
+ self?.isItemSelected(item) ?? false
+ },
+ set: { [weak self] _ in
+ self?.toggleItem(item)
+ }
+ )
}
// MARK: - Full Disk Access
@@ -158,7 +221,6 @@ class AppViewModel: ObservableObject {
let result = await scanEngine.scanCategory(category)
categoryResults[category] = result
- // Recalculate total
totalJunkSize = categoryResults.values.reduce(0) { $0 + $1.totalSize }
scanProgress = 1.0
scanState = .completed
@@ -187,13 +249,11 @@ class AppViewModel: ObservableObject {
totalFreedSpace = result.freedSpace
lastCleanedDate = Date()
- // Clear results
categoryResults = [:]
totalJunkSize = 0
scanState = .cleaned
loadDiskInfo()
- // Reset state after delay
try? await Task.sleep(nanoseconds: 3_000_000_000)
scanState = .idle
totalFreedSpace = 0
@@ -294,5 +354,3 @@ class AppViewModel: ObservableObject {
UNUserNotificationCenter.current().add(request)
}
}
-
-import UserNotifications
diff --git a/PureMac/Views/Apps/AppFilesView.swift b/PureMac/Views/Apps/AppFilesView.swift
new file mode 100644
index 0000000..3d1177c
--- /dev/null
+++ b/PureMac/Views/Apps/AppFilesView.swift
@@ -0,0 +1,117 @@
+import SwiftUI
+
+struct AppFilesView: View {
+ @EnvironmentObject var appState: AppState
+ let app: AppInfoPlaceholder
+
+ var body: some View {
+ VStack(spacing: 0) {
+ // App header
+ HStack(spacing: 12) {
+ Image(nsImage: app.icon)
+ .resizable()
+ .frame(width: 48, height: 48)
+
+ VStack(alignment: .leading, spacing: 2) {
+ Text(app.appName)
+ .font(.title2)
+ Text(app.bundleIdentifier)
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+
+ Spacer()
+
+ if !appState.discoveredFiles.isEmpty {
+ let totalSize = appState.discoveredFiles.reduce(Int64(0)) { total, url in
+ total + (fileSize(url) ?? 0)
+ }
+ Text(ByteCountFormatter.string(fromByteCount: totalSize, countStyle: .file))
+ .font(.title3)
+ .monospacedDigit()
+ .foregroundStyle(.secondary)
+ }
+ }
+ .padding()
+
+ Divider()
+
+ if appState.discoveredFiles.isEmpty {
+ EmptyStateView("No Related Files Found", systemImage: "magnifyingglass", description: "No additional files were found for this application.")
+ } else {
+ List(appState.discoveredFiles, id: \.self) { fileURL in
+ Toggle(isOn: fileSelectionBinding(for: fileURL)) {
+ HStack {
+ Image(nsImage: NSWorkspace.shared.icon(forFile: fileURL.path))
+ .resizable()
+ .frame(width: 16, height: 16)
+
+ VStack(alignment: .leading, spacing: 2) {
+ Text(fileURL.lastPathComponent)
+ .lineLimit(1)
+ Text(fileURL.path)
+ .font(.caption)
+ .foregroundStyle(.tertiary)
+ .lineLimit(1)
+ .truncationMode(.middle)
+ }
+
+ Spacer()
+
+ if let size = fileSize(fileURL) {
+ Text(ByteCountFormatter.string(fromByteCount: size, countStyle: .file))
+ .monospacedDigit()
+ .foregroundStyle(.secondary)
+ }
+ }
+ }
+ .toggleStyle(.checkbox)
+ .contextMenu {
+ Button("Reveal in Finder") {
+ NSWorkspace.shared.selectFile(fileURL.path, inFileViewerRootedAtPath: "")
+ }
+ }
+ }
+ }
+ }
+ .toolbar {
+ ToolbarItemGroup {
+ if !appState.discoveredFiles.isEmpty {
+ Button("Select All") {
+ appState.selectedFiles = Set(appState.discoveredFiles)
+ }
+ Button("Deselect All") {
+ appState.selectedFiles.removeAll()
+ }
+
+ if !appState.selectedFiles.isEmpty {
+ Button("Remove Selected", role: .destructive) {
+ // Will be connected to cleaning engine
+ }
+ .buttonStyle(.borderedProminent)
+ .tint(.red)
+ }
+ }
+ }
+ }
+ }
+
+ private func fileSelectionBinding(for url: URL) -> Binding<Bool> {
+ Binding(
+ get: { appState.selectedFiles.contains(url) },
+ set: { selected in
+ if selected {
+ appState.selectedFiles.insert(url)
+ } else {
+ appState.selectedFiles.remove(url)
+ }
+ }
+ )
+ }
+
+ private func fileSize(_ url: URL) -> Int64? {
+ guard let attrs = try? FileManager.default.attributesOfItem(atPath: url.path),
+ let size = attrs[.size] as? Int64 else { return nil }
+ return size
+ }
+}
diff --git a/PureMac/Views/Apps/AppListView.swift b/PureMac/Views/Apps/AppListView.swift
new file mode 100644
index 0000000..1263c1b
--- /dev/null
+++ b/PureMac/Views/Apps/AppListView.swift
@@ -0,0 +1,53 @@
+import SwiftUI
+
+struct AppListView: View {
+ @EnvironmentObject var appState: AppState
+ @State private var searchText = ""
+ @State private var selection: AppInfoPlaceholder.ID?
+
+ private var filteredApps: [AppInfoPlaceholder] {
+ if searchText.isEmpty {
+ return appState.installedApps
+ }
+ let query = searchText.lowercased()
+ return appState.installedApps.filter {
+ $0.appName.lowercased().contains(query) ||
+ $0.bundleIdentifier.lowercased().contains(query)
+ }
+ }
+
+ var body: some View {
+ Group {
+ if appState.installedApps.isEmpty {
+ EmptyStateView("No Apps Loaded", systemImage: "square.grid.2x2", description: "App scanning is being set up. This feature will discover all installed applications and their related files.")
+ } else {
+ Table(filteredApps, selection: $selection) {
+ TableColumn("Application") { app in
+ HStack(spacing: 8) {
+ Image(nsImage: app.icon)
+ .resizable()
+ .frame(width: 20, height: 20)
+ Text(app.appName)
+ }
+ }
+ .width(min: 200)
+
+ TableColumn("Bundle Identifier") { app in
+ Text(app.bundleIdentifier)
+ .foregroundStyle(.secondary)
+ .font(.caption)
+ }
+ .width(min: 180)
+ }
+ .onChange(of: selection) { newValue in
+ if let id = newValue,
+ let app = appState.installedApps.first(where: { $0.id == id }) {
+ appState.selectedApp = app
+ }
+ }
+ }
+ }
+ .searchable(text: $searchText, prompt: "Search apps")
+ .navigationTitle("Installed Apps (\(appState.installedApps.count))")
+ }
+}
diff --git a/PureMac/Views/CategoryDetailView.swift b/PureMac/Views/CategoryDetailView.swift
index 92bf7dc..e4dbfd5 100644
--- a/PureMac/Views/CategoryDetailView.swift
+++ b/PureMac/Views/CategoryDetailView.swift
@@ -1,80 +1,69 @@
import SwiftUI
-
struct CategoryDetailView: View {
- @EnvironmentObject var vm: AppViewModel
+ @EnvironmentObject var appState: AppState
let category: CleaningCategory
@State private var sortDescending: Bool = true
- var result: CategoryResult? {
- vm.categoryResults[category]
+ private var result: CategoryResult? {
+ appState.categoryResults[category]
}
var body: some View {
- VStack(spacing: 0) {
- // Category header
- categoryHeader
- .padding(.horizontal, 32)
- .padding(.top, 16)
- .padding(.bottom, 16)
-
+ Group {
if let result = result {
if result.items.isEmpty {
- emptyState
+ EmptyStateView("All Clean", systemImage: "checkmark.circle", description: "No junk files found in this category.")
} else {
- // File list
fileList(result)
}
} else {
- // Not scanned yet
- notScannedState
+ EmptyStateView("Not Scanned", systemImage: category.icon, description: "Run a scan to analyze this category.")
}
-
- Spacer()
-
- // Action bar
- categoryActionBar
- .padding(.horizontal, 32)
- .padding(.bottom, 32)
}
- }
-
- // MARK: - Header
-
- private var categoryHeader: some View {
- HStack(spacing: 16) {
- ZStack {
- RoundedRectangle(cornerRadius: 12)
- .fill(category.color.opacity(0.15))
- .frame(width: 48, height: 48)
-
- Image(systemName: category.icon)
- .font(.system(size: 22))
- .foregroundColor(category.color)
- }
-
- VStack(alignment: .leading, spacing: 4) {
- Text(LocalizedStringKey(category.rawValue))
- .font(.pmHeadline)
- .foregroundColor(.pmTextPrimary)
+ .navigationTitle(category.rawValue)
+ .toolbar {
+ ToolbarItemGroup {
+ if let result = result, !result.items.isEmpty {
+ Button("Select All") {
+ appState.selectAllInCategory(category)
+ }
- Text(LocalizedStringKey(category.description))
- .font(.pmCaption)
- .foregroundColor(.pmTextSecondary)
- }
+ Button("Deselect All") {
+ appState.deselectAllInCategory(category)
+ }
- Spacer()
+ Button(action: { sortDescending.toggle() }) {
+ Label(
+ sortDescending ? "Largest First" : "Smallest First",
+ systemImage: "arrow.up.arrow.down"
+ )
+ }
+ .help(sortDescending ? "Sorted: Largest First" : "Sorted: Smallest First")
+ }
- if let result = result {
- VStack(alignment: .trailing, spacing: 4) {
- Text(result.formattedSize)
- .font(.pmMediumNumber)
- .foregroundColor(category.color)
+ if result == nil || !appState.scanState.isActive {
+ Button {
+ appState.scanSingleCategory(category)
+ } label: {
+ Label("Scan", systemImage: "magnifyingglass")
+ }
+ }
- Text("\(result.itemCount) items")
- .font(.pmCaption)
- .foregroundColor(.pmTextMuted)
+ if let _ = result, !appState.scanState.isActive {
+ let selectedSize = appState.selectedSizeInCategory(category)
+ let selectedCount = appState.selectedCountInCategory(category)
+ if selectedSize > 0 {
+ Button {
+ appState.cleanCategory(category)
+ } label: {
+ Label(
+ "Clean \(selectedCount) items (\(ByteCountFormatter.string(fromByteCount: selectedSize, countStyle: .file)))",
+ systemImage: "trash"
+ )
+ }
+ }
}
}
}
@@ -83,269 +72,92 @@ struct CategoryDetailView: View {
// MARK: - File List
private func fileList(_ result: CategoryResult) -> some View {
- VStack(spacing: 0) {
- // Select all / Deselect all bar
- HStack(spacing: 16) {
- let selectedCount = vm.selectedCountInCategory(category)
+ List {
+ Section {
+ ForEach(sortedItems(result.items)) { item in
+ FileRowView(item: item)
+ }
+ } header: {
+ let selectedCount = appState.selectedCountInCategory(category)
let totalCount = result.itemCount
-
Text("\(selectedCount) of \(totalCount) selected")
- .font(.system(size: 11, weight: .medium, design: .rounded))
- .foregroundColor(.pmTextMuted)
-
- Spacer()
-
- Button("Select All") {
- vm.selectAllInCategory(category)
- }
- .font(.system(size: 11, weight: .medium))
- .foregroundColor(.pmAccentLight)
- .buttonStyle(.plain)
-
- Text("|")
- .foregroundColor(.pmSeparator)
- .font(.system(size: 11))
-
- Button("Deselect All") {
- vm.deselectAllInCategory(category)
- }
- .font(.system(size: 11, weight: .medium))
- .foregroundColor(.pmAccentLight)
- .buttonStyle(.plain)
-
- Button(action: { sortDescending.toggle() }) {
- Image(systemName: "arrow.up.arrow.down")
- .font(.system(size: 14))
- .foregroundColor(.pmAccentLight)
- }
- .buttonStyle(.plain)
- .help(sortDescending ? "Sorted: Largest First" : "Sorted: Smallest First")
- }
- .padding(.horizontal, 48)
- .padding(.vertical, 8)
-
- Divider()
- .background(Color.pmSeparator)
- .padding(.horizontal, 32)
-
- ScrollView {
- LazyVStack(spacing: 4) {
- ForEach(sortedItems(result.items)) { item in
- FileRow(item: item, color: category.color)
- }
- }
- .padding(.horizontal, 32)
- .padding(.vertical, 8)
}
}
}
- // MARK: - Empty / Not Scanned
-
- private var emptyState: some View {
- VStack(spacing: 16) {
- Spacer()
- Image(systemName: "checkmark.circle.fill")
- .font(.system(size: 48))
- .foregroundColor(.pmSuccess)
-
- Text("All Clean!")
- .font(.pmHeadline)
- .foregroundColor(.pmTextPrimary)
-
- Text("No junk files found in this category.")
- .font(.pmBody)
- .foregroundColor(.pmTextSecondary)
- Spacer()
- }
- }
-
- private var notScannedState: some View {
- VStack(spacing: 16) {
- Spacer()
- ZStack {
- Circle()
- .fill(category.color.opacity(0.1))
- .frame(width: 120, height: 120)
-
- Image(systemName: category.icon)
- .font(.system(size: 40))
- .foregroundColor(category.color.opacity(0.5))
- }
-
- Text("Not scanned yet")
- .font(.pmSubheadline)
- .foregroundColor(.pmTextSecondary)
-
- Text("Click Scan to analyze this category")
- .font(.pmCaption)
- .foregroundColor(.pmTextMuted)
- Spacer()
- }
- }
-
- // MARK: - Sort
-
private func sortedItems(_ items: [CleanableItem]) -> [CleanableItem] {
items.sorted { sortDescending ? $0.size > $1.size : $0.size < $1.size }
}
-
- // MARK: - Action Bar
-
- private var categoryActionBar: some View {
- HStack(spacing: 16) {
- if result == nil || vm.scanState == .idle || vm.scanState == .completed {
- GradientActionButton(
- title: "Scan",
- icon: "magnifyingglass",
- gradient: LinearGradient(
- colors: [category.color, category.color.opacity(0.7)],
- startPoint: .leading,
- endPoint: .trailing
- )
- ) {
- withAnimation(.pmSpring) {
- vm.scanSingleCategory(category)
- }
- }
- }
-
- if let _ = result, !vm.scanState.isActive {
- let selectedSize = vm.selectedSizeInCategory(category)
- let selectedCount = vm.selectedCountInCategory(category)
- if selectedSize > 0 {
- GradientActionButton(
- title: "Clean \(selectedCount) items (\(ByteCountFormatter.string(fromByteCount: selectedSize, countStyle: .file)))",
- icon: "trash.fill",
- gradient: AppGradients.accent
- ) {
- withAnimation(.pmSpring) {
- vm.cleanCategory(category)
- }
- }
- }
- }
- }
- }
}
-// MARK: - File Row
+// MARK: - File Row View
-struct FileRow: View {
- @EnvironmentObject var vm: AppViewModel
+private struct FileRowView: View {
+ @EnvironmentObject var appState: AppState
let item: CleanableItem
- let color: Color
-
- @State private var isHovering = false
- var isSelected: Bool {
- vm.isItemSelected(item)
+ private var isSelected: Bool {
+ appState.isItemSelected(item)
}
var body: some View {
- HStack(spacing: 10) {
- // Checkbox
- Button(action: { vm.toggleItem(item) }) {
- ZStack {
- RoundedRectangle(cornerRadius: 4)
- .stroke(isSelected ? color : Color.pmTextMuted, lineWidth: 1.5)
- .frame(width: 18, height: 18)
-
- if isSelected {
- RoundedRectangle(cornerRadius: 4)
- .fill(color)
- .frame(width: 18, height: 18)
-
- Image(systemName: "checkmark")
- .font(.system(size: 10, weight: .bold))
- .foregroundColor(.white)
- }
+ Toggle(isOn: Binding(
+ get: { isSelected },
+ set: { _ in appState.toggleItem(item) }
+ )) {
+ HStack {
+ Image(systemName: fileIcon)
+ .foregroundStyle(.secondary)
+ .frame(width: 20)
+
+ VStack(alignment: .leading, spacing: 2) {
+ Text(item.name)
+ .lineLimit(1)
+ .truncationMode(.middle)
+
+ Text(item.path)
+ .font(.caption)
+ .foregroundStyle(.tertiary)
+ .lineLimit(1)
+ .truncationMode(.middle)
}
- }
- .buttonStyle(.plain)
-
- // File icon
- Image(systemName: fileIcon)
- .font(.system(size: 14))
- .foregroundColor(isSelected ? color.opacity(0.7) : .pmTextMuted)
- .frame(width: 20)
-
- // File info
- VStack(alignment: .leading, spacing: 2) {
- Text(item.name)
- .font(.pmBody)
- .foregroundColor(isSelected ? .pmTextPrimary : .pmTextMuted)
- .lineLimit(1)
- .truncationMode(.middle)
-
- Text(item.path)
- .font(.system(size: 10))
- .foregroundColor(.pmTextMuted)
- .lineLimit(1)
- .truncationMode(.middle)
- }
- Spacer()
-
- // Date
- if let date = item.lastModified {
- Text(formatDate(date))
- .font(.system(size: 10))
- .foregroundColor(.pmTextMuted)
- }
-
- // Size
- Text(item.formattedSize)
- .font(.system(size: 12, weight: .semibold, design: .rounded))
- .foregroundColor(isSelected ? .pmTextPrimary : .pmTextMuted)
- .frame(width: 70, alignment: .trailing)
+ Spacer()
- // Reveal button on hover
- if isHovering {
- Button(action: revealInFinder) {
- Image(systemName: "arrow.right.circle")
- .font(.system(size: 12))
- .foregroundColor(.pmTextSecondary)
+ if let date = item.lastModified {
+ Text(date, style: .date)
+ .font(.caption)
+ .foregroundStyle(.secondary)
}
- .buttonStyle(.plain)
+
+ Text(item.formattedSize)
+ .font(.callout)
+ .fontWeight(.medium)
+ .frame(width: 80, alignment: .trailing)
}
}
- .padding(.horizontal, 16)
- .padding(.vertical, 8)
- .background(
- RoundedRectangle(cornerRadius: 8)
- .fill(isHovering ? Color.pmCard : Color.clear)
- )
- .onHover { h in
- withAnimation(.pmSmooth) { isHovering = h }
+ .toggleStyle(.checkbox)
+ .contextMenu {
+ Button("Reveal in Finder") {
+ NSWorkspace.shared.selectFile(item.path, inFileViewerRootedAtPath: "")
+ }
}
}
private var fileIcon: String {
let ext = (item.name as NSString).pathExtension.lowercased()
switch ext {
- case "log", "txt": return "doc.text.fill"
+ case "log", "txt": return "doc.text"
case "zip", "gz", "tar": return "doc.zipper"
- case "dmg", "iso": return "opticaldisc.fill"
- case "app": return "app.fill"
- case "pkg": return "shippingbox.fill"
+ case "dmg", "iso": return "opticaldisc"
+ case "app": return "app"
+ case "pkg": return "shippingbox"
default:
var isDir: ObjCBool = false
if FileManager.default.fileExists(atPath: item.path, isDirectory: &isDir), isDir.boolValue {
- return "folder.fill"
+ return "folder"
}
- return "doc.fill"
+ return "doc"
}
}
-
- private func formatDate(_ date: Date) -> String {
- let formatter = DateFormatter()
- formatter.dateStyle = .short
- formatter.timeStyle = .none
- return formatter.string(from: date)
- }
-
- private func revealInFinder() {
- NSWorkspace.shared.selectFile(item.path, inFileViewerRootedAtPath: "")
- }
}
diff --git a/PureMac/Views/Components/EmptyStateView.swift b/PureMac/Views/Components/EmptyStateView.swift
new file mode 100644
index 0000000..a21241a
--- /dev/null
+++ b/PureMac/Views/Components/EmptyStateView.swift
@@ -0,0 +1,40 @@
+import SwiftUI
+
+struct EmptyStateView: View {
+ let title: String
+ let systemImage: String
+ let description: String
+ var action: (() -> Void)?
+ var actionLabel: String?
+
+ init(_ title: String, systemImage: String, description: String, action: (() -> Void)? = nil, actionLabel: String? = nil) {
+ self.title = title
+ self.systemImage = systemImage
+ self.description = description
+ self.action = action
+ self.actionLabel = actionLabel
+ }
+
+ var body: some View {
+ VStack(spacing: 12) {
+ Spacer()
+ Image(systemName: systemImage)
+ .font(.system(size: 40))
+ .foregroundStyle(.secondary)
+ Text(title)
+ .font(.title3.bold())
+ Text(description)
+ .font(.callout)
+ .foregroundStyle(.secondary)
+ .multilineTextAlignment(.center)
+ .frame(maxWidth: 300)
+ if let action, let label = actionLabel {
+ Button(label, action: action)
+ .buttonStyle(.borderedProminent)
+ .padding(.top, 4)
+ }
+ Spacer()
+ }
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ }
+}
diff --git a/PureMac/Views/ContentView.swift b/PureMac/Views/ContentView.swift
deleted file mode 100644
index e99f78f..0000000
--- a/PureMac/Views/ContentView.swift
+++ /dev/null
@@ -1,206 +0,0 @@
-import SwiftUI
-
-struct ContentView: View {
- @EnvironmentObject var vm: AppViewModel
-
- var body: some View {
- HStack(spacing: 0) {
- SidebarView()
- .frame(width: 220)
-
- Divider()
- .background(Color.pmSeparator)
-
- // Main content
- ZStack {
- Color.pmBackground
- .ignoresSafeArea()
-
- VStack(spacing: 0) {
- // Full Disk Access banner
- if !vm.hasFullDiskAccess && !vm.fdaBannerDismissed {
- FullDiskAccessBanner()
- .padding(.horizontal, 24)
- .padding(.top, 12)
- .transition(.move(edge: .top).combined(with: .opacity))
- }
-
- // Top bar with disk info
- TopBarView()
- .padding(.horizontal, 24)
- .padding(.top, 16)
- .padding(.bottom, 8)
-
- // Content area
- Group {
- switch vm.selectedCategory {
- case .smartScan:
- SmartScanView()
- default:
- CategoryDetailView(category: vm.selectedCategory)
- }
- }
- .frame(maxWidth: .infinity, maxHeight: .infinity)
- }
- }
- }
- .background(Color.pmBackground)
- .onAppear {
- NSWindow.allowsAutomaticWindowTabbing = false
- }
- .onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
- vm.checkFullDiskAccess()
- }
- }
-}
-
-// MARK: - Full Disk Access Banner
-
-struct FullDiskAccessBanner: View {
- @EnvironmentObject var vm: AppViewModel
-
- var body: some View {
- HStack(spacing: 12) {
- Image(systemName: "lock.shield.fill")
- .font(.system(size: 18))
- .foregroundColor(.pmWarning)
-
- VStack(alignment: .leading, spacing: 2) {
- Text("Full Disk Access Required")
- .font(.system(size: 13, weight: .semibold, design: .rounded))
- .foregroundColor(.pmTextPrimary)
-
- Text("PureMac needs Full Disk Access to scan Trash, Mail, Desktop, Documents, and Homebrew cache.")
- .font(.system(size: 11))
- .foregroundColor(.pmTextSecondary)
- .lineLimit(2)
- }
-
- Spacer()
-
- Button(action: { vm.openFullDiskAccessSettings() }) {
- Text("Open Settings")
- .font(.system(size: 12, weight: .semibold, design: .rounded))
- .foregroundColor(.white)
- .padding(.horizontal, 14)
- .padding(.vertical, 6)
- .background(AppGradients.accent)
- .cornerRadius(8)
- }
- .buttonStyle(.plain)
-
- Button(action: {
- withAnimation(.pmSmooth) {
- vm.fdaBannerDismissed = true
- }
- }) {
- Image(systemName: "xmark")
- .font(.system(size: 10, weight: .bold))
- .foregroundColor(.pmTextMuted)
- .frame(width: 20, height: 20)
- }
- .buttonStyle(.plain)
- }
- .padding(.horizontal, 16)
- .padding(.vertical, 12)
- .background(
- RoundedRectangle(cornerRadius: 12)
- .fill(Color.pmWarning.opacity(0.08))
- .overlay(
- RoundedRectangle(cornerRadius: 12)
- .stroke(Color.pmWarning.opacity(0.2), lineWidth: 1)
- )
- )
- }
-}
-
-// MARK: - Top Bar
-
-struct TopBarView: View {
- @EnvironmentObject var vm: AppViewModel
-
- var body: some View {
- HStack(spacing: 16) {
- // Disk usage indicator
- HStack(spacing: 12) {
- Image(systemName: "internaldrive.fill")
- .font(.system(size: 16))
- .foregroundColor(.pmAccentLight)
-
- VStack(alignment: .leading, spacing: 4) {
- Text("Macintosh HD")
- .font(.pmCaption)
- .foregroundColor(.pmTextPrimary)
-
- GeometryReader { geo in
- ZStack(alignment: .leading) {
- RoundedRectangle(cornerRadius: 3)
- .fill(Color.pmCard)
- .frame(height: 6)
-
- RoundedRectangle(cornerRadius: 3)
- .fill(
- vm.diskInfo.usedPercentage > 0.9 ? AppGradients.danger :
- vm.diskInfo.usedPercentage > 0.7 ? AppGradients.accent :
- AppGradients.success
- )
- .frame(width: geo.size.width * vm.diskInfo.usedPercentage, height: 6)
- }
- }
- .frame(height: 6)
- }
- .frame(width: 160)
-
- Text("\(vm.diskInfo.formattedFree) free")
- .font(.pmCaption)
- .foregroundColor(.pmTextSecondary)
- }
- .padding(.horizontal, 16)
- .padding(.vertical, 10)
- .background(Color.pmCard.opacity(0.6))
- .cornerRadius(10)
-
- Spacer()
-
- // Schedule indicator
- if vm.scheduler.config.isEnabled {
- HStack(spacing: 6) {
- Circle()
- .fill(Color.pmSuccess)
- .frame(width: 6, height: 6)
- Text("Auto-clean: ") + Text(LocalizedStringKey(vm.scheduler.config.interval.rawValue))
- .font(.pmCaption)
- .foregroundColor(.pmTextSecondary)
- }
- .padding(.horizontal, 12)
- .padding(.vertical, 6)
- .background(Color.pmCard.opacity(0.6))
- .cornerRadius(8)
- }
-
- // Settings button
- if #available(macOS 14.0, *) {
- SettingsLink {
- iconGearView
- }
- .buttonStyle(.plain)
- } else {
- Button(action: {
- NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)
- }) {
- iconGearView
- }
- .buttonStyle(.plain)
- }
- }
- }
-
- var iconGearView: some View {
- Image(systemName: "gearshape.fill")
- .font(.system(size: 14))
- .foregroundColor(.pmTextSecondary)
- .frame(width: 32, height: 32)
- .background(Color.pmCard.opacity(0.6))
- .cornerRadius(8)
- }
-}
diff --git a/PureMac/Views/MainWindow.swift b/PureMac/Views/MainWindow.swift
new file mode 100644
index 0000000..21e86ad
--- /dev/null
+++ b/PureMac/Views/MainWindow.swift
@@ -0,0 +1,73 @@
+import SwiftUI
+
+struct MainWindow: View {
+ @EnvironmentObject var appState: AppState
+ @State private var selectedSection: AppSection? = .cleaning(.smartScan)
+ @State private var columnVisibility: NavigationSplitViewVisibility = .all
+
+ var body: some View {
+ NavigationSplitView(columnVisibility: $columnVisibility) {
+ sidebar
+ } detail: {
+ detailView
+ }
+ .frame(minWidth: 800, minHeight: 500)
+ .onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
+ appState.checkFullDiskAccess()
+ }
+ }
+
+ private var sidebar: some View {
+ List(selection: $selectedSection) {
+ Section("Applications") {
+ Label("Installed Apps", systemImage: "square.grid.2x2")
+ .tag(AppSection.apps)
+ Label("Orphaned Files", systemImage: "doc.questionmark")
+ .tag(AppSection.orphans)
+ }
+
+ Section("Cleaning") {
+ ForEach(CleaningCategory.scannable) { category in
+ HStack {
+ Label(category.rawValue, systemImage: category.icon)
+ Spacer()
+ if let size = appState.categoryResults[category]?.totalSize, size > 0 {
+ Text(ByteCountFormatter.string(fromByteCount: size, countStyle: .file))
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+ }
+ .tag(AppSection.cleaning(category))
+ }
+ }
+ }
+ .listStyle(.sidebar)
+ .navigationTitle("PureMac")
+ }
+
+ @ViewBuilder
+ private var detailView: some View {
+ switch selectedSection {
+ case .apps:
+ Text("Installed Apps")
+ .font(.title2)
+ .foregroundStyle(.secondary)
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ case .orphans:
+ Text("Orphaned Files")
+ .font(.title2)
+ .foregroundStyle(.secondary)
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ case .cleaning(let category):
+ if category == .smartScan {
+ SmartScanView()
+ } else {
+ CategoryDetailView(category: category)
+ }
+ case nil:
+ Text("Select a category")
+ .foregroundStyle(.secondary)
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ }
+ }
+}
diff --git a/PureMac/Views/Orphans/OrphanListView.swift b/PureMac/Views/Orphans/OrphanListView.swift
new file mode 100644
index 0000000..b0a6040
--- /dev/null
+++ b/PureMac/Views/Orphans/OrphanListView.swift
@@ -0,0 +1,90 @@
+import SwiftUI
+
+struct OrphanListView: View {
+ @EnvironmentObject var appState: AppState
+ @State private var selectedOrphans: Set<URL> = []
+
+ var body: some View {
+ Group {
+ if appState.isSearchingOrphans {
+ VStack(spacing: 16) {
+ ProgressView("Scanning for orphaned files...")
+ .progressViewStyle(.linear)
+ .frame(maxWidth: 300)
+ }
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ } else if appState.orphanedFiles.isEmpty {
+ EmptyStateView("No Orphaned Files", systemImage: "checkmark.circle", description: "No leftover files from uninstalled apps were found.", action: { /* Will be connected to OrphanFinder */ }, actionLabel: "Scan for Orphans")
+ } else {
+ List(appState.orphanedFiles, id: \.self) { fileURL in
+ Toggle(isOn: orphanBinding(for: fileURL)) {
+ HStack {
+ Image(nsImage: NSWorkspace.shared.icon(forFile: fileURL.path))
+ .resizable()
+ .frame(width: 16, height: 16)
+
+ VStack(alignment: .leading, spacing: 2) {
+ Text(fileURL.lastPathComponent)
+ .lineLimit(1)
+ Text(fileURL.path)
+ .font(.caption)
+ .foregroundStyle(.tertiary)
+ .lineLimit(1)
+ .truncationMode(.middle)
+ }
+
+ Spacer()
+
+ if let size = fileSize(fileURL) {
+ Text(ByteCountFormatter.string(fromByteCount: size, countStyle: .file))
+ .monospacedDigit()
+ .foregroundStyle(.secondary)
+ }
+ }
+ }
+ .toggleStyle(.checkbox)
+ .contextMenu {
+ Button("Reveal in Finder") {
+ NSWorkspace.shared.selectFile(fileURL.path, inFileViewerRootedAtPath: "")
+ }
+ }
+ }
+ }
+ }
+ .navigationTitle("Orphaned Files (\(appState.orphanedFiles.count))")
+ .toolbar {
+ ToolbarItemGroup {
+ Button("Scan for Orphans") {
+ // Will be connected to OrphanFinder
+ }
+
+ if !selectedOrphans.isEmpty {
+ Button("Remove Selected", role: .destructive) {
+ // Will be connected to cleaning engine
+ }
+ .buttonStyle(.borderedProminent)
+ .tint(.red)
+ }
+ }
+ }
+ }
+
+ private func orphanBinding(for url: URL) -> Binding<Bool> {
+ Binding(
+ get: { selectedOrphans.contains(url) },
+ set: { selected in
+ if selected {
+ selectedOrphans.insert(url)
+ } else {
+ selectedOrphans.remove(url)
+ }
+ }
+ )
+ }
+
+ private func fileSize(_ url: URL) -> Int64? {
+ guard let attrs = try? FileManager.default.attributesOfItem(atPath: url.path),
+ let size = attrs[.size] as? Int64 else { return nil }
+ return size
+ }
+}
diff --git a/PureMac/Views/Settings/SettingsView.swift b/PureMac/Views/Settings/SettingsView.swift
new file mode 100644
index 0000000..80996e0
--- /dev/null
+++ b/PureMac/Views/Settings/SettingsView.swift
@@ -0,0 +1,181 @@
+import SwiftUI
+import ServiceManagement
+
+struct SettingsView: View {
+ var body: some View {
+ TabView {
+ GeneralSettingsView()
+ .tabItem { Label("General", systemImage: "gear") }
+ CleaningSettingsView()
+ .tabItem { Label("Cleaning", systemImage: "trash") }
+ ScheduleSettingsView()
+ .tabItem { Label("Schedule", systemImage: "clock") }
+ AboutSettingsView()
+ .tabItem { Label("About", systemImage: "info.circle") }
+ }
+ .frame(width: 480, height: 360)
+ }
+}
+
+// MARK: - General
+
+enum SearchSensitivity: String, CaseIterable, Identifiable, Codable {
+ case strict = "Strict"
+ case enhanced = "Enhanced"
+ case deep = "Deep"
+
+ var id: String { rawValue }
+
+ var description: String {
+ switch self {
+ case .strict: return "Exact bundle ID and name matches only. Safest option."
+ case .enhanced: return "Includes partial name matching and bundle ID components."
+ case .deep: return "Includes company name, entitlements, and team identifier matching."
+ }
+ }
+}
+
+struct GeneralSettingsView: View {
+ @AppStorage("settings.general.launchAtLogin") private var launchAtLogin = false
+ @AppStorage("settings.general.searchSensitivity") private var sensitivity: SearchSensitivity = .enhanced
+ @AppStorage("settings.general.confirmBeforeDelete") private var confirmBeforeDelete = true
+
+ var body: some View {
+ Form {
+ Section("Startup") {
+ Toggle("Launch PureMac at login", isOn: $launchAtLogin)
+ .onChange(of: launchAtLogin) { newValue in
+ toggleLaunchAtLogin(newValue)
+ }
+ }
+
+ Section("App Scanning") {
+ Picker("Search sensitivity", selection: $sensitivity) {
+ ForEach(SearchSensitivity.allCases) { level in
+ VStack(alignment: .leading) {
+ Text(level.rawValue)
+ Text(level.description)
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ }
+ .tag(level)
+ }
+ }
+ .pickerStyle(.radioGroup)
+ }
+
+ Section("Safety") {
+ Toggle("Confirm before deleting files", isOn: $confirmBeforeDelete)
+ }
+ }
+ .formStyle(.grouped)
+ }
+
+ private func toggleLaunchAtLogin(_ enabled: Bool) {
+ do {
+ if enabled {
+ try SMAppService.mainApp.register()
+ } else {
+ try SMAppService.mainApp.unregister()
+ }
+ } catch {
+ Logger.shared.log("Failed to \(enabled ? "enable" : "disable") launch at login: \(error.localizedDescription)", level: .error)
+ // Revert the toggle if operation failed
+ launchAtLogin = !enabled
+ }
+ }
+}
+
+// MARK: - Cleaning
+
+struct CleaningSettingsView: View {
+ @AppStorage("settings.cleaning.skipHiddenFiles") private var skipHiddenFiles = true
+ @AppStorage("settings.cleaning.largeFileThreshold") private var largeFileThresholdMB: Int = 100
+ @AppStorage("settings.cleaning.oldFileMonths") private var oldFileMonths: Int = 12
+
+ var body: some View {
+ Form {
+ Section("File Discovery") {
+ Toggle("Skip hidden files during scan", isOn: $skipHiddenFiles)
+ }
+
+ Section("Large Files") {
+ Stepper("Minimum size: \(largeFileThresholdMB) MB", value: $largeFileThresholdMB, in: 10...1000, step: 10)
+ Stepper("Files older than: \(oldFileMonths) months", value: $oldFileMonths, in: 1...60)
+ }
+ }
+ .formStyle(.grouped)
+ }
+}
+
+// MARK: - Schedule
+
+struct ScheduleSettingsView: View {
+ @EnvironmentObject var appState: AppState
+
+ var body: some View {
+ Form {
+ Section("Automatic Scanning") {
+ Toggle("Enable scheduled scanning", isOn: $appState.scheduler.config.isEnabled)
+
+ if appState.scheduler.config.isEnabled {
+ Picker("Scan interval", selection: $appState.scheduler.config.interval) {
+ ForEach(ScheduleInterval.allCases) { interval in
+ Text(interval.rawValue).tag(interval)
+ }
+ }
+
+ Toggle("Auto-clean after scan", isOn: $appState.scheduler.config.autoClean)
+ Toggle("Auto-purge purgeable space", isOn: $appState.scheduler.config.autoPurge)
+ Toggle("Notify on completion", isOn: $appState.scheduler.config.notifyOnCompletion)
+
+ HStack {
+ Text("Last run")
+ Spacer()
+ Text(appState.scheduler.config.formattedLastRun)
+ .foregroundStyle(.secondary)
+ }
+ }
+ }
+ }
+ .formStyle(.grouped)
+ }
+}
+
+// MARK: - About
+
+struct AboutSettingsView: View {
+ var body: some View {
+ Form {
+ Section {
+ HStack {
+ if let appIcon = NSImage(named: "AppIcon") {
+ Image(nsImage: appIcon)
+ .resizable()
+ .frame(width: 64, height: 64)
+ }
+ VStack(alignment: .leading, spacing: 4) {
+ Text("PureMac")
+ .font(.title2.bold())
+ Text("Version \(Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "1.0")")
+ .foregroundStyle(.secondary)
+ Text("Free, open-source macOS app manager.")
+ .foregroundStyle(.secondary)
+ .font(.caption)
+ }
+ }
+ }
+
+ Section {
+ Link("GitHub Repository", destination: URL(string: "https://github.com/momenbasel/PureMac")!)
+ Link("Report an Issue", destination: URL(string: "https://github.com/momenbasel/PureMac/issues")!)
+ }
+
+ Section {
+ Text("MIT License")
+ .foregroundStyle(.secondary)
+ }
+ }
+ .formStyle(.grouped)
+ }
+}
diff --git a/PureMac/Views/SettingsView.swift b/PureMac/Views/SettingsView.swift
deleted file mode 100644
index 0c18bd7..0000000
--- a/PureMac/Views/SettingsView.swift
+++ /dev/null
@@ -1,234 +0,0 @@
-import SwiftUI
-
-struct SettingsView: View {
- @EnvironmentObject var vm: AppViewModel
-
- var body: some View {
- TabView {
- ScheduleSettingsTab()
- .environmentObject(vm)
- .tabItem {
- Label("Schedule", systemImage: "clock.fill")
- }
-
- GeneralSettingsTab()
- .tabItem {
- Label("General", systemImage: "gearshape.fill")
- }
-
- AboutTab()
- .tabItem {
- Label("About", systemImage: "info.circle.fill")
- }
- }
- .frame(width: 520, height: 440)
- }
-}
-
-// MARK: - Schedule Settings
-
-struct ScheduleSettingsTab: View {
- @EnvironmentObject var vm: AppViewModel
-
- var body: some View {
- VStack(alignment: .leading, spacing: 24) {
- // Enable toggle
- VStack(alignment: .leading, spacing: 8) {
- Toggle(isOn: Binding(
- get: { vm.scheduler.config.isEnabled },
- set: { vm.scheduler.toggleEnabled($0) }
- )) {
- VStack(alignment: .leading, spacing: 4) {
- Text("Automatic Cleaning")
- .font(.system(size: 14, weight: .semibold))
- Text("Automatically scan and clean your Mac on a schedule")
- .font(.system(size: 12))
- .foregroundColor(.secondary)
- }
- }
- .toggleStyle(.switch)
- }
-
- Divider()
-
- // Interval picker
- VStack(alignment: .leading, spacing: 8) {
- Text("Scan Interval")
- .font(.system(size: 13, weight: .semibold))
-
- Picker("", selection: Binding(
- get: { vm.scheduler.config.interval },
- set: { vm.scheduler.updateSchedule(interval: $0) }
- )) {
- ForEach(ScheduleInterval.allCases) { interval in
- Text(LocalizedStringKey(interval.rawValue)).tag(interval)
- }
- }
- .pickerStyle(.menu)
- .frame(width: 200)
- .disabled(!vm.scheduler.config.isEnabled)
- }
-
- Divider()
-
- // Auto-clean options
- VStack(alignment: .leading, spacing: 12) {
- Text("Automation")
- .font(.system(size: 13, weight: .semibold))
-
- Toggle("Auto-clean after scan", isOn: $vm.scheduler.config.autoClean)
- .toggleStyle(.switch)
- .disabled(!vm.scheduler.config.isEnabled)
-
- if vm.scheduler.config.autoClean {
- HStack {
- Text("Minimum junk size to trigger clean:")
- .font(.system(size: 12))
- .foregroundColor(.secondary)
-
- Picker("", selection: Binding(
- get: { vm.scheduler.config.minimumCleanSize },
- set: { vm.scheduler.config.minimumCleanSize = $0 }
- )) {
- Text("50 MB").tag(Int64(50 * 1024 * 1024))
- Text("100 MB").tag(Int64(100 * 1024 * 1024))
- Text("250 MB").tag(Int64(250 * 1024 * 1024))
- Text("500 MB").tag(Int64(500 * 1024 * 1024))
- Text("1 GB").tag(Int64(1024 * 1024 * 1024))
- }
- .pickerStyle(.menu)
- .frame(width: 120)
- }
- .padding(.leading, 20)
- }
-
- Toggle("Auto-purge purgeable space", isOn: $vm.scheduler.config.autoPurge)
- .toggleStyle(.switch)
- .disabled(!vm.scheduler.config.isEnabled)
-
- Toggle("Show notification on completion", isOn: $vm.scheduler.config.notifyOnCompletion)
- .toggleStyle(.switch)
- .disabled(!vm.scheduler.config.isEnabled)
- }
-
- Divider()
-
- // Status
- VStack(alignment: .leading, spacing: 8) {
- Text("Status")
- .font(.system(size: 13, weight: .semibold))
-
- HStack(spacing: 16) {
- VStack(alignment: .leading, spacing: 4) {
- Text("Last run")
- .font(.system(size: 11))
- .foregroundColor(.secondary)
- Text(vm.scheduler.config.formattedLastRun)
- .font(.system(size: 12, weight: .medium))
- }
-
- VStack(alignment: .leading, spacing: 4) {
- Text("Next run")
- .font(.system(size: 11))
- .foregroundColor(.secondary)
- Text(vm.scheduler.config.formattedNextRun)
- .font(.system(size: 12, weight: .medium))
- }
- }
- }
-
- Spacer()
- }
- .padding(24)
- }
-}
-
-// MARK: - General Settings
-
-struct GeneralSettingsTab: View {
- @AppStorage("PureMac.LaunchAtLogin") private var launchAtLogin = false
- @AppStorage("PureMac.ShowInDock") private var showInDock = true
- @AppStorage("PureMac.ShowMenuBarIcon") private var showMenuBarIcon = true
-
- var body: some View {
- VStack(alignment: .leading, spacing: 24) {
- VStack(alignment: .leading, spacing: 12) {
- Text("App Behavior")
- .font(.system(size: 13, weight: .semibold))
-
- Toggle("Launch at login", isOn: $launchAtLogin)
- .toggleStyle(.switch)
-
- Toggle("Show in Dock", isOn: $showInDock)
- .toggleStyle(.switch)
-
- Toggle("Show menu bar icon", isOn: $showMenuBarIcon)
- .toggleStyle(.switch)
- }
-
- Divider()
-
- VStack(alignment: .leading, spacing: 12) {
- Text("Safety")
- .font(.system(size: 13, weight: .semibold))
-
- Text("PureMac will never delete system-critical files. Only caches, logs, temporary files, and user-selected items are removed.")
- .font(.system(size: 12))
- .foregroundColor(.secondary)
- .fixedSize(horizontal: false, vertical: true)
- }
-
- Spacer()
- }
- .padding(24)
- }
-}
-
-// MARK: - About Tab
-
-struct AboutTab: View {
- var body: some View {
- VStack(spacing: 20) {
- Spacer()
-
- ZStack {
- Circle()
- .fill(
- LinearGradient(
- colors: [Color(hex: "6366f1"), Color(hex: "a855f7")],
- startPoint: .topLeading,
- endPoint: .bottomTrailing
- )
- )
- .frame(width: 80, height: 80)
-
- Image(systemName: "sparkles")
- .font(.system(size: 32, weight: .bold))
- .foregroundColor(.white)
- }
-
- Text("PureMac")
- .font(.system(size: 24, weight: .bold, design: .rounded))
-
- Text("Version \(AppConstants.appVersion)")
- .font(.system(size: 13))
- .foregroundColor(.secondary)
-
- Text("A free, open-source Mac cleaning utility.\nKeep your Mac fast, clean, and optimized.")
- .font(.system(size: 12))
- .foregroundColor(.secondary)
- .multilineTextAlignment(.center)
- .fixedSize(horizontal: false, vertical: true)
-
- Link("GitHub Repository", destination: URL(string: "https://github.com/momenbasel/PureMac")!)
- .font(.system(size: 12))
-
- Text("MIT License")
- .font(.system(size: 11))
- .foregroundColor(.secondary)
-
- Spacer()
- }
- .padding(24)
- }
-}
diff --git a/PureMac/Views/SidebarView.swift b/PureMac/Views/SidebarView.swift
deleted file mode 100644
index 3e79910..0000000
--- a/PureMac/Views/SidebarView.swift
+++ /dev/null
@@ -1,180 +0,0 @@
-import SwiftUI
-
-struct SidebarView: View {
- @EnvironmentObject var vm: AppViewModel
-
- var body: some View {
- VStack(spacing: 0) {
- // App logo / title
- VStack(spacing: 8) {
- HStack(spacing: 10) {
- ZStack {
- Circle()
- .fill(AppGradients.primary)
- .frame(width: 36, height: 36)
- Image(systemName: "sparkles")
- .font(.system(size: 16, weight: .bold))
- .foregroundColor(.white)
- }
-
- Text("PureMac")
- .font(.system(size: 20, weight: .bold, design: .rounded))
- .foregroundColor(.pmTextPrimary)
-
- Spacer()
- }
- .padding(.horizontal, 20)
- }
- .padding(.top, 48) // Account for title bar
- .padding(.bottom, 24)
-
- // Category list
- ScrollView(.vertical, showsIndicators: false) {
- VStack(spacing: 2) {
- // Smart Scan - always first
- SidebarItem(
- category: .smartScan,
- isSelected: vm.selectedCategory == .smartScan,
- resultSize: vm.totalJunkSize
- )
- .onTapGesture { vm.selectedCategory = .smartScan }
-
- Divider()
- .background(Color.pmSeparator)
- .padding(.horizontal, 16)
- .padding(.vertical, 8)
-
- // Section header
- HStack {
- Text("CLEANING")
- .font(.system(size: 10, weight: .bold, design: .rounded))
- .foregroundColor(.pmTextMuted)
- .tracking(1.2)
- Spacer()
- }
- .padding(.horizontal, 20)
- .padding(.bottom, 4)
-
- ForEach(CleaningCategory.scannable) { category in
- SidebarItem(
- category: category,
- isSelected: vm.selectedCategory == category,
- resultSize: vm.categoryResults[category]?.totalSize
- )
- .onTapGesture { vm.selectedCategory = category }
- }
- }
- .padding(.bottom, 16)
- }
-
- Spacer()
-
- // Bottom info
- VStack(spacing: 8) {
- Divider()
- .background(Color.pmSeparator)
-
- if let lastCleaned = vm.lastCleanedDate {
- HStack {
- Image(systemName: "checkmark.circle.fill")
- .font(.system(size: 10))
- .foregroundColor(.pmSuccess)
- Text("Last cleaned: \(timeAgo(lastCleaned))")
- .font(.system(size: 10))
- .foregroundColor(.pmTextMuted)
- }
- .padding(.horizontal, 16)
- }
-
- Text("v\(AppConstants.appVersion)")
- .font(.system(size: 10))
- .foregroundColor(.pmTextMuted)
- .padding(.bottom, 12)
- }
- }
- .background(
- ZStack {
- AppGradients.sidebar
- .ignoresSafeArea()
- // Subtle right border glow
- HStack {
- Spacer()
- Rectangle()
- .fill(
- LinearGradient(
- colors: [.pmAccent.opacity(0.05), .clear],
- startPoint: .trailing,
- endPoint: .leading
- )
- )
- .frame(width: 1)
- }
- }
- )
- }
-
- func timeAgo(_ date: Date) -> String {
- let formatter = RelativeDateTimeFormatter()
- formatter.unitsStyle = .abbreviated
- return formatter.localizedString(for: date, relativeTo: Date())
- }
-}
-
-// MARK: - Sidebar Item
-
-struct SidebarItem: View {
- let category: CleaningCategory
- let isSelected: Bool
- let resultSize: Int64?
-
- @State private var isHovering = false
-
- var body: some View {
- HStack(spacing: 12) {
- // Icon
- ZStack {
- RoundedRectangle(cornerRadius: 8)
- .fill(isSelected ? category.color.opacity(0.2) : Color.clear)
- .frame(width: 32, height: 32)
-
- Image(systemName: category.icon)
- .font(.system(size: 14))
- .foregroundColor(isSelected ? category.color : .pmTextSecondary)
- }
-
- // Label
- VStack(alignment: .leading, spacing: 2) {
- Text(LocalizedStringKey(category.rawValue))
- .font(.pmBody)
- .foregroundColor(isSelected ? .pmTextPrimary : .pmTextSecondary)
- .lineLimit(1)
-
- if let size = resultSize, size > 0 {
- Text(ByteCountFormatter.string(fromByteCount: size, countStyle: .file))
- .font(.system(size: 10, weight: .medium, design: .rounded))
- .foregroundColor(category.color)
- }
- }
-
- Spacer()
-
- // Size badge
- if let size = resultSize, size > 0, !isSelected {
- Circle()
- .fill(category.color.opacity(0.2))
- .frame(width: 8, height: 8)
- }
- }
- .padding(.horizontal, 16)
- .padding(.vertical, 8)
- .background(
- RoundedRectangle(cornerRadius: 10)
- .fill(isSelected ? Color.pmCard : (isHovering ? Color.pmCard.opacity(0.5) : .clear))
- )
- .padding(.horizontal, 8)
- .onHover { hovering in
- withAnimation(.pmSmooth) { isHovering = hovering }
- }
- .contentShape(Rectangle())
- }
-}
diff --git a/PureMac/Views/SmartScanView.swift b/PureMac/Views/SmartScanView.swift
index f5c6204..843d7e8 100644
--- a/PureMac/Views/SmartScanView.swift
+++ b/PureMac/Views/SmartScanView.swift
@@ -1,13 +1,13 @@
import SwiftUI
struct SmartScanView: View {
- @EnvironmentObject var vm: AppViewModel
+ @EnvironmentObject var appState: AppState
var body: some View {
- VStack(spacing: 0) {
+ VStack(spacing: 20) {
Spacer()
- switch vm.scanState {
+ switch appState.scanState {
case .idle:
idleView
case .scanning:
@@ -21,589 +21,224 @@ struct SmartScanView: View {
}
Spacer()
-
- // Bottom action bar
- actionBar
- .padding(.bottom, 32)
}
- .padding(.horizontal, 40)
+ .padding()
}
- // MARK: - Idle View
+ // MARK: - Idle
private var idleView: some View {
- VStack(spacing: 24) {
- ZStack {
- // Outer glow ring
- Circle()
- .stroke(Color.pmAccent.opacity(0.1), lineWidth: 2)
- .frame(width: 220, height: 220)
-
- Circle()
- .stroke(Color.pmAccent.opacity(0.05), lineWidth: 1)
- .frame(width: 250, height: 250)
-
- // Main circle
- Circle()
- .fill(
- RadialGradient(
- colors: [Color.pmAccent.opacity(0.15), Color.pmBackground],
- center: .center,
- startRadius: 20,
- endRadius: 110
- )
- )
- .frame(width: 200, height: 200)
-
- VStack(spacing: 8) {
- Image(systemName: "sparkles")
- .font(.system(size: 40))
- .foregroundColor(.pmAccentLight)
-
- Text("Smart Scan")
- .font(.pmHeadline)
- .foregroundColor(.pmTextPrimary)
-
- Text("Click Scan to start")
- .font(.pmCaption)
- .foregroundColor(.pmTextMuted)
- }
- }
- .pmGlow(color: .pmAccent, radius: 40)
-
- // Disk overview
- diskOverview
- }
- }
-
- // MARK: - Scanning View
-
- private var scanningView: some View {
- VStack(spacing: 24) {
- ZStack {
- // Background ring
- Circle()
- .stroke(Color.pmCard, lineWidth: 8)
- .frame(width: 200, height: 200)
-
- // Progress ring
- Circle()
- .trim(from: 0, to: vm.scanProgress)
- .stroke(
- AppGradients.scanRing,
- style: StrokeStyle(lineWidth: 8, lineCap: .round)
- )
- .frame(width: 200, height: 200)
- .rotationEffect(.degrees(-90))
- .animation(.easeInOut(duration: 0.3), value: vm.scanProgress)
-
- // Spinning outer ring
- Circle()
- .trim(from: 0, to: 0.3)
- .stroke(
- Color.pmAccent.opacity(0.3),
- style: StrokeStyle(lineWidth: 2, lineCap: .round)
- )
- .frame(width: 230, height: 230)
- .rotationEffect(.degrees(rotationAngle))
-
- VStack(spacing: 4) {
- Text("\(Int(vm.scanProgress * 100))%")
- .font(.pmLargeNumber)
- .foregroundColor(.pmTextPrimary)
- .contentTransition(.numericText())
-
- Text(LocalizedStringKey(vm.currentScanCategory))
- .font(.pmCaption)
- .foregroundColor(.pmTextSecondary)
- .lineLimit(1)
- }
- }
-
- // Live results
- if !vm.allResults.isEmpty {
- liveResults
- }
- }
- .onAppear { startRotation() }
- }
-
- // MARK: - Completed View
-
- private var completedView: some View {
- VStack(spacing: 24) {
- ZStack {
- Circle()
- .stroke(Color.pmCard, lineWidth: 8)
- .frame(width: 200, height: 200)
-
- Circle()
- .trim(from: 0, to: 1)
- .stroke(
- AppGradients.primary,
- style: StrokeStyle(lineWidth: 8, lineCap: .round)
- )
- .frame(width: 200, height: 200)
- .rotationEffect(.degrees(-90))
-
- VStack(spacing: 4) {
- Text(ByteCountFormatter.string(fromByteCount: vm.totalJunkSize, countStyle: .file))
- .font(.pmLargeNumber)
- .foregroundColor(.pmTextPrimary)
-
- Text("junk found")
- .font(.pmSubheadline)
- .foregroundColor(.pmTextSecondary)
- }
- }
- .pmGlow(color: vm.totalJunkSize > 0 ? .pmWarning : .pmSuccess, radius: 30)
-
- // Results breakdown
- if !vm.allResults.isEmpty {
- resultsBreakdown
- } else {
- VStack(spacing: 8) {
- Image(systemName: "checkmark.circle.fill")
- .font(.system(size: 32))
- .foregroundColor(.pmSuccess)
- Text("Your Mac is clean!")
- .font(.pmSubheadline)
- .foregroundColor(.pmTextSecondary)
- }
- }
- }
- }
-
- // MARK: - Cleaning View
-
- private var cleaningView: some View {
- VStack(spacing: 24) {
- ZStack {
- Circle()
- .stroke(Color.pmCard, lineWidth: 8)
- .frame(width: 200, height: 200)
-
- Circle()
- .trim(from: 0, to: vm.cleanProgress)
- .stroke(
- AppGradients.danger,
- style: StrokeStyle(lineWidth: 8, lineCap: .round)
- )
- .frame(width: 200, height: 200)
- .rotationEffect(.degrees(-90))
- .animation(.easeInOut(duration: 0.3), value: vm.cleanProgress)
-
- VStack(spacing: 4) {
- Image(systemName: "trash.fill")
- .font(.system(size: 28))
- .foregroundColor(.pmDanger)
-
- Text("Cleaning...")
- .font(.pmSubheadline)
- .foregroundColor(.pmTextSecondary)
-
- Text("\(Int(vm.cleanProgress * 100))%")
- .font(.pmMediumNumber)
- .foregroundColor(.pmTextPrimary)
- .contentTransition(.numericText())
+ VStack(spacing: 20) {
+ Image(systemName: "magnifyingglass")
+ .font(.system(size: 48))
+ .foregroundStyle(.secondary)
+
+ Text("Ready to Scan")
+ .font(.title2)
+
+ GroupBox("Disk Usage") {
+ Grid(alignment: .leading, horizontalSpacing: 12, verticalSpacing: 8) {
+ GridRow {
+ Text("Total")
+ .foregroundStyle(.secondary)
+ Text(appState.diskInfo.formattedTotal)
+ .fontWeight(.medium)
+ }
+ GridRow {
+ Text("Used")
+ .foregroundStyle(.secondary)
+ Text(appState.diskInfo.formattedUsed)
+ .fontWeight(.medium)
+ }
+ GridRow {
+ Text("Free")
+ .foregroundStyle(.secondary)
+ Text(appState.diskInfo.formattedFree)
+ .fontWeight(.medium)
+ }
+ if appState.diskInfo.purgeableSpace > 0 {
+ GridRow {
+ Text("Purgeable")
+ .foregroundStyle(.secondary)
+ Text(appState.diskInfo.formattedPurgeable)
+ .fontWeight(.medium)
+ }
+ }
}
+ .padding(.vertical, 4)
}
- }
- }
-
- // MARK: - Cleaned View
+ .frame(maxWidth: 300)
- private var cleanedView: some View {
- VStack(spacing: 24) {
- ZStack {
- Circle()
- .fill(Color.pmSuccess.opacity(0.1))
- .frame(width: 200, height: 200)
-
- VStack(spacing: 8) {
- Image(systemName: "checkmark.circle.fill")
- .font(.system(size: 48))
- .foregroundColor(.pmSuccess)
-
- Text(ByteCountFormatter.string(fromByteCount: vm.totalFreedSpace, countStyle: .file))
- .font(.pmLargeNumber)
- .foregroundColor(.pmSuccess)
-
- Text("freed up")
- .font(.pmSubheadline)
- .foregroundColor(.pmTextSecondary)
- }
+ Button("Start Scan") {
+ appState.startSmartScan()
}
- .pmGlow(color: .pmSuccess, radius: 40)
+ .buttonStyle(.borderedProminent)
+ .controlSize(.large)
}
- .transition(.scale.combined(with: .opacity))
}
- // MARK: - Sub Views
-
- private var diskOverview: some View {
- HStack(spacing: 24) {
- DiskStatCard(
- title: "Total",
- value: vm.diskInfo.formattedTotal,
- icon: "internaldrive.fill",
- color: .pmAccent
- )
- DiskStatCard(
- title: "Used",
- value: vm.diskInfo.formattedUsed,
- icon: "chart.pie.fill",
- color: .pmWarning
- )
- DiskStatCard(
- title: "Free",
- value: vm.diskInfo.formattedFree,
- icon: "checkmark.circle.fill",
- color: .pmSuccess
- )
- if vm.diskInfo.purgeableSpace > 0 {
- DiskStatCard(
- title: "Purgeable",
- value: vm.diskInfo.formattedPurgeable,
- icon: "arrow.3.trianglepath",
- color: .pmInfo
- )
- }
- }
- }
+ // MARK: - Scanning
- private var liveResults: some View {
- VStack(spacing: 8) {
- ForEach(vm.allResults.prefix(6)) { result in
- HStack(spacing: 12) {
- Image(systemName: result.category.icon)
- .font(.system(size: 12))
- .foregroundColor(result.category.color)
- .frame(width: 20)
-
- Text(LocalizedStringKey(result.category.rawValue))
- .font(.pmCaption)
- .foregroundColor(.pmTextSecondary)
-
- Spacer()
-
- Text(result.formattedSize)
- .font(.pmCaption)
- .foregroundColor(.pmTextPrimary)
- }
- .padding(.horizontal, 16)
- .padding(.vertical, 6)
- }
- }
- .padding(.vertical, 12)
- .background(Color.pmCard.opacity(0.5))
- .cornerRadius(12)
- .frame(maxWidth: 400)
- }
-
- private var resultsBreakdown: some View {
- VStack(spacing: 8) {
- ForEach(vm.allResults) { result in
- ResultRow(result: result) {
- withAnimation(.pmSpring) {
- vm.selectedCategory = result.category
+ private var scanningView: some View {
+ VStack(spacing: 20) {
+ Text("Scanning...")
+ .font(.title2)
+
+ ProgressView(value: appState.scanProgress) {
+ Text(appState.currentScanCategory)
+ .foregroundStyle(.secondary)
+ } currentValueLabel: {
+ Text("\(Int(appState.scanProgress * 100))%")
+ }
+ .progressViewStyle(.linear)
+ .frame(maxWidth: 350)
+
+ if !appState.allResults.isEmpty {
+ GroupBox("Results Found") {
+ VStack(alignment: .leading, spacing: 6) {
+ ForEach(appState.allResults.prefix(6)) { result in
+ HStack {
+ Image(systemName: result.category.icon)
+ .frame(width: 20)
+ Text(LocalizedStringKey(result.category.rawValue))
+ Spacer()
+ Text(result.formattedSize)
+ .foregroundStyle(.secondary)
+ }
+ .font(.callout)
+ }
}
+ .padding(.vertical, 4)
}
+ .frame(maxWidth: 400)
}
}
- .frame(maxWidth: 450)
}
- // MARK: - Action Bar
-
- private var actionBar: some View {
- HStack(spacing: 16) {
- switch vm.scanState {
- case .idle:
- GradientActionButton(
- title: "Scan",
- icon: "magnifyingglass",
- gradient: AppGradients.primary
- ) {
- withAnimation(.pmSpring) {
- vm.startSmartScan()
- }
- }
+ // MARK: - Completed
- case .scanning:
- Button(action: {}) {
- HStack(spacing: 8) {
- ProgressView()
- .progressViewStyle(.circular)
- .scaleEffect(0.7)
- .tint(.white)
- Text("Scanning...")
- .font(.pmSubheadline)
- .foregroundColor(.pmTextSecondary)
+ private var completedView: some View {
+ VStack(spacing: 20) {
+ if appState.totalJunkSize > 0 {
+ Text(ByteCountFormatter.string(fromByteCount: appState.totalJunkSize, countStyle: .file))
+ .font(.system(size: 36, weight: .bold, design: .rounded))
+
+ Text("junk found")
+ .font(.title3)
+ .foregroundStyle(.secondary)
+
+ GroupBox {
+ VStack(alignment: .leading, spacing: 6) {
+ ForEach(appState.allResults) { result in
+ CategoryToggleRow(result: result)
+ }
}
- .frame(width: 200, height: 44)
- .background(Color.pmCard)
- .cornerRadius(12)
+ .padding(.vertical, 4)
}
- .buttonStyle(.plain)
- .disabled(true)
+ .frame(maxWidth: 450)
- case .completed:
- if vm.totalSelectedSize > 0 {
- GradientActionButton(
- title: "Clean (\(ByteCountFormatter.string(fromByteCount: vm.totalSelectedSize, countStyle: .file)))",
- icon: "trash.fill",
- gradient: AppGradients.accent
- ) {
- withAnimation(.pmSpring) {
- vm.cleanAll()
+ HStack(spacing: 12) {
+ if appState.totalSelectedSize > 0 {
+ Button("Clean Selected (\(ByteCountFormatter.string(fromByteCount: appState.totalSelectedSize, countStyle: .file)))") {
+ appState.cleanAll()
}
+ .buttonStyle(.borderedProminent)
+ .controlSize(.large)
}
- Button(action: {
- withAnimation(.pmSpring) {
- vm.startSmartScan()
- }
- }) {
- Text("Re-scan")
- .font(.pmBody)
- .foregroundColor(.pmTextSecondary)
- .frame(height: 44)
- .padding(.horizontal, 24)
- .background(Color.pmCard)
- .cornerRadius(12)
- }
- .buttonStyle(.plain)
- } else {
- GradientActionButton(
- title: "Scan Again",
- icon: "arrow.clockwise",
- gradient: AppGradients.success
- ) {
- withAnimation(.pmSpring) {
- vm.startSmartScan()
- }
+ Button("Scan Again") {
+ appState.startSmartScan()
}
+ .controlSize(.large)
}
+ } else {
+ Image(systemName: "checkmark.circle")
+ .font(.system(size: 48))
+ .foregroundStyle(.green)
- case .cleaning:
- Button(action: {}) {
- HStack(spacing: 8) {
- ProgressView()
- .progressViewStyle(.circular)
- .scaleEffect(0.7)
- .tint(.white)
- Text("Cleaning...")
- .font(.pmSubheadline)
- .foregroundColor(.pmTextSecondary)
- }
- .frame(width: 200, height: 44)
- .background(Color.pmCard)
- .cornerRadius(12)
- }
- .buttonStyle(.plain)
- .disabled(true)
+ Text("Your Mac is clean")
+ .font(.title2)
- case .cleaned:
- GradientActionButton(
- title: "Done",
- icon: "checkmark",
- gradient: AppGradients.success
- ) {
- withAnimation(.pmSpring) {
- vm.scanState = .idle
- }
+ Button("Scan Again") {
+ appState.startSmartScan()
}
+ .buttonStyle(.borderedProminent)
+ .controlSize(.large)
}
}
}
- // MARK: - Animation State
-
- @State private var rotationAngle: Double = 0
- @State private var rotationTimer: Timer?
+ // MARK: - Cleaning
- private func startRotation() {
- rotationTimer?.invalidate()
- rotationTimer = Timer.scheduledTimer(withTimeInterval: 0.02, repeats: true) { _ in
- DispatchQueue.main.async {
- rotationAngle += 1.5
- if rotationAngle >= 360 { rotationAngle = 0 }
+ private var cleaningView: some View {
+ VStack(spacing: 20) {
+ ProgressView(value: appState.cleanProgress) {
+ Text("Cleaning...")
+ .font(.title3)
+ } currentValueLabel: {
+ Text("\(Int(appState.cleanProgress * 100))%")
}
+ .progressViewStyle(.linear)
+ .frame(maxWidth: 350)
}
}
-}
-// MARK: - Disk Stat Card
+ // MARK: - Cleaned
+
+ private var cleanedView: some View {
+ VStack(spacing: 20) {
+ Image(systemName: "checkmark.circle")
+ .font(.system(size: 48))
+ .foregroundStyle(.green)
-struct DiskStatCard: View {
- let title: String
- let value: String
- let icon: String
- let color: Color
+ Text(ByteCountFormatter.string(fromByteCount: appState.totalFreedSpace, countStyle: .file))
+ .font(.system(size: 36, weight: .bold, design: .rounded))
- var body: some View {
- VStack(spacing: 8) {
- Image(systemName: icon)
- .font(.system(size: 16))
- .foregroundColor(color)
-
- Text(value)
- .font(.system(size: 14, weight: .bold, design: .rounded))
- .foregroundColor(.pmTextPrimary)
-
- Text(title)
- .font(.system(size: 10, weight: .medium))
- .foregroundColor(.pmTextMuted)
+ Text("freed")
+ .font(.title3)
+ .foregroundStyle(.secondary)
+
+ Button("Done") {
+ appState.scanState = .idle
+ }
+ .buttonStyle(.borderedProminent)
+ .controlSize(.large)
}
- .frame(width: 100, height: 80)
- .background(Color.pmCard.opacity(0.5))
- .cornerRadius(12)
}
}
-// MARK: - Result Row (Clickable)
+// MARK: - Category Toggle Row
-struct ResultRow: View {
- @EnvironmentObject var vm: AppViewModel
+private struct CategoryToggleRow: View {
+ @EnvironmentObject var appState: AppState
let result: CategoryResult
- let onTap: () -> Void
-
- @State private var isHovering = false
-
- var isCategorySelected: Bool {
- vm.selectedCountInCategory(result.category) > 0
- }
- var isFullySelected: Bool {
- vm.selectedCountInCategory(result.category) == result.itemCount
- }
-
- var selectedSize: Int64 {
- vm.selectedSizeInCategory(result.category)
+ private var isFullySelected: Bool {
+ appState.selectedCountInCategory(result.category) == result.itemCount
}
var body: some View {
- HStack(spacing: 12) {
- // Category checkbox
- Button(action: {
- withAnimation(.pmSmooth) {
- if isFullySelected {
- vm.deselectAllInCategory(result.category)
- } else {
- vm.selectAllInCategory(result.category)
- }
- }
- }) {
- ZStack {
- RoundedRectangle(cornerRadius: 4)
- .stroke(isCategorySelected ? result.category.color : Color.pmTextMuted, lineWidth: 1.5)
- .frame(width: 18, height: 18)
-
- if isFullySelected {
- RoundedRectangle(cornerRadius: 4)
- .fill(result.category.color)
- .frame(width: 18, height: 18)
-
- Image(systemName: "checkmark")
- .font(.system(size: 10, weight: .bold))
- .foregroundColor(.white)
- } else if isCategorySelected {
- RoundedRectangle(cornerRadius: 4)
- .fill(result.category.color)
- .frame(width: 18, height: 18)
-
- Image(systemName: "minus")
- .font(.system(size: 10, weight: .bold))
- .foregroundColor(.white)
- }
- }
- .contentShape(Rectangle())
- }
- .buttonStyle(.plain)
-
- // Category icon + info (clickable to navigate)
- Button(action: onTap) {
- HStack(spacing: 12) {
- ZStack {
- RoundedRectangle(cornerRadius: 6)
- .fill(result.category.color.opacity(isCategorySelected ? 0.15 : 0.05))
- .frame(width: 28, height: 28)
-
- Image(systemName: result.category.icon)
- .font(.system(size: 12))
- .foregroundColor(isCategorySelected ? result.category.color : .pmTextMuted)
- }
-
- VStack(alignment: .leading, spacing: 2) {
- Text(LocalizedStringKey(result.category.rawValue))
- .font(.pmBody)
- .foregroundColor(isCategorySelected ? .pmTextPrimary : .pmTextMuted)
-
- Text("\(vm.selectedCountInCategory(result.category))/\(result.itemCount) items")
- .font(.system(size: 10))
- .foregroundColor(.pmTextMuted)
- }
-
- Spacer()
-
- Text(ByteCountFormatter.string(fromByteCount: selectedSize, countStyle: .file))
- .font(.system(size: 14, weight: .semibold, design: .rounded))
- .foregroundColor(isCategorySelected ? result.category.color : .pmTextMuted)
-
- Image(systemName: "chevron.right")
- .font(.system(size: 10, weight: .semibold))
- .foregroundColor(isHovering ? result.category.color : .pmTextMuted)
+ Toggle(isOn: Binding(
+ get: { isFullySelected },
+ set: { newValue in
+ if newValue {
+ appState.selectAllInCategory(result.category)
+ } else {
+ appState.deselectAllInCategory(result.category)
}
- .contentShape(Rectangle())
}
- .buttonStyle(.plain)
- }
- .padding(.horizontal, 16)
- .padding(.vertical, 10)
- .background(
- RoundedRectangle(cornerRadius: 10)
- .fill(isHovering ? Color.pmCardHover : Color.pmCard.opacity(0.4))
- )
- .overlay(
- RoundedRectangle(cornerRadius: 10)
- .stroke(isHovering ? result.category.color.opacity(0.3) : Color.clear, lineWidth: 1)
- )
- .onHover { h in
- withAnimation(.pmSmooth) { isHovering = h }
- }
- }
-}
-
-// MARK: - Gradient Action Button
-
-struct GradientActionButton: View {
- let title: LocalizedStringKey
- let icon: String
- let gradient: LinearGradient
- let action: () -> Void
-
- @State private var isHovering = false
-
- var body: some View {
- Button(action: action) {
- HStack(spacing: 8) {
- Image(systemName: icon)
- .font(.system(size: 14, weight: .semibold))
- Text(title)
- .font(.system(size: 15, weight: .semibold, design: .rounded))
+ )) {
+ HStack {
+ Image(systemName: result.category.icon)
+ .frame(width: 20)
+ Text(LocalizedStringKey(result.category.rawValue))
+ Spacer()
+ Text("\(result.itemCount) items")
+ .foregroundStyle(.secondary)
+ Text(result.formattedSize)
+ .fontWeight(.medium)
}
- .foregroundColor(.white)
- .frame(height: 44)
- .padding(.horizontal, 32)
- .background(gradient)
- .cornerRadius(12)
- .scaleEffect(isHovering ? 1.03 : 1.0)
- .pmShadow(radius: isHovering ? 15 : 8, y: isHovering ? 6 : 4)
- }
- .buttonStyle(.plain)
- .onHover { h in
- withAnimation(.pmSmooth) { isHovering = h }
}
+ .toggleStyle(.checkbox)
}
}
diff --git a/project.yml b/project.yml
index 6f6fa42..067e449 100644
--- a/project.yml
+++ b/project.yml
@@ -13,14 +13,14 @@ settings:
MACOSX_DEPLOYMENT_TARGET: "13.0"
ARCHS: "arm64 x86_64"
ONLY_ACTIVE_ARCH: "NO"
- CODE_SIGN_IDENTITY: "-"
+ CODE_SIGN_IDENTITY: "Developer ID Application: Moamen Basel (H3WXHVTP97)"
CODE_SIGN_STYLE: "Automatic"
DEVELOPMENT_TEAM: "H3WXHVTP97"
CODE_SIGN_ENTITLEMENTS: "PureMac/PureMac.entitlements"
INFOPLIST_FILE: "PureMac/Info.plist"
PRODUCT_BUNDLE_IDENTIFIER: "com.puremac.app"
- MARKETING_VERSION: "1.0.1"
- CURRENT_PROJECT_VERSION: "3"
+ MARKETING_VERSION: "2.0.0"
+ CURRENT_PROJECT_VERSION: "4"
GENERATE_INFOPLIST_FILE: "NO"
ASSETCATALOG_COMPILER_APPICON_NAME: "AppIcon"
COMBINE_HIDPI_IMAGES: "YES"