From 3b56e554d3c243c412ea76fb23d44c96c6c3237c Mon Sep 17 00:00:00 2001 From: Janez T Date: Thu, 11 Apr 2024 14:13:57 +0200 Subject: [PATCH] Update Firefox version getter ref: https://github.com/teamniteo/pareto/issues/483 --- Pareto/Checks/Firefox.swift | 9 ++++++--- Pareto/Info.plist | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Pareto/Checks/Firefox.swift b/Pareto/Checks/Firefox.swift index 4f1a435..78db6a6 100644 --- a/Pareto/Checks/Firefox.swift +++ b/Pareto/Checks/Firefox.swift @@ -13,7 +13,10 @@ import os.log import OSLog import Version -private typealias FirefoxVersions = [String: String] + +struct FirefoxVersions: Decodable { + let LATEST_FIREFOX_VERSION: String +} class AppFirefoxCheck: AppCheck { static let sharedInstance = AppFirefoxCheck() @@ -38,11 +41,11 @@ class AppFirefoxCheck: AppCheck { } override func getLatestVersion(completion: @escaping (String) -> Void) { - let url = viaEdgeCache("https://product-details.mozilla.org/1.0/firefox_history_stability_releases.json") + let url = viaEdgeCache("https://product-details.mozilla.org/1.0/firefox_versions.json") os_log("Requesting %{public}s", url) AF.request(url).responseDecodable(of: FirefoxVersions.self, queue: AppCheck.queue) { response in if response.error == nil { - let version = response.value?.sorted(by: >).first?.0 ?? "0.0.0" + let version = response.value?.LATEST_FIREFOX_VERSION ?? "0.0.0" os_log("%{public}s version=%{public}s", self.appBundle, version) completion(version) } else { diff --git a/Pareto/Info.plist b/Pareto/Info.plist index 1a2d09e..39fe573 100644 --- a/Pareto/Info.plist +++ b/Pareto/Info.plist @@ -26,7 +26,7 @@ CFBundleVersion - 5439 + 5441 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion