Ignore prerelease updates

This commit is contained in:
Max Goedjen 2020-09-20 20:25:04 -07:00
parent b0ae3c3eb7
commit 3801510731
No known key found for this signature in database
GPG Key ID: E58C21DD77B9B8E8
2 changed files with 6 additions and 3 deletions

View File

@ -44,6 +44,7 @@ extension Updater {
func evaluate(release: Release) {
guard !userIgnored(release: release) else { return }
guard !release.prerelease else { return }
let latestVersion = semVer(from: release.name)
let currentVersion = semVer(from: Bundle.main.infoDictionary!["CFBundleShortVersionString"] as! String)
for (latest, current) in zip(latestVersion, currentVersion) {
@ -85,11 +86,13 @@ extension Updater {
public struct Release: Codable {
public let name: String
public let prerelease: Bool
public let html_url: URL
public let body: String
public init(name: String, html_url: URL, body: String) {
public init(name: String, prerelease: Bool, html_url: URL, body: String) {
self.name = name
self.prerelease = prerelease
self.html_url = html_url
self.body = body
}

View File

@ -11,9 +11,9 @@ class PreviewUpdater: UpdaterProtocol {
case .none:
self.update = nil
case .advisory:
self.update = Release(name: "10.10.10", html_url: URL(string: "https://example.com")!, body: "Some regular update")
self.update = Release(name: "10.10.10", prerelease: false, html_url: URL(string: "https://example.com")!, body: "Some regular update")
case .critical:
self.update = Release(name: "10.10.10", html_url: URL(string: "https://example.com")!, body: "Critical Security Update")
self.update = Release(name: "10.10.10", prerelease: false, html_url: URL(string: "https://example.com")!, body: "Critical Security Update")
}
}