Skip to content

Commit

Permalink
Use Apple Store version as latest release
Browse files Browse the repository at this point in the history
  • Loading branch information
dz0ny committed Nov 9, 2022
1 parent ba59ff6 commit 96430ec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Pareto/AppInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ enum AppInfo {
)
#else
static let versionStorage = try! Storage<String, Version>(
diskConfig: DiskConfig(name: "Version+Bundles", expiry: .seconds(3600 * 24)),
memoryConfig: MemoryConfig(expiry: .seconds(3600 * 24 * 2)),
diskConfig: DiskConfig(name: "Version+Bundles+v2", expiry: .seconds(3600 * 24)),
memoryConfig: MemoryConfig(expiry: .seconds(3600)),
transformer: TransformerFactory.forCodable(ofType: Version.self) // Storage<String, Version>
)
#endif
Expand Down
21 changes: 1 addition & 20 deletions Pareto/Checks/Software Updates/Slack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,6 @@ class AppSlackCheck: AppCheck {

override func getLatestVersion(completion: @escaping (String) -> Void) {
// If installed from the app store, assume it's managed via releases API
if fromAppStore {
getLatestVersionAppStore(completion: completion)
return
}

let url = viaEdgeCache("https://slack.com/release-notes/mac")
let versionRegex = Regex("<h2>Slack ?([\\.\\d]+)</h2>")
os_log("Requesting %{public}s", url)
AF.request(url).responseString(queue: AppCheck.queue, completionHandler: { response in
if response.error == nil {
let html = response.value ?? "<h2>Slack 1.23.0</h2>"
let version = versionRegex.firstMatch(in: html)?.groups.first?.value ?? "1.23.0"
os_log("%{public}s version=%{public}s", self.appBundle, version)
completion(version)
} else {
os_log("%{public}s failed: %{public}s", self.appBundle, response.error.debugDescription)
completion("0.0.0")
}

})
getLatestVersionAppStore(completion: completion)
}
}
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>5050</string>
<string>5053</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down

0 comments on commit 96430ec

Please sign in to comment.