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.

Call the update panel's Homebrew button Upgrade, so it fits beside its words

Țugui Dragoșd6c537793c2c
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 7b18ef02..a61bb07c 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -220741,112 +220741,6 @@
}
}
},
- "Upgrade with Homebrew" : {
- "localizations" : {
- "cs" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Upgradovat pomocí Homebrew"
- }
- },
- "de" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Mit Homebrew upgraden"
- }
- },
- "es" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Actualizar con Homebrew"
- }
- },
- "fr" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Mettre à niveau avec Homebrew"
- }
- },
- "it" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Aggiorna con Homebrew"
- }
- },
- "ja" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Homebrewでアップグレード"
- }
- },
- "ko" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Homebrew로 업그레이드"
- }
- },
- "nl" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Upgrade met Homebrew"
- }
- },
- "pl" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Uaktualnij za pomocą Homebrew"
- }
- },
- "pt" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Fazer Upgrade com o Homebrew"
- }
- },
- "ro" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Faceți upgrade cu Homebrew"
- }
- },
- "ru" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Обновить с помощью Homebrew"
- }
- },
- "sv" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Uppgradera med Homebrew"
- }
- },
- "tr" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Homebrew ile Yükselt"
- }
- },
- "uk" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Оновити через Homebrew"
- }
- },
- "zh-Hans" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "使用Homebrew升级"
- }
- },
- "zh-Hant" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "使用Homebrew升級"
- }
- }
- }
- },
"Upgrading…" : {
"localizations" : {
"cs" : {
diff --git a/Peel/Views/AppPageHeader.swift b/Peel/Views/AppPageHeader.swift
index e83fc877..d7ab7752 100644
--- a/Peel/Views/AppPageHeader.swift
+++ b/Peel/Views/AppPageHeader.swift
@@ -228,7 +228,7 @@ struct AppPageHeader: View {
Text("Upgrading\u{2026}")
}
} else {
- Text("Upgrade with Homebrew")
+ Text(Self.homebrewUpgrade)
}
}
.buttonStyle(.borderedProminent)
@@ -238,6 +238,8 @@ struct AppPageHeader: View {
}
}
+ static let homebrewUpgrade: LocalizedStringResource = "Upgrade"
+
private var openAppButton: some View {
Button("Open \(plan.app.name)") {
NSWorkspace.shared.open(plan.app.url)
diff --git a/PeelTests/NoticeLayoutTests.swift b/PeelTests/NoticeLayoutTests.swift
index 67378d01..c5634919 100644
--- a/PeelTests/NoticeLayoutTests.swift
+++ b/PeelTests/NoticeLayoutTests.swift
@@ -103,6 +103,22 @@ struct UpdatePanelLayoutTests {
#expect(abs(open.maxX - (frames.panel.maxX - 12)) < 1)
}
+ @Test func homebrewsUpgradeKeepsItsButtonBesideItsWords() async throws {
+ let frames = Frames()
+ let view = UpdatePanel(version: "2.0", notes: nil, link: nil) {
+ Text("Homebrew has it. Peel can run the upgrade for you.")
+ } action: {
+ Button(String(localized: AppPageHeader.homebrewUpgrade)) {}
+ .onGeometryChange(for: CGRect.self) { $0.frame(in: .named("page")) } action: {
+ frames.buttons["upgrade"] = $0
+ }
+ }
+ .measured(into: frames)
+ let upgrade = try #require(await laidOut(view, width: 500, frames: frames, buttons: 1).buttons["upgrade"])
+
+ #expect(upgrade.minY < frames.panel.midY)
+ }
+
@Test func underALongTextTheButtonStandsBelowIt() async throws {
let frames = await panel(paragraph, width: 900)
let open = try #require(frames.buttons["Open Tidewater"])