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.

Stop calling a downloaded update "already installed"

Țugui Dragoș79f96564b041
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 44a21ea9..931e277a 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -14540,6 +14540,112 @@
}
}
},
+ "An update %@ downloaded" : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Aktualizace stažená aplikací %@"
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ein Update, das „%@“ geladen hat"
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Una actualización que descargó %@"
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mise à jour téléchargée par %@"
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Un aggiornamento scaricato da %@"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "“%@”がダウンロードしたアップデート"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "‘%@’이(가) 다운로드한 업데이트"
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Een update die %@ heeft gedownload"
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Uaktualnienie pobrane przez aplikację %@"
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Atualização baixada por %@"
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "O actualizare descărcată de %@"
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Обновление, загруженное приложением «%@»"
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "En uppdatering som %@ har hämtat"
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%@ tarafından indirilen bir güncelleme"
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Оновлення, яке викачала програма «%@»"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "由“%@”下载的更新"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "「%@」下載的更新項目"
+ }
+ }
+ }
+ },
"And ^[%lld more app](inflect: true)." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
index f4d58f62..a221780a 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
@@ -48,6 +48,8 @@ public struct InstallerItem: Sendable, Hashable, Identifiable {
/// A name a backup gives for its device or system, such as "iPhone" or "iOS 17.2", shown as is.
case name(String)
case encrypted
+ /// The installed app that downloaded an update, which it keeps until it installs it.
+ case downloadedBy(String)
}
}
@@ -529,9 +531,9 @@ public enum Installers {
name: url.lastPathComponent,
size: size,
date: (try? url.resourceValues(forKeys: [.contentModificationDateKey]))?.contentModificationDate,
- installedApp: app?.name,
+ installedApp: nil,
isReadOnly: false,
- notes: [],
+ notes: app.map { [.downloadedBy($0.name)] } ?? [],
requiresPrivileges: FileAccess.requiresPrivilegesToRemove(url),
heldBack: heldBack(
url, seen: seen, in: place, syncsToOtherDevices: syncsToOtherDevices, openFiles: openFiles
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
index 1fd25c47..03cf6184 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
@@ -449,8 +449,9 @@ struct InstallersTests {
#expect(Set(items.keys) == [
"org.example.studio.ShipIt", "org.sparkle-project.Sparkle", "com.apple.finder.ShipIt",
])
- #expect(items["org.example.studio.ShipIt"]?.installedApp == "Studio")
- #expect(items["org.sparkle-project.Sparkle"]?.installedApp == "Notes")
+ #expect(items["org.example.studio.ShipIt"]?.installedApp == .some(nil))
+ #expect(items["org.example.studio.ShipIt"]?.notes == [.downloadedBy("Studio")])
+ #expect(items["org.sparkle-project.Sparkle"]?.notes == [.downloadedBy("Notes")])
#expect(items["org.example.studio.ShipIt"]?.heldBack == .some(nil))
#expect(items["com.apple.finder.ShipIt"]?.heldBack == .appIsRunning)
}
@@ -485,10 +486,11 @@ struct InstallersTests {
let items = Dictionary(uniqueKeysWithValues: scan.items(in: .updateDownload).map { ($0.name, $0) })
#expect(Set(items.keys) == ["notes-updater", "studio-updater", "finder-updater", "gone-updater", "tide"])
- #expect(items["notes-updater"]?.installedApp == "Notes")
- #expect(items["studio-updater"]?.installedApp == "Studio")
- #expect(items["tide"]?.installedApp == "Tide")
- #expect(items["gone-updater"]?.installedApp == nil)
+ #expect(items["notes-updater"]?.notes == [.downloadedBy("Notes")])
+ #expect(items["studio-updater"]?.notes == [.downloadedBy("Studio")])
+ #expect(items["tide"]?.notes == [.downloadedBy("Tide")])
+ #expect(items["gone-updater"]?.notes == [])
+ #expect(items.values.allSatisfy { $0.installedApp == nil })
#expect(items["notes-updater"]?.heldBack == .some(nil))
#expect(items["finder-updater"]?.heldBack == .appIsRunning)
}
diff --git a/Peel/Views/Installers/InstallerDetailView.swift b/Peel/Views/Installers/InstallerDetailView.swift
index 5ec47460..3842eb3e 100644
--- a/Peel/Views/Installers/InstallerDetailView.swift
+++ b/Peel/Views/Installers/InstallerDetailView.swift
@@ -126,6 +126,7 @@ extension InstallerItem.Note {
case .version(let version): "Version \(version)"
case .name(let name): "\(name)"
case .encrypted: "Encrypted"
+ case .downloadedBy(let app): "An update \(app) downloaded"
}
}
}