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
Ask again when Peel opens about every app last checked a day ago
Țugui Dragoș9604fdd787ff
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex 268a3de8..73cd5321 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -372,10 +372,11 @@ macOS asks the user to approve it once. It talks to the app over XPC.Software Update and Setapp keep them current, whatever feed the bundle carries. A check waits up to 30 seconds fora Mac just awake to go online, and one made while it isn't online counts for nothing (`UpdateAnswer.wasOffline`):what was known stays and the app is asked at the next round. Every answer that changes nothing makes the next check- of that app wait longer, up to a week (`UpdateSchedule`), and `UpdateMemory` keeps the last answer across launches,- with the revision of the checker that gave it (`UpdateChecker.revision`): an answer an earlier revision gave about- an app it couldn't check, or about one this revision asks nobody about, is dropped, so the app is asked again at- the next round.+ of that app wait longer, up to a week (`UpdateSchedule`), though the first round after Peel opens also asks about+ every app whose answer is a day old (`UpdateMemory.isADayOld`). `UpdateMemory` keeps the last answer across+ launches, with the revision of the checker that gave it (`UpdateChecker.revision`): an answer an earlier revision+ gave about an app it couldn't check, or about one this revision asks nobody about, is dropped, so the app is asked+ again at the next round.- **Orphaned Files.** `OrphanScanner` lists what no installed app claims, under the app Peel saw go when it canname it (`AppMemory`), and selects nothing for the person. An app macOS knows on another disk that claims somethingis remembered too (`OrphanScan.appsOnOtherDisks`, `Disks`), so its files stay its own while that disk isn'tdiff --git a/GUIDE.md b/GUIDE.mdindex 33042521..afe390a6 100644--- a/GUIDE.md+++ b/GUIDE.md@@ -83,10 +83,12 @@ and how to get it, [SAFETY.md](SAFETY.md) what it protects, [PRIVACY.md](PRIVACYupdates until Homebrew checks again, with Update Homebrew on the Homebrew page or `brew update` in Terminal, and Peelreads Homebrew again once it has. Homebrew can't say at all for a cask that installs whatever is newest each time,nor, when its settings leave apps that update themselves to their own updates, for such an app, so those read Can't- check for updates too, unless the app names a feed. 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, and an app's Up to date, which Peel then no longer renews, goes after a week.+ check for updates too, unless the app names a feed. Peel asks about each app again on a schedule of its own, less+ often while nothing changes, and when it opens, about every app it last asked a day ago or more. 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, and an app's Up to date, which Peel then no+ longer renews, goes after a week.## Free up disk spacediff --git a/Packages/PeelCore/Sources/PeelCore/Updates/UpdateMemory.swift b/Packages/PeelCore/Sources/PeelCore/Updates/UpdateMemory.swiftindex fa898b10..fd3ebf1f 100644--- a/Packages/PeelCore/Sources/PeelCore/Updates/UpdateMemory.swift+++ b/Packages/PeelCore/Sources/PeelCore/Updates/UpdateMemory.swift@@ -48,6 +48,12 @@ public struct UpdateMemory: Codable, Equatable, Sendable {version == app.version && buildVersion == app.buildVersion}+ /// Whether the answer came a day or more before `now`, or when isn't known. Opening Peel asks again about such an+ /// app, whatever its schedule says.+ public func isADayOld(at now: Date) -> Bool {+ checked.map { now.timeIntervalSince($0) >= UpdateSchedule.base } ?? true+ }+/// How long past its due date an entry is kept for an app that is not installed, such as one on a disk that/// is not connected. Without a limit, the saved list would keep an entry for every app ever seen.static let longestAbsence: TimeInterval = 90 * 24 * 60 * 60diff --git a/Packages/PeelCore/Tests/PeelCoreTests/UpdateMemoryTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/UpdateMemoryTests.swiftindex 594a83cb..7890d11d 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/UpdateMemoryTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/UpdateMemoryTests.swift@@ -24,6 +24,17 @@ struct UpdateMemoryTests {private let schedule = UpdateSchedule.next(after: .upToDate, following: nil)+ @Test func anAnswerIsADayOldFromADayAfterItCame() {+ let checked = Date(timeIntervalSince1970: 1_800_000_000)+ let day: TimeInterval = 24 * 60 * 60+ let answer = UpdateMemory(status: .upToDate, schedule: schedule, checked: checked, describing: app("1.0"))+ let undated = UpdateMemory(status: .upToDate, schedule: schedule, checked: nil, describing: app("1.0"))++ #expect(!answer.isADayOld(at: checked + day - 1))+ #expect(answer.isADayOld(at: checked + day))+ #expect(undated.isADayOld(at: checked))+ }+/// An answer is about the build it was given for. If the app updates itself while Peel is closed, the/// answer about 1.0 is dropped; kept, it would read "2.0 → 2.0" under Updates Available.@Test func forgetsAnAnswerAboutAnotherBuild() {diff --git a/Peel/Model/AppLibrary.swift b/Peel/Model/AppLibrary.swiftindex 8707ce67..6e403182 100644--- a/Peel/Model/AppLibrary.swift+++ b/Peel/Model/AppLibrary.swift@@ -103,6 +103,9 @@ final class AppLibrary {}}var appsCheckingForUpdates: Set<InstalledApp.ID> { updateRounds.checking }+ /// Whether a round has asked about apps since Peel opened. The first one also asks about every app whose answer is+ /// a day old, whatever its schedule says, so opening Peel shows what came out meanwhile.+ private var hasAskedSinceLaunch = false/// The apps with an update when the current round of checks began. The menu bar shows them until the round/// ends, rather than a count that climbs as answers arrive seconds apart, and the list draws only them first.private var heldUpdates: Set<InstalledApp.ID>? {@@ -600,6 +603,8 @@ final class AppLibrary {// What Homebrew says lasts only a day after its last check, so its casks decide again in every round.applyHomebrewStatuses()let now = Date.now+ let isFirstRound = !force && !hasAskedSinceLaunch && !targets.isEmpty+ if isFirstRound { hasAskedSinceLaunch = true }// An app is checked on a schedule kept by its identifier, so an app with none is left to Homebrew's answer.let wanted = targets.filter { app inguard app.bundleIdentifier != nil, isAskedAboutUpdates(app) else { return false }@@ -608,7 +613,9 @@ final class AppLibrary {guard !appsCheckingForUpdates.contains(app.id) else { return false }// An update whose notes are still to be asked for is checked now rather than on its next turn.let notesWait = releaseNotes.asks(about: updateStatuses[app.id], of: app, with: updatePreferences)- return remembered(app)?.schedule.isDue(at: now) ?? true || notesWait+ let saved = remembered(app)+ let isDue = saved?.schedule.isDue(at: now) ?? true+ return isDue || notesWait || isFirstRound && saved?.isADayOld(at: now) == true}// The list's own entry, not the caller's: a page that was open through an upgrade still holds the old build..map { app in apps.first { $0.id == app.id } ?? app }diff --git a/PeelTests/AppLibraryTests.swift b/PeelTests/AppLibraryTests.swiftindex dd313aa3..93676dbd 100644--- a/PeelTests/AppLibraryTests.swift+++ b/PeelTests/AppLibraryTests.swift@@ -611,6 +611,64 @@ private nonisolated final class TestClock: Sendable {#expect(library.releaseNotes.asks("org.example.fed", version: "1.1"))}+ /// What an earlier launch kept about `app`: up to date two days ago, and due again only in two days.+ private func keepAnAnswerTwoDaysOld(about app: InstalledApp, in defaults: UserDefaults) {+ let day: TimeInterval = 24 * 60 * 60+ let answered = Date.now - 2 * day+ let schedule = UpdateSchedule.next(+ after: .upToDate, following: UpdateSchedule.next(after: .upToDate, from: answered - 2 * day), from: answered+ )+ var memories = UpdateMemories()+ memories.keep(UpdateMemory(status: .upToDate, schedule: schedule, checked: answered, describing: app), for: app)+ defaults.set(memories.data, forKey: SettingsKey.updateMemory)+ }++ private let newerFeed = Data("""+ <rss xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"><channel><item>\+ <enclosure url="https://feed.example.com/u.zip" sparkle:version="101" sparkle:shortVersionString="1.1" />\+ </item></channel></rss>+ """.utf8)++ @Test func theFirstRoundSinceLaunchAsksAgainAboutAnAnswerADayOld() async throws {+ let folder = FileManager.default.temporaryDirectory.appending(path: "PeelTests-\(UUID().uuidString)")+ let bundle = try caskApp("Fed", in: folder, feed: "https://feed.example.com/appcast.xml")+ defer { try? FileManager.default.removeItem(at: folder) }+ let made = try MadeUpDefaults()+ defer { made.forget() }+ AppcastProtocol.body.withLock { $0 = newerFeed }+ let earlier = library(with: made.defaults, notesIn: folder)+ #expect(await earlier.reveal([bundle]))+ let app = try #require(earlier.apps.first { $0.bundleIdentifier == "org.example.fed" })+ keepAnAnswerTwoDaysOld(about: app, in: made.defaults)++ let library = library(with: made.defaults, notesIn: folder)+ #expect(await library.reveal([bundle]))+ await library.checkForUpdates([app])+ #expect(library.hasUpdate(app))+ }++ @Test func aLaterRoundLeavesAnAnswerADayOldToItsSchedule() async throws {+ let folder = FileManager.default.temporaryDirectory.appending(path: "PeelTests-\(UUID().uuidString)")+ let bundle = try caskApp("Fed", in: folder, feed: "https://feed.example.com/appcast.xml")+ let other = try caskApp("Calm", in: folder)+ defer { try? FileManager.default.removeItem(at: folder) }+ let made = try MadeUpDefaults()+ defer { made.forget() }+ AppcastProtocol.body.withLock { $0 = newerFeed }+ let earlier = library(with: made.defaults, notesIn: folder)+ #expect(await earlier.reveal([bundle]))+ let app = try #require(earlier.apps.first { $0.bundleIdentifier == "org.example.fed" })+ keepAnAnswerTwoDaysOld(about: app, in: made.defaults)++ let library = library(with: made.defaults, notesIn: folder)+ #expect(await library.reveal([other]))+ let calm = try #require(library.apps.first { $0.bundleIdentifier == "org.example.calm" })+ await library.checkForUpdates([calm])+ #expect(await library.reveal([bundle]))+ await library.checkForUpdates([app])+ #expect(!library.hasUpdate(app))+ }+@Test func anUpToDateNoCheckRenewsSaysNothingAfterTheLongestWait() async throws {let folder = FileManager.default.temporaryDirectory.appending(path: "PeelTests-\(UUID().uuidString)")let bundle = try caskApp("Fed", in: folder, feed: "https://feed.example.com/appcast.xml")