From c248e4c8cef98a22e184c8ef1e0603cbdcb0f2c4 Mon Sep 17 00:00:00 2001 From: Alin Date: Thu, 26 Sep 2024 10:12:24 -0600 Subject: [PATCH] Updates --- .../xcschemes/Pearcleaner Release.xcscheme | 4 ++-- Pearcleaner/Logic/AppState.swift | 23 ------------------- Pearcleaner/Logic/Locations.swift | 2 ++ Pearcleaner/Views/AppListItems.swift | 17 +++++++------- 4 files changed, 13 insertions(+), 33 deletions(-) diff --git a/Pearcleaner.xcodeproj/xcshareddata/xcschemes/Pearcleaner Release.xcscheme b/Pearcleaner.xcodeproj/xcshareddata/xcschemes/Pearcleaner Release.xcscheme index cb6f2b0..0d583ba 100644 --- a/Pearcleaner.xcodeproj/xcshareddata/xcschemes/Pearcleaner Release.xcscheme +++ b/Pearcleaner.xcodeproj/xcshareddata/xcschemes/Pearcleaner Release.xcscheme @@ -79,13 +79,13 @@ + revealArchiveInOrganizer = "YES"> [Item] { -// var items: [Item] = [] -// -// for (url, size) in self.fileSize { -// let name = url.lastPathComponent -// let isDirectory = url.hasDirectoryPath -// -// let item = Item( -// url: url, -// name: name, -// size: size, -// isDirectory: isDirectory -// ) -// -// items.append(item) -// } -// -// return items -// } -//} - enum Arch { case arm diff --git a/Pearcleaner/Logic/Locations.swift b/Pearcleaner/Logic/Locations.swift index dd3dd87..14753f3 100644 --- a/Pearcleaner/Logic/Locations.swift +++ b/Pearcleaner/Logic/Locations.swift @@ -38,6 +38,7 @@ class Locations: ObservableObject { "\(home)/Library/LaunchAgents", "\(home)/Library/Logs", "\(home)/Library/Preferences", + "\(home)/Library/PreferencePanes", "\(home)/Library/Preferences/ByHost", "\(home)/Library/Saved Application State", "\(home)/Library/Services", @@ -88,6 +89,7 @@ class Locations: ObservableObject { "\(home)/Library/LaunchAgents", "\(home)/Library/Logs", "\(home)/Library/Preferences", + "\(home)/Library/PreferencePanes", "\(home)/Library/Preferences/ByHost", "\(home)/Library/Saved Application State", "\(home)/Library/WebKit", diff --git a/Pearcleaner/Views/AppListItems.swift b/Pearcleaner/Views/AppListItems.swift index 9b517cc..31256f4 100644 --- a/Pearcleaner/Views/AppListItems.swift +++ b/Pearcleaner/Views/AppListItems.swift @@ -155,14 +155,15 @@ struct AppListItems: View { } } .onAppear { - DispatchQueue.global(qos: .userInitiated).async { - let size = totalSizeOnDisk(for: appInfo.path).logical - DispatchQueue.main.async { - self.bundleSize = size - - // Optionally, update the appInfo in the appState array - if let index = appState.sortedApps.firstIndex(where: { $0.path == appInfo.path }) { - appState.sortedApps[index].bundleSize = size + if self.bundleSize == 0 { + DispatchQueue.global(qos: .userInitiated).async { + let size = totalSizeOnDisk(for: appInfo.path).logical + DispatchQueue.main.async { + self.bundleSize = size + // Update the appInfo in the appState array + if let index = appState.sortedApps.firstIndex(where: { $0.path == appInfo.path }) { + appState.sortedApps[index].bundleSize = size + } } } }