@@ -36,6 +36,7 @@ struct ApplicationsManagerView: View {
3636 @State private var showClearAllConfirm = false
3737 @State private var showResult = false
3838 @State private var resultMessage = " "
39+ @State private var showFDAAlert = false
3940 @State private var searchText = " "
4041 @State private var activeFilter : AppFilter = . all
4142 @State private var activeSort : AppSort = . name
@@ -137,10 +138,18 @@ struct ApplicationsManagerView: View {
137138 }
138139 }
139140 . alert ( " Action Complete " , isPresented: $showResult) {
140- Button ( " OK " ) { engine . scanAll ( ) }
141+ Button ( " OK " ) { }
141142 } message: {
142143 Text ( resultMessage)
143144 }
145+ . alert ( " Full Disk Access Required " , isPresented: $showFDAAlert) {
146+ Button ( " Open System Settings " ) {
147+ NSWorkspace . shared. open ( URL ( string: " x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles " ) !)
148+ }
149+ Button ( " Cancel " , role: . cancel) { }
150+ } message: {
151+ Text ( " MacSweep needs Full Disk Access to clean app files. \n \n Go to System Settings → Privacy & Security → Full Disk Access and enable MacSweep. " )
152+ }
144153 }
145154
146155 // MARK: - Landing
@@ -877,8 +886,12 @@ struct ApplicationsManagerView: View {
877886 . confirmationDialog ( " Clean All App Leftovers? " , isPresented: $showBatchCleanConfirm, titleVisibility: . visible) {
878887 Button ( " Clean Selected Leftovers from \( appsWithLeftovers) Apps " , role: . destructive) {
879888 let cleaned = engine. batchCleanAllLeftovers ( )
880- resultMessage = " Batch cleaned \( ByteCountFormatter . string ( fromByteCount: cleaned, countStyle: . file) ) from \( appsWithLeftovers) apps. "
881- showResult = true
889+ if cleaned == 0 {
890+ showFDAAlert = true
891+ } else {
892+ resultMessage = " Cleaned \( ByteCountFormatter . string ( fromByteCount: cleaned, countStyle: . file) ) from \( appsWithLeftovers) apps. "
893+ showResult = true
894+ }
882895 }
883896 Button ( " Cancel " , role: . cancel) { }
884897 } message: {
@@ -922,8 +935,12 @@ struct ApplicationsManagerView: View {
922935 . confirmationDialog ( " Reset \( app. name) ? " , isPresented: $showResetConfirm, titleVisibility: . visible) {
923936 Button ( " Reset (Delete Leftovers) " , role: . destructive) {
924937 let cleaned = engine. resetApp ( appId: app. id)
925- resultMessage = " Cleaned \( ByteCountFormatter . string ( fromByteCount: cleaned, countStyle: . file) ) of data from \( app. name) . "
926- showResult = true
938+ if cleaned == 0 {
939+ showFDAAlert = true
940+ } else {
941+ resultMessage = " Cleaned \( ByteCountFormatter . string ( fromByteCount: cleaned, countStyle: . file) ) from \( app. name) . "
942+ showResult = true
943+ }
927944 }
928945 Button ( " Cancel " , role: . cancel) { }
929946 }
@@ -944,8 +961,12 @@ struct ApplicationsManagerView: View {
944961 . confirmationDialog ( " Clear All App Data for \( app. name) ? " , isPresented: $showClearAllConfirm, titleVisibility: . visible) {
945962 Button ( " Deep Clean (Delete Leftovers + Scratch) " , role: . destructive) {
946963 let cleaned = engine. clearAllAppData ( appId: app. id)
947- resultMessage = " Deep cleaned \( ByteCountFormatter . string ( fromByteCount: cleaned, countStyle: . file) ) from \( app. name) . "
948- showResult = true
964+ if cleaned == 0 {
965+ showFDAAlert = true
966+ } else {
967+ resultMessage = " Deep cleaned \( ByteCountFormatter . string ( fromByteCount: cleaned, countStyle: . file) ) from \( app. name) . "
968+ showResult = true
969+ }
949970 }
950971 Button ( " Cancel " , role: . cancel) { }
951972 } message: { Text ( " This will move ALL detected caches, logs, preferences, and temporary files for this app to Trash when possible. " ) }
0 commit comments