You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
740 B
22 lines
740 B
import Combine
|
|
import Sparkle
|
|
|
|
/// Sparkle-Updates gegen `SUFeedURL` aus der Info.plist: automatische Prüfung
|
|
/// im Hintergrund plus „Nach Updates suchen …“ im App-Menü.
|
|
final class Updater: ObservableObject {
|
|
@Published private(set) var canCheckForUpdates = false
|
|
|
|
private let controller = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)
|
|
private var cancellable: AnyCancellable?
|
|
|
|
init() {
|
|
cancellable = controller.updater.publisher(for: \.canCheckForUpdates)
|
|
.receive(on: DispatchQueue.main)
|
|
.sink { [weak self] in self?.canCheckForUpdates = $0 }
|
|
}
|
|
|
|
func checkForUpdates() {
|
|
controller.checkForUpdates(nil)
|
|
}
|
|
}
|