Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Keep an app's Up to date, with its day, while the checks are off

Țugui Dragoșb68b3564fd76
diff --git a/GUIDE.md b/GUIDE.md
index afe390a6..ddd9feff 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -87,8 +87,8 @@ and how to get it, [SAFETY.md](SAFETY.md) what it protects, [PRIVACY.md](PRIVACY
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.
+ updates back. Turning off Check for app updates there stops the checks, and after a week an app's Up to date, which
+ Peel then no longer renews, says the day it was found.
## Free up disk space
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index ffec02f5..ad21c1d9 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -205880,6 +205880,112 @@
}
}
},
+ "Up to date as of %@" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aktuální ke dni %@"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aktuell am %@"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Actualizada a %@"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "À jour au %@"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aggiornata al giorno %@"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@時点で最新の状態"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ 기준 최신 버전"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Up-to-date op %@"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aktualna w dniu %@"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Atualizado em %@"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Actualizată la %@"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Актуальная версия на %@"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Uppdaterad per %@"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ itibarıyla güncel"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Актуальна версія на %@"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "截至%@已是最新版本"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "截至%@已是最新版本"
+ }
+ }
+ }
+ },
"Update" : {
"localizations" : {
"cs" : {
diff --git a/Peel/Model/AppLibrary.swift b/Peel/Model/AppLibrary.swift
index 6e403182..3249c704 100644
--- a/Peel/Model/AppLibrary.swift
+++ b/Peel/Model/AppLibrary.swift
@@ -774,14 +774,18 @@ final class AppLibrary {
func shownUpdateStatus(of app: InstalledApp) -> UpdateStatus? {
// A web app updates with its website, so there is nothing to check, and nothing is said.
guard !app.isPeelItself, app.webApp == nil else { return nil }
- let shown = updatePreferences.shownStatus(updateStatuses[app.id], for: app)
- // With the checks off, an "up to date" ages unasked: past the longest wait it says nothing, unless Homebrew
- // says it now, which counts only for a day after its own check.
- guard shown == .upToDate, !defaults.isOn(SettingsKey.checksForAppUpdates, whenNeverSet: true),
- !updateChecker.stillHolds(answeredAt: lastUpdateChecks[app.id]),
+ return updatePreferences.shownStatus(updateStatuses[app.id], for: app)
+ }
+
+ /// The day the Up to date shown for `app` was found, once nothing renews it: the checks are off, the answer is past
+ /// the longest wait, and Homebrew doesn't say it now. The badge then says that day.
+ func keptUpToDate(of app: InstalledApp) -> Date? {
+ guard shownUpdateStatus(of: app) == .upToDate,
+ !defaults.isOn(SettingsKey.checksForAppUpdates, whenNeverSet: true),
+ let checked = lastUpdateChecks[app.id], !updateChecker.stillHolds(answeredAt: checked),
updateChecker.homebrewStatus(for: app, casks: casks) != .upToDate
- else { return shown }
- return nil
+ else { return nil }
+ return checked
}
/// The apps the reading of the folders found, without those shown on the list from elsewhere: what is installed,
diff --git a/Peel/Views/AppHeader.swift b/Peel/Views/AppHeader.swift
index 1d37e1b1..2e0c56fe 100644
--- a/Peel/Views/AppHeader.swift
+++ b/Peel/Views/AppHeader.swift
@@ -12,6 +12,7 @@ struct AppHeader<Actions: View>: View {
/// True when `AppLibrary.hasUpdate` is, since the page then shows the update in a panel of its own.
var hasWaitingUpdate = false
var lastCheck: Date?
+ var keptSince: Date?
let cannotCheck: CannotCheck
var total: SizeTotal?
/// True when the app frees much less than its size, because most of it is shared with another copy.
@@ -91,6 +92,7 @@ struct AppHeader<Actions: View>: View {
status: updateStatus,
isChecking: isCheckingForUpdates,
lastCheck: lastCheck,
+ keptSince: keptSince,
cannotCheck: cannotCheck
)
}
diff --git a/Peel/Views/AppPageHeader.swift b/Peel/Views/AppPageHeader.swift
index 44f8a144..dc9e9659 100644
--- a/Peel/Views/AppPageHeader.swift
+++ b/Peel/Views/AppPageHeader.swift
@@ -31,6 +31,7 @@ struct AppPageHeader: View {
isCheckingForUpdates: library.appsCheckingForUpdates.contains(plan.app.id),
hasWaitingUpdate: waitingVersion != nil,
lastCheck: library.lastUpdateChecks[plan.app.id],
+ keptSince: library.keptUpToDate(of: plan.app),
cannotCheck: library.whyItCannotCheck(plan.app),
total: plan.total,
sharesStorage: plan.appSharesStorage
diff --git a/Peel/Views/Intel/IntelDetailView.swift b/Peel/Views/Intel/IntelDetailView.swift
index a937362b..0ed4ddba 100644
--- a/Peel/Views/Intel/IntelDetailView.swift
+++ b/Peel/Views/Intel/IntelDetailView.swift
@@ -101,6 +101,7 @@ struct IntelDetailView: View {
app: app,
status: status,
isChecking: library.appsCheckingForUpdates.contains(app.id),
+ keptSince: library.keptUpToDate(of: app),
cannotCheck: library.whyItCannotCheck(app)
)
}
diff --git a/Peel/Views/UpdateStatusBadge.swift b/Peel/Views/UpdateStatusBadge.swift
index c7085838..2acd19e4 100644
--- a/Peel/Views/UpdateStatusBadge.swift
+++ b/Peel/Views/UpdateStatusBadge.swift
@@ -7,6 +7,8 @@ struct UpdateStatusBadge: View {
let isChecking: Bool
/// When a check last got an answer, which is what the note for a failed check tells the user.
var lastCheck: Date?
+ /// The day an Up to date nothing renews anymore was found (`AppLibrary.keptUpToDate`).
+ var keptSince: Date?
let cannotCheck: CannotCheck
var body: some View {
@@ -34,7 +36,13 @@ struct UpdateStatusBadge: View {
case .updateAvailable:
Badge(title: Text("Update available: \(status.displayVersion ?? "")"), systemImage: "arrow.down.circle", tint: .blue)
case .upToDate:
- if let lastCheck {
+ if let keptSince {
+ Badge(
+ title: Text("Up to date as of \(keptSince, format: .dateTime.day().month(.abbreviated).year())"),
+ systemImage: "checkmark.circle",
+ tint: .green
+ )
+ } else if let lastCheck {
upToDate.help(Text("Peel last checked \(lastCheck, format: .relative(presentation: .named))."))
} else {
upToDate
diff --git a/PeelTests/AppLibraryTests.swift b/PeelTests/AppLibraryTests.swift
index 93676dbd..e75b568a 100644
--- a/PeelTests/AppLibraryTests.swift
+++ b/PeelTests/AppLibraryTests.swift
@@ -669,7 +669,7 @@ private nonisolated final class TestClock: Sendable {
#expect(!library.hasUpdate(app))
}
- @Test func anUpToDateNoCheckRenewsSaysNothingAfterTheLongestWait() async throws {
+ @Test func anUpToDateNoCheckRenewsKeepsTheDayItWasFoundAfterTheLongestWait() 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) }
@@ -693,8 +693,11 @@ private nonisolated final class TestClock: Sendable {
made.defaults.set(false, forKey: SettingsKey.checksForAppUpdates)
clock.set(now + 24 * 60 * 60)
#expect(library.shownUpdateStatus(of: app) == .upToDate)
+ #expect(library.keptUpToDate(of: app) == nil)
clock.set(now + 30 * 24 * 60 * 60)
- #expect(library.shownUpdateStatus(of: app) == nil)
+ #expect(library.shownUpdateStatus(of: app) == .upToDate)
+ let found = try #require(library.keptUpToDate(of: app))
+ #expect(found <= Date.now && found >= now - 60)
}
@Test func theRoundRescanStartsSaysWhenItEnds() async throws {