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
Show what is new in an app's waiting update
Țugui Dragoș4418a9fcd050
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex f069b938..f50aaaf5 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -220,6 +220,7 @@ where a Homebrew install takes them from.| `~/Library/Application Support/Peel/dock-tiles.json` | The Dock icons an uninstall took out, and where each was, so History puts them back with their app. || `~/Library/Application Support/Peel/app-folders.json` | The folders the user chose for Peel to look for apps in, beside the Applications folders. || `~/Library/Application Support/Peel/homebrew.json` | The `brew` the user chose for a Homebrew in a folder of its own, which the app and `peel` run. |+| `~/Library/Application Support/Peel/release-notes.json` | What is new in each update that waits, as the app's own sources say it, so its page shows it with no connection. || `/private/var/db/com.tuguidragos.Peel.Helper/` | The helper's ledger of what it moved. || Peel's preferences | Settings, the day Peel was installed, what each tool found the last time it looked, and the last answer of each update check. |diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex bd4bcf95..bf803f7b 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -4502,12 +4502,6 @@},"%@ · ^[%lld vulnerability](inflect: true)" : {"localizations" : {- "en" : {- "stringUnit" : {- "state" : "new",- "value" : "%1$@ · ^[%2$lld vulnerability](inflect: true)"- }- },"cs" : {"variations" : {"plural" : {@@ -4556,6 +4550,12 @@}}},+ "en" : {+ "stringUnit" : {+ "state" : "new",+ "value" : "%1$@ · ^[%2$lld vulnerability](inflect: true)"+ }+ },"es" : {"variations" : {"plural" : {@@ -51214,12 +51214,6 @@},"Homebrew’s scan found these in version %@, installed on this Mac. Homebrew offers %@: once it is installed, scan again to see which of these it fixes." : {"localizations" : {- "en" : {- "stringUnit" : {- "state" : "new",- "value" : "Homebrew’s scan found these in version %1$@, installed on this Mac. Homebrew offers %2$@: once it is installed, scan again to see which of these it fixes."- }- },"cs" : {"stringUnit" : {"state" : "translated",@@ -51232,6 +51226,12 @@"value" : "Der Scan von Homebrew hat diese Sicherheitslücken in der auf diesem Mac installierten Version %@ gefunden. Homebrew bietet Version %@ an: Sobald sie installiert ist, scanne erneut, um zu sehen, welche davon diese Version behebt."}},+ "en" : {+ "stringUnit" : {+ "state" : "new",+ "value" : "Homebrew’s scan found these in version %1$@, installed on this Mac. Homebrew offers %2$@: once it is installed, scan again to see which of these it fixes."+ }+ },"es" : {"stringUnit" : {"state" : "translated",@@ -127073,6 +127073,218 @@}}},+ "Show Less" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Zobrazit méně"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Weniger anzeigen"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mostrar menos"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "En afficher moins"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mostra meno"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "表示を減らす"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "간략히 보기"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Toon minder"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Pokaż mniej"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mostrar Menos"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Afișați mai puțin"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Показать меньше"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Visa mindre"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Daha Az Göster"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Показати менше"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "更少内容"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "顯示較少"+ }+ }+ }+ },+ "Show More" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Zobrazit více"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mehr anzeigen"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mostrar más"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "En afficher plus"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mostra altro"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "表示を増やす"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "더 보기"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Toon meer"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Pokaż więcej"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Mostrar Mais"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Afișați mai mult"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Показать еще"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Visa mer"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Daha Fazla Göster"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Показати більше"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "更多内容"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "顯示較多"+ }+ }+ }+ },"Show Note" : {"localizations" : {"cs" : {@@ -141389,108 +141601,108 @@}}},- "The address written inside the app, and wherever it redirects." : {+ "The address written inside the app, and wherever it redirects. For an update that waits, also the page of release notes the feed names, once per version." : {"localizations" : {"cs" : {"stringUnit" : {"state" : "translated",- "value" : "Adresa zapsaná uvnitř aplikace a všechny adresy, na které přesměrovává."+ "value" : "Adresa zapsaná uvnitř aplikace a všechny adresy, na které přesměrovává. U čekající aktualizace také stránka s poznámkami k vydání, kterou uvádí kanál, jednou pro každou verzi."}},"de" : {"stringUnit" : {"state" : "translated",- "value" : "Die Adresse, die in der App steht, und wohin sie weiterleitet."+ "value" : "Die Adresse, die in der App steht, und wohin sie weiterleitet. Bei einem ausstehenden Update außerdem die vom Feed genannte Seite mit den Versionshinweisen, einmal pro Version."}},"es" : {"stringUnit" : {"state" : "translated",- "value" : "La dirección escrita dentro de la app, y el lugar al que redirija."+ "value" : "La dirección escrita dentro de la app, y el lugar al que redirija. Para una actualización pendiente, también la página de notas de la versión que indique el canal, una vez por versión."}},"fr" : {"stringUnit" : {"state" : "translated",- "value" : "L’adresse inscrite dans l’app, et celle vers laquelle elle redirige."+ "value" : "L’adresse inscrite dans l’app, et celle vers laquelle elle redirige. Pour une mise à jour en attente, Peel consulte aussi la page des notes de mise à jour indiquée par le flux, une fois par version."}},"it" : {"stringUnit" : {"state" : "translated",- "value" : "L’indirizzo scritto all’interno dell’app, e ovunque esso reindirizzi."+ "value" : "L’indirizzo scritto all’interno dell’app, e ovunque esso reindirizzi. Per un aggiornamento in attesa, anche la pagina che il feed indica per le note della versione, una volta per ogni versione."}},"ja" : {"stringUnit" : {"state" : "translated",- "value" : "アプリ内に記載されたアドレスと、そのリダイレクト先です。"+ "value" : "アプリ内に記載されたアドレスと、そのリダイレクト先です。アップデートが待機中の場合は、フィードに記載されたリリースノートのページにも、バージョンごとに1回アクセスします。"}},"ko" : {"stringUnit" : {"state" : "translated",- "value" : "앱 안에 적힌 주소와, 그 주소가 리디렉션하는 모든 곳입니다."+ "value" : "앱 안에 적힌 주소와, 그 주소가 리디렉션하는 모든 곳입니다. 대기 중인 업데이트가 있으면 피드에 적힌 릴리즈 노트 페이지에도 버전마다 한 번씩 연결합니다."}},"nl" : {"stringUnit" : {"state" : "translated",- "value" : "Het adres dat in de app staat, en waar dat ook naar doorverwijst."+ "value" : "Het adres dat in de app staat, en waar dat ook naar doorverwijst. Bij een wachtende update ook de pagina met versienotities die de feed noemt, één keer per versie."}},"pl" : {"stringUnit" : {"state" : "translated",- "value" : "Adres zapisany w aplikacji oraz miejsca, do których przekierowuje."+ "value" : "Adres zapisany w aplikacji oraz miejsca, do których przekierowuje. W przypadku czekającego uaktualnienia także strona z informacjami o wersji podana w kanale, raz dla każdej wersji."}},"pt" : {"stringUnit" : {"state" : "translated",- "value" : "O endereço escrito dentro do app, e qualquer endereço para onde ele redirecione."+ "value" : "O endereço escrito dentro do app, e qualquer endereço para onde ele redirecione. Para uma atualização pendente, também a página de notas de lançamento que o feed indica, uma vez por versão."}},"ro" : {"stringUnit" : {"state" : "translated",- "value" : "Adresa scrisă în aplicație și orice loc spre care redirecționează aceasta."+ "value" : "Adresa scrisă în aplicație și orice loc spre care redirecționează aceasta. Pentru o actualizare în așteptare, și pagina cu notele de publicare pe care o indică fluxul, câte o dată pentru fiecare versiune."}},"ru" : {"stringUnit" : {"state" : "translated",- "value" : "Адрес, записанный внутри приложения, и адрес, на который он перенаправляет."+ "value" : "Адрес, записанный внутри приложения, и адрес, на который он перенаправляет. Для ожидающего обновления также страница с заметками к выпуску, указанная в ленте, один раз для каждой версии."}},"sv" : {"stringUnit" : {"state" : "translated",- "value" : "Adressen som står i appen, och dit den omdirigerar."+ "value" : "Adressen som står i appen, och dit den omdirigerar. Även sidan med versionsanmärkningar som flödet anger för en väntande uppdatering, en gång per version."}},"tr" : {"stringUnit" : {"state" : "translated",- "value" : "Uygulamanın içinde yazılı adres ve bu adresin yönlendirdiği her yer."+ "value" : "Uygulamanın içinde yazılı adres ve bu adresin yönlendirdiği her yer. Bekleyen bir güncelleme için ayrıca akışın belirttiği çıkış notları sayfası, her sürüm için bir kez."}},"uk" : {"stringUnit" : {"state" : "translated",- "value" : "Адреса, записана всередині програми, і будь-яка адреса, куди вона перенаправляє."+ "value" : "Адреса, записана всередині програми, і будь-яка адреса, куди вона перенаправляє. Для оновлення, яке очікує, також сторінка з примітками до випуску, яку вказує стрічка, один раз для кожної версії."}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "写在App内部的地址,以及它重定向到的任何地址。"+ "value" : "写在App内部的地址,以及它重定向到的任何地址。对于等待中的更新,还包括更新源中指明的发布说明页面,每个版本访问一次。"}},"zh-Hant" : {"stringUnit" : {"state" : "translated",- "value" : "寫在App內的網址,以及它重新導向的任何位置。"+ "value" : "寫在App內的網址,以及它重新導向的任何位置。對於等待中的更新項目,也包括Feed中指定的版本附註頁面,每個版本一次。"}}}@@ -152627,6 +152839,112 @@}}},+ "This update came with no notes." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Tato aktualizace přišla bez poznámek."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Zu diesem Update wurden keine Versionshinweise mitgeliefert."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Esta actualización ha llegado sin notas."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Cette mise à jour n’est accompagnée d’aucune note."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Questo aggiornamento non è accompagnato da note."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "このアップデートにはリリースノートが付いていません。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "이 업데이트에는 릴리즈 노트가 함께 제공되지 않았습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Deze update kwam zonder notities."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Do tego uaktualnienia nie dołączono informacji o wersji."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Esta atualização veio sem notas."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Această actualizare a venit fără note de publicare."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Это обновление пришло без заметок к выпуску."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Den här uppdateringen kom utan versionsanmärkningar."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Bu güncellemeyle birlikte hiçbir not gelmedi."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "До цього оновлення не додано приміток."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "此更新没有附带说明。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "此更新沒有附帶任何附註。"+ }+ }+ }+ },"This uses one of Apple’s names" : {"localizations" : {"cs" : {@@ -164360,6 +164678,112 @@}}},+ "What’s New in %@" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Novinky ve verzi %@"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Neue Funktionen in Version %@"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Novedades de la versión %@"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nouveautés de la version %@"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Novità della versione %@"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "バージョン%@の新機能"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "버전 %@의 새로운 기능"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nieuw in %@"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Co nowego w wersji %@"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Novidades da Versão %@"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Noutăți în versiunea %@"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Что нового в версии %@"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nyheter i version %@"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "%@ Sürümündeki Yenilikler"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Що нового у версії %@"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "版本%@新功能"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "版本%@的新功能"+ }+ }+ }+ },"When Tab finds several completions, it opens a menu you move through with the arrow keys." : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCore/Updates/ReleaseNotesMemory.swift b/Packages/PeelCore/Sources/PeelCore/Updates/ReleaseNotesMemory.swiftnew file mode 100644index 00000000..af1fce60--- /dev/null+++ b/Packages/PeelCore/Sources/PeelCore/Updates/ReleaseNotesMemory.swift@@ -0,0 +1,61 @@+public import Foundation++/// What is new in each waiting update, by app, kept so a page can show it with no connection and asked for once per+/// version.+public struct ReleaseNotesMemory: Sendable, Equatable, Codable {+ private struct Entry: Sendable, Equatable, Codable {+ let version: String+ /// Nil once asked for and none were given.+ let notes: ReleaseNotes?+ }++ private var entries: [String: Entry] = [:]++ public init() {}++ /// The notes of the update `identifier`'s app is waiting for, `version`, when they were found.+ public func notes(of identifier: String, version: String) -> ReleaseNotes? {+ entries[identifier].flatMap { $0.version == version ? $0.notes : nil }+ }++ /// Whether the notes of `version` are still to be asked for: nobody asked yet, or no server answered.+ public func asks(_ identifier: String, version: String) -> Bool {+ entries[identifier]?.version != version+ }++ public mutating func record(_ lookup: ReleaseNotesLookup, of identifier: String, version: String) {+ switch lookup {+ case .found(let notes): entries[identifier] = Entry(version: version, notes: notes)+ case .notGiven: entries[identifier] = Entry(version: version, notes: nil)+ case .unanswered: break+ }+ }++ /// Forgets the notes of every update that no longer waits. `waiting` maps an app to the version its update brings.+ public mutating func keep(only waiting: [String: String]) {+ entries = entries.filter { waiting[$0.key] == $0.value.version }+ }+}++/// The file the notes are kept in, in Peel's own folder. They can always be asked for again, so a file that cannot be+/// read starts over empty.+public struct ReleaseNotesStore: Sendable {+ public let url: URL++ public init(url: URL = PeelFolder.url.appending(path: "release-notes.json")) {+ self.url = url+ }++ @concurrent+ public func load() async -> ReleaseNotesMemory {+ guard let data = BoundedRead.data(at: url) else { return ReleaseNotesMemory() }+ return (try? JSONDecoder().decode(ReleaseNotesMemory.self, from: data)) ?? ReleaseNotesMemory()+ }++ @concurrent+ public func save(_ memory: ReleaseNotesMemory) async {+ guard let data = try? JSONEncoder().encode(memory) else { return }+ try? FileManager.default.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)+ try? data.write(to: url, options: .atomic)+ }+}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/ReleaseNotesMemoryTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/ReleaseNotesMemoryTests.swiftnew file mode 100644index 00000000..6f3e9a04--- /dev/null+++ b/Packages/PeelCore/Tests/PeelCoreTests/ReleaseNotesMemoryTests.swift@@ -0,0 +1,49 @@+import Foundation+@testable import PeelCore+import Testing++struct ReleaseNotesMemoryTests {+ private let notes = ReleaseNotes("New search", format: .plainText)!++ @Test func asksOnceForTheNotesOfEachVersion() {+ var memory = ReleaseNotesMemory()+ #expect(memory.asks("org.example.editor", version: "2.0"))++ memory.record(.notGiven, of: "org.example.editor", version: "2.0")+ #expect(!memory.asks("org.example.editor", version: "2.0"))+ #expect(memory.notes(of: "org.example.editor", version: "2.0") == nil)++ memory.record(.unanswered, of: "org.example.editor", version: "3.0")+ #expect(memory.asks("org.example.editor", version: "3.0"), "a server that did not answer is asked again")++ memory.record(.found(notes), of: "org.example.editor", version: "3.0")+ #expect(!memory.asks("org.example.editor", version: "3.0"))+ #expect(memory.notes(of: "org.example.editor", version: "3.0") == notes)+ #expect(memory.notes(of: "org.example.editor", version: "2.0") == nil)+ }++ @Test func forgetsTheNotesOfAnUpdateNoLongerWaiting() {+ var memory = ReleaseNotesMemory()+ memory.record(.found(notes), of: "org.example.editor", version: "2.0")+ memory.record(.found(notes), of: "org.example.viewer", version: "5.0")++ memory.keep(only: ["org.example.editor": "2.0", "org.example.viewer": "5.1"])++ #expect(memory.notes(of: "org.example.editor", version: "2.0") == notes)+ #expect(memory.asks("org.example.viewer", version: "5.0"))+ }++ @Test func keepsTheNotesAcrossLaunches() async throws {+ let directory = try TemporaryDirectory()+ let store = ReleaseNotesStore(url: directory.url.appending(path: "Peel/release-notes.json"))+ #expect(await store.load() == ReleaseNotesMemory())++ var memory = ReleaseNotesMemory()+ memory.record(.found(notes), of: "org.example.editor", version: "2.0")+ await store.save(memory)+ #expect(await store.load() == memory)++ try Data("not notes".utf8).write(to: store.url)+ #expect(await store.load() == ReleaseNotesMemory(), "notes can always be asked for again")+ }+}diff --git a/Peel/Model/AppLibrary.swift b/Peel/Model/AppLibrary.swiftindex 7e8d9421..6fd64a1d 100644--- a/Peel/Model/AppLibrary.swift+++ b/Peel/Model/AppLibrary.swift@@ -151,6 +151,9 @@ final class AppLibrary {var isFiltering: Bool { !sources.isEmpty || selectedDeveloper != nil || showsOnlyUnused }private var memory = UpdateMemoryStore.load()+ /// What is new in each waiting update, read at launch, so a page shows it with no connection too.+ private(set) var releaseNotes = ReleaseNotesMemory()+ private let releaseNotesStore = ReleaseNotesStore()/// Apps shown from outside the scanned folders, such as one in Downloads or in the Trash. Kept apart,/// because the next reading of the folders doesn't find them and would drop their row and their page.private var revealed: [InstalledApp] = []@@ -196,6 +199,9 @@ final class AppLibrary {func load() async {isLoading = truelastRead = .now+ if !hasLoaded {+ releaseNotes = await releaseNotesStore.load()+ }let found = await scanRun.run { await AppCatalog.scan() }if let found {keepUnreadable(of: found)@@ -529,7 +535,9 @@ final class AppLibrary {guard !force else { return true }// Already being checked by another round: a second answer could double the wait for the next check.guard !appsCheckingForUpdates.contains(app.id) else { return false }- return memory[app.bundleIdentifier]?.schedule.isDue(at: now) ?? true+ // An update whose notes were never asked for is checked once now rather than on its next turn.+ let notesWait = updateStatuses[app.id]?.version.map { releaseNotes.asks(app.bundleIdentifier, version: $0) }+ return memory[app.bundleIdentifier]?.schedule.isDue(at: now) ?? true || notesWait == 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 }@@ -541,6 +549,8 @@ final class AppLibrary {let checker = updateCheckerlet preference = updateSourcelet casks = casks+ let notesBefore = releaseNotes+ var notesToAsk: [ReleaseNotesQuestion] = []await withTaskGroup(of: (InstalledApp.ID, UpdateAnswer).self) { group invar pending = wanted.makeIterator()@@ -580,6 +590,14 @@ final class AppLibrary {describing: app,developer: answer.developer ?? memory[identifier]?.developer)+ // Only an answer that found this update can say what is new in it; a failed one keeps what was known.+ if case .updateAvailable(let version, _, _) = kept, answer.status == kept {+ if let notes = answer.notes {+ releaseNotes.record(.found(notes), of: identifier, version: version)+ } else if releaseNotes.asks(identifier, version: version) {+ notesToAsk.append(ReleaseNotesQuestion(app: app, answer: answer, version: version))+ }+ }if let app = pending.next() {_ = group.addTaskUnlessCancelled {(app.id, await checker.answer(for: app, preference: preference, casks: casks))@@ -589,6 +607,47 @@ final class AppLibrary {}guard !Task.isCancelled, updateRounds.isCurrent(round) else { return }UpdateMemoryStore.save(memory)+ await ask(notesToAsk, checker: checker)+ var waiting: [String: String] = [:]+ for app in apps {+ if let version = updateStatuses[app.id]?.version {+ waiting[app.bundleIdentifier] = version+ }+ }+ releaseNotes.keep(only: waiting)+ if releaseNotes != notesBefore {+ await releaseNotesStore.save(releaseNotes)+ }+ }++ /// What is new in the update `app` is waiting for, when it is known.+ func releaseNotes(of app: InstalledApp) -> ReleaseNotes? {+ updateStatuses[app.id]?.version.flatMap { releaseNotes.notes(of: app.bundleIdentifier, version: $0) }+ }++ /// An update whose answer did not say what is new in it.+ private struct ReleaseNotesQuestion: Sendable {+ let app: InstalledApp+ let answer: UpdateAnswer+ let version: String+ }++ /// Asks the app's own addresses for the notes the round's answers did not carry, a few at a time.+ private func ask(_ questions: [ReleaseNotesQuestion], checker: UpdateChecker) async {+ await withTaskGroup(of: (ReleaseNotesQuestion, ReleaseNotesLookup).self) { group in+ var pending = questions.makeIterator()+ func askNext() {+ guard let question = pending.next() else { return }+ group.addTask { (question, await checker.releaseNotes(for: question.app, answer: question.answer)) }+ }+ for _ in 0..<Self.concurrentUpdateChecks {+ askNext()+ }+ while let (question, lookup) = await group.next() {+ releaseNotes.record(lookup, of: question.app.bundleIdentifier, version: question.version)+ askNext()+ }+ }}/// The user's update settings as one value. The command line reads the same settings from the same keys,diff --git a/Peel/Views/AppPageHeader.swift b/Peel/Views/AppPageHeader.swiftindex 6fd883fe..3b0c0743 100644--- a/Peel/Views/AppPageHeader.swift+++ b/Peel/Views/AppPageHeader.swift@@ -72,9 +72,29 @@ struct AppPageHeader: View {if let privacyReset {outcome(of: privacyReset)}+ if let releaseNotesBox {+ releaseNotesBox+ }}}+ /// What is new in the update that waits, or where the app says it. The store's page is already the App Store+ /// button, and a cask's homepage is offered as what it is.+ private var releaseNotesBox: ReleaseNotesBox? {+ guard waitingVersion != nil, let status = library.updateStatuses[plan.app.id],+ let version = status.displayVersion+ else { return nil }+ let notes = library.releaseNotes(of: plan.app)+ let link = status.source == .appStore ? nil : status.releaseNotes+ guard notes != nil || link != nil else { return nil }+ return ReleaseNotesBox(+ version: version,+ notes: notes,+ link: link,+ linkTitle: status.source == .homebrew ? "Homepage" : "Release Notes"+ )+ }+private var moreMenu: some View {Menu {if let notes = library.updateStatuses[plan.app.id]?.releaseNotes {diff --git a/Peel/Views/Homebrew/HomebrewDetailView.swift b/Peel/Views/Homebrew/HomebrewDetailView.swiftindex c2c0ef5d..ad8fb953 100644--- a/Peel/Views/Homebrew/HomebrewDetailView.swift+++ b/Peel/Views/Homebrew/HomebrewDetailView.swift@@ -135,6 +135,14 @@ struct HomebrewDetailView: View {}}+ if let (version, notes) = caskNotes {+ Section {+ ReleaseNotesView(notes: notes)+ } header: {+ Text("What’s New in \(version)")+ }+ }+if let advisory {HomebrewVulnerabilitySections(advisory: advisory, package: package)}@@ -165,6 +173,16 @@ struct HomebrewDetailView: View {homebrew.advisory(for: package)}+ /// What is new in the version Homebrew offers for a cask, as the app it installed says.+ private var caskNotes: (String, ReleaseNotes)? {+ guard package.kind == .cask, package.isOutdated,+ let app = library.apps.first(where: { library.cask(for: $0)?.id == package.id }),+ let notes = library.releaseNotes(of: app),+ let version = library.updateStatuses[app.id]?.displayVersion+ else { return nil }+ return (version, notes)+ }+/// Said where Peel hands a cask's command to Terminal: `brew` asks for an administrator's password with `sudo`,/// which needs a terminal, and Peel runs it without one.private let needsTerminal: LocalizedStringResource = "Homebrew needs an administrator’s password for this, and only Terminal can ask for it. Copy the command, then run it in Terminal."diff --git a/Peel/Views/ReleaseNotesView.swift b/Peel/Views/ReleaseNotesView.swiftnew file mode 100644index 00000000..d8874769--- /dev/null+++ b/Peel/Views/ReleaseNotesView.swift@@ -0,0 +1,113 @@+import PeelCore+import SwiftUI++/// What is new in a waiting update, as its notes say it: headings, paragraphs and lists, cut to a few lines until+/// the person asks for the rest.+struct ReleaseNotesView: View {+ let notes: ReleaseNotes+ @State private var blocks: [ReleaseNotes.Block] = []+ @State private var isLong = false+ @State private var isExpanded = false++ nonisolated private static let shortHeight: CGFloat = 132++ var body: some View {+ VStack(alignment: .leading, spacing: 6) {+ content+ .fixedSize(horizontal: false, vertical: true)+ .onGeometryChange(for: Bool.self) { $0.size.height > Self.shortHeight } action: { isLong = $0 }+ .frame(maxHeight: isLong && !isExpanded ? Self.shortHeight : nil, alignment: .top)+ .clipped()+ .mask {+ if isLong && !isExpanded {+ VStack(spacing: 0) {+ Color.black+ LinearGradient(colors: [.black, .clear], startPoint: .top, endPoint: .bottom)+ .frame(height: 28)+ }+ } else {+ Color.black+ }+ }+ if isLong {+ Button {+ isExpanded.toggle()+ } label: {+ Text(isExpanded ? "Show Less" : "Show More")+ .minimumTarget()+ }+ .buttonStyle(.link)+ }+ }+ .font(.callout)+ .motion(value: isExpanded)+ // Reading HTML takes a moment, so it is read away from the page and only again when the notes change.+ .task(id: notes) {+ let notes = notes+ blocks = await Task.detached { notes.blocks }.value+ }+ }++ private var content: some View {+ VStack(alignment: .leading, spacing: 6) {+ ForEach(Array(blocks.enumerated()), id: \.offset) { _, block in+ switch block {+ case .heading(let words):+ Text(words)+ .fontWeight(.semibold)+ .accessibilityAddTraits(.isHeader)+ case .paragraph(let words):+ Text(words)+ case .item(let words, let depth):+ HStack(alignment: .firstTextBaseline, spacing: 6) {+ Text(verbatim: "•")+ .accessibilityHidden(true)+ Text(words)+ }+ .padding(.leading, CGFloat(depth) * 14)+ }+ }+ }+ .textSelection(.enabled)+ .frame(maxWidth: .infinity, alignment: .leading)+ }+}++/// The panel an app's page shows under its update: what is new in the version that waits, or, when no notes came+/// with the update, where the app says it.+struct ReleaseNotesBox: View {+ let version: String+ let notes: ReleaseNotes?+ let link: URL?+ let linkTitle: LocalizedStringResource++ var body: some View {+ VStack(alignment: .leading, spacing: 8) {+ HStack(alignment: .firstTextBaseline, spacing: 8) {+ Text("What’s New in \(version)")+ .font(.callout.weight(.semibold))+ .accessibilityAddTraits(.isHeader)+ Spacer(minLength: 8)+ if let link {+ Link(destination: link) {+ Text(linkTitle)+ .minimumTarget()+ }+ .font(.callout)+ .help(Text(verbatim: link.absoluteString))+ }+ }+ if let notes {+ ReleaseNotesView(notes: notes)+ } else {+ Text("This update came with no notes.")+ .font(.callout)+ .foregroundStyle(.secondary)+ }+ }+ .padding(.horizontal, 12)+ .padding(.vertical, 10)+ .frame(maxWidth: .infinity, alignment: .leading)+ .background(.quaternary, in: .rect(cornerRadius: 8))+ }+}diff --git a/Peel/Views/Settings/PrivacySettingsView.swift b/Peel/Views/Settings/PrivacySettingsView.swiftindex f4d1209d..e8ca86ea 100644--- a/Peel/Views/Settings/PrivacySettingsView.swift+++ b/Peel/Views/Settings/PrivacySettingsView.swift@@ -32,7 +32,7 @@ struct PrivacySettingsView: View {hostRow(Text(verbatim: host.address), host.purpose)}// Not an address, so unlike the host names above, this name is translated.- hostRow(Text("Each app’s own update feed"), "The address written inside the app, and wherever it redirects.")+ hostRow(Text("Each app’s own update feed"), "The address written inside the app, and wherever it redirects. For an update that waits, also the page of release notes the feed names, once per version.")LabeledContent {Toggle(isOn: $checksForAppUpdates) { EmptyView() }.labelsHidden()diff --git a/README.md b/README.mdindex c0dd2852..bb67cc1b 100644--- a/README.md+++ b/README.md@@ -99,8 +99,9 @@ Peel is free and open source, and it speaks English and 17 other languages.- **Its Dock icon too, if you want.** Peel can take the app's icon out of the Dock, where it would stay as aquestion mark, and History puts it back where it was when you put the app back.- **Updates for your apps.** Peel checks your apps for new versions, through the update feed each app names or the- App Store for apps bought there. Skip This Version and Never Check This App keep it quiet about the ones you- want left alone.+ App Store for apps bought there, and shows what is new in the version that waits, as the app's own notes say it,+ with no connection too. Skip This Version and Never Check This App keep it quiet about the ones you want left+ alone.### Free up disk space@@ -261,8 +262,11 @@ it.Peel sends no analytics and has no account. On its own, it goes online only to check your apps for updates, and youcan turn that off. Each check asks one app's own update feed about that app alone, or the App Store about an app-bought there, and says only that Peel is asking: not which version, not your macOS, and not your languages. Every-check uses https, and a feed that sends it elsewhere is followed only to another https address. Homebrew goes online+bought there, and says only that Peel is asking: not which version, not your macOS, and not your languages. For an+update that waits, Peel also reads the page of release notes the app's feed names, and the app's own feed when Homebrew+found the update, once per version, and keeps the notes so they show with no connection. Nothing in them is loaded or+run: Peel shows their text, and a link in them opens only when you click it. Every check uses https, and a feed that+sends it elsewhere is followed only to another https address. Homebrew goes onlineonly when you ask it to update, upgrade, or scan for vulnerabilities, and that scan is the one time a list of what isinstalled leaves your Mac: for each Homebrew formula it checks, where its code comes from (the address of its sourcerepository and the release tag, or a package's name) and its version, sent to `api.osv.dev`. Your own Homebrew@@ -284,7 +288,7 @@ Settings > Privacy lists the same places.| `formulae.brew.sh` | Homebrew's list of packages, when you ask Homebrew to update or upgrade. || `ghcr.io` | Where Homebrew downloads the packages it upgrades. A cask comes from its maker's own address. || `api.osv.dev` | The database of known vulnerabilities that Homebrew's scan checks your formulae against. |-| Each app's own update feed | The address written inside the app, such as a Sparkle feed, and wherever it redirects. |+| Each app's own update feed | The address written inside the app, such as a Sparkle feed, and wherever it redirects. For an update that waits, also the page of release notes the feed names, once per version. |</details>