Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Check every app for updates again when Applications is rescanned
Țugui Dragoșfe8ae03864b4
diff --git a/GUIDE.md b/GUIDE.mdindex e26c7178..821561ed 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -73,9 +73,9 @@ and how to get it, [SAFETY.md](SAFETY.md) what it protects, [PRIVACY.md](PRIVACY- **Updates for your apps.** Peel checks your apps for new versions, through the update feed each app names, theApp Store for apps bought there, or Homebrew for apps it installed, as Prefer updates from in Settings > Generalchooses, and shows what is new in the version that waits, as the app's own notes say it, even with no- connection. Skip This Version and Never Check This App keep it quiet about the ones you want left alone, and- Settings > General lists them under Muted Updates, where Check Again brings their updates back. Turning off Check- for app updates there stops the checks.+ connection. Rescan in Applications asks about every app again at once. Skip This Version and Never Check This+ App keep it quiet about the ones you want left alone, and Settings > General lists them under Muted Updates,+ where Check Again brings their updates back. Turning off Check for app updates there stops the checks.## Free up disk spacediff --git a/Peel/Model/AppLibrary.swift b/Peel/Model/AppLibrary.swiftindex db2e3569..47a434ba 100644--- a/Peel/Model/AppLibrary.swift+++ b/Peel/Model/AppLibrary.swift@@ -286,6 +286,22 @@ final class AppLibrary {await checkSigningTeams()}+ /// Reads the folders again and asks about every app's updates, in a round of its own so the list isn't held.+ func rescan() async {+ let changed = await refresh()+ if !changed.isEmpty { await checkSigningTeams() }+ checkEveryAppAgain()+ }++ /// The round of checks Rescan started, which the next Rescan stops before it starts its own.+ @ObservationIgnored private(set) var recheck: Task<Void, Never>?++ /// Asks about every app's updates now, whatever each one's schedule says.+ func checkEveryAppAgain() {+ recheck?.cancel()+ recheck = Task { await checkForUpdates(apps, force: true) }+ }+private func keepUnreadable(of scan: AppScan) {if unreadable != scan.unreadable { unreadable = scan.unreadable }if unreadableNeedsFullDiskAccess != scan.needsFullDiskAccess {diff --git a/Peel/Views/AppList.swift b/Peel/Views/AppList.swiftindex be86a787..1b43eb0a 100644--- a/Peel/Views/AppList.swift+++ b/Peel/Views/AppList.swift@@ -79,9 +79,8 @@ struct AppList: View {AppListMenu()}ToolbarItem {- // The folder watcher reads the apps on its own; this is for someone who has just installed one.RescanButton(isRunning: $isRescanning, isDisabled: library.isLoading, scan: library.scanRun) {- await library.checkAgain(await library.refresh())+ await library.rescan()}}}diff --git a/PeelTests/AppLibraryTests.swift b/PeelTests/AppLibraryTests.swiftindex cab7459c..2d316e54 100644--- a/PeelTests/AppLibraryTests.swift+++ b/PeelTests/AppLibraryTests.swift@@ -69,8 +69,7 @@ private nonisolated final class AppcastProtocol: URLProtocol, @unchecked Sendabl#expect(UserDefaults.standard.data(forKey: SettingsKey.updateMemory) == standardBefore)}- @Test func anOlderAppStoreAnswerLeavesTheUpdateItFound() async throws {- let folder = FileManager.default.temporaryDirectory.appending(path: "PeelTests-\(UUID().uuidString)")+ private func soldApp(in folder: URL) throws -> URL {let bundle = folder.appending(path: "Sold.app", directoryHint: .isDirectory)try FileManager.default.createDirectory(at: bundle.appending(path: "Contents/_MASReceipt"), withIntermediateDirectories: true@@ -82,19 +81,30 @@ private nonisolated final class AppcastProtocol: URLProtocol, @unchecked Sendabltry PropertyListSerialization.data(fromPropertyList: info, format: .xml, options: 0).write(to: bundle.appending(path: "Contents/Info.plist"))try Data().write(to: bundle.appending(path: "Contents/_MASReceipt/receipt"))- defer { try? FileManager.default.removeItem(at: folder) }- let made = try MadeUpDefaults()- defer { made.forget() }+ return bundle+ }++ private func library(with defaults: UserDefaults, notesIn folder: URL) -> AppLibrary {let configuration = URLSessionConfiguration.ephemeralconfiguration.protocolClasses = [AppcastProtocol.self]- let library = AppLibrary(- defaults: made.defaults,+ return AppLibrary(+ defaults: defaults,updateChecker: UpdateChecker(session: URLSession(configuration: configuration)),releaseNotesStore: ReleaseNotesStore(url: folder.appending(path: "release-notes.json")))- let listing = { (version: String) in- Data(#"{"resultCount":1,"results":[{"kind":"mac-software","version":"\#(version)"}]}"#.utf8)- }+ }++ private func listing(_ version: String) -> Data {+ Data(#"{"resultCount":1,"results":[{"kind":"mac-software","version":"\#(version)"}]}"#.utf8)+ }++ @Test func anOlderAppStoreAnswerLeavesTheUpdateItFound() async throws {+ let folder = FileManager.default.temporaryDirectory.appending(path: "PeelTests-\(UUID().uuidString)")+ let bundle = try soldApp(in: folder)+ defer { try? FileManager.default.removeItem(at: folder) }+ let made = try MadeUpDefaults()+ defer { made.forget() }+ let library = library(with: made.defaults, notesIn: folder)#expect(await library.reveal([bundle]))let app = try #require(library.apps.first { $0.bundleIdentifier == "org.example.sold" })@@ -106,4 +116,27 @@ private nonisolated final class AppcastProtocol: URLProtocol, @unchecked Sendablawait library.checkForUpdates([app], force: true)#expect(library.shownUpdateStatus(of: app)?.version == "1.2")}++ @Test func checkingEveryAppAgainAsksAnAppThatIsNotDue() async throws {+ let folder = FileManager.default.temporaryDirectory.appending(path: "PeelTests-\(UUID().uuidString)")+ let bundle = try soldApp(in: folder)+ defer { try? FileManager.default.removeItem(at: folder) }+ let made = try MadeUpDefaults()+ defer { made.forget() }+ let library = library(with: made.defaults, notesIn: folder)++ #expect(await library.reveal([bundle]))+ let app = try #require(library.apps.first { $0.bundleIdentifier == "org.example.sold" })+ AppcastProtocol.body.withLock { $0 = listing("1.0") }+ await library.checkForUpdates([app], force: true)+ #expect(library.shownUpdateStatus(of: app) == .upToDate)++ AppcastProtocol.body.withLock { $0 = listing("1.1") }+ await library.checkForUpdates([app])+ #expect(library.shownUpdateStatus(of: app) == .upToDate, "not due yet")+ library.checkEveryAppAgain()+ library.checkEveryAppAgain()+ await library.recheck?.value+ #expect(library.shownUpdateStatus(of: app)?.version == "1.1")+ }}