diff --git a/Kit/plugins/Updater.swift b/Kit/plugins/Updater.swift index 658b6661..88179db8 100644 --- a/Kit/plugins/Updater.swift +++ b/Kit/plugins/Updater.swift @@ -69,9 +69,9 @@ public class Updater { observation?.invalidate() } - public func check(completion: @escaping (_ result: version_s?, _ error: Error?) -> Void) { + public func check(force: Bool = false, completion: @escaping (_ result: version_s?, _ error: Error?) -> Void) { let diff = (Int(Date().timeIntervalSince1970) - self.lastCheckTS) / 60 - if diff <= 10 { + if !force && diff <= 10 { completion(nil, "last check was \(diff) minutes ago, stopping...") return } diff --git a/Stats/Views/AppSettings.swift b/Stats/Views/AppSettings.swift index 640daf4e..1abb32d2 100644 --- a/Stats/Views/AppSettings.swift +++ b/Stats/Views/AppSettings.swift @@ -203,7 +203,7 @@ class ApplicationSettings: NSStackView { // MARK: - actions @objc func updateAction(_ sender: NSObject) { - updater.check { result, error in + updater.check(force: true, completion: { result, error in if error != nil { debug("error updater.check(): \(error!.localizedDescription)") return @@ -218,7 +218,7 @@ class ApplicationSettings: NSStackView { self.updateWindow.open(version) return }) - } + }) } @objc private func toggleUpdateInterval(_ sender: NSMenuItem) {