This commit is contained in:
Max Goedjen
2024-12-25 18:25:01 -05:00
parent 8ea8f0510c
commit 2dc317d398
26 changed files with 208 additions and 188 deletions

View File

@@ -1,20 +1,32 @@
import Foundation
import Combine
import Synchronization
import Observation
import Brief
class PreviewUpdater: UpdaterProtocol {
@Observable class PreviewUpdater: UpdaterProtocol {
var update: Release? {
_update.withLock { $0 }
}
let _update: Mutex<Release?> = .init(nil)
let update: Release?
let testBuild = false
init(update: Update = .none) {
switch update {
case .none:
self.update = nil
_update.withLock {
$0 = nil
}
case .advisory:
self.update = Release(name: "10.10.10", prerelease: false, html_url: URL(string: "https://example.com")!, body: "Some regular update")
_update.withLock {
$0 = 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", prerelease: false, html_url: URL(string: "https://example.com")!, body: "Critical Security Update")
_update.withLock {
$0 = Release(name: "10.10.10", prerelease: false, html_url: URL(string: "https://example.com")!, body: "Critical Security Update")
}
}
}