Compare commits

..

No commits in common. "03c8250def2c50ea71b4cbb3087a56ab6050524c" and "20ca403d53e91dff233184df82437f1b3f756f2c" have entirely different histories.

View file

@ -148,12 +148,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}
/// icon matching the last fetched state, for operations that end
/// without triggering a refetch
func cachedStateIcon() -> String {
cachedOutdated.isEmpty ? "brewbar-uptodate" : "brewbar-outdated"
}
func restartTimer() {
refreshTimer?.invalidate() // stop running timer
refreshTimer = Timer.scheduledTimer(withTimeInterval: refreshInterval, repeats: true) { _ in
@ -316,10 +310,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
/// (current versions); the only cost is re-downloading at next install
func runCleanup(purgeCache: Bool) {
statusMenuItem.title = "Cleaning up..."
setMenuBarIcon("brewbar-updating")
runBrew(purgeCache ? "cleanup --prune=all" : "cleanup") { _, _ in
self.updateStatus(count: self.cachedOutdated.count)
self.setMenuBarIcon(self.cachedStateIcon())
}
}
@ -352,7 +344,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
statusMenuItem.title = "Upgrading..."
setMenuBarIcon("brewbar-updating")
runBrew("update") { _, _ in
// packages that turn outdated only after this brew update are not
@ -452,7 +443,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// "all up to date"; keep the cached state and its icon instead
guard success else {
self.statusMenuItem.title = "⚠️ Check failed — see Logs"
self.setMenuBarIcon(self.cachedStateIcon())
self.setMenuBarIcon(self.cachedOutdated.isEmpty ? "brewbar-uptodate" : "brewbar-outdated")
return
}
@ -505,7 +496,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func runAutoUpgrade(formulae: Bool, casks: Bool) {
statusMenuItem.title = "Auto-upgrading..."
setMenuBarIcon("brewbar-updating")
let caskNames = casks ? cachedOutdated.casks.map(\.name) : []
let upgradeCasksThenRefresh = {
@ -561,9 +551,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@objc func upgradeSingle(_ sender: NSMenuItem) {
guard let name = sender.representedObject as? String else { return }
statusMenuItem.title = "Upgrading \(name)..."
setMenuBarIcon("brewbar-updating")
let finish = {
self.cleanupAfterUpgradeIfEnabled {
self.refreshAll()
@ -604,7 +591,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
statusMenuItem.title = "Updating..."
setMenuBarIcon("brewbar-updating")
// NWPathMonitor can't see a network that is up but broken (captive
// portal, dead DNS, git host down); brew update's exit code can.
@ -612,7 +598,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
runBrew("update") { _, success in
guard success else {
self.statusMenuItem.title = "⚠️ Check failed — see Logs"
self.setMenuBarIcon(self.cachedStateIcon())
return
}
self.fetchOutdated() // ONLY place calling outdated