Skip to content

Commit

Permalink
Update Firefox version getter
Browse files Browse the repository at this point in the history
  • Loading branch information
dz0ny committed Apr 11, 2024
1 parent 96c8e58 commit 3b56e55
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Pareto/Checks/Firefox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion Pareto/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>5439</string>
<string>5441</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down

0 comments on commit 3b56e55

Please sign in to comment.