mirror of
https://github.com/X1a0He/Adobe-Downloader.git
synced 2025-11-25 11:18:53 +08:00
35 lines
853 B
Swift
35 lines
853 B
Swift
//
|
|
// CheckForUpdatesViewModel.swift
|
|
// Adobe Downloader
|
|
//
|
|
// Created by X1a0He on 11/6/24.
|
|
//
|
|
|
|
import SwiftUI
|
|
import Sparkle
|
|
|
|
final class CheckForUpdatesViewModel: ObservableObject {
|
|
@Published var canCheckForUpdates = false
|
|
|
|
init(updater: SPUUpdater) {
|
|
updater.publisher(for: \.canCheckForUpdates)
|
|
.assign(to: &$canCheckForUpdates)
|
|
}
|
|
}
|
|
|
|
struct CheckForUpdatesView: View {
|
|
@ObservedObject private var checkForUpdatesViewModel: CheckForUpdatesViewModel
|
|
private let updater: SPUUpdater
|
|
|
|
init(updater: SPUUpdater) {
|
|
self.updater = updater
|
|
|
|
self.checkForUpdatesViewModel = CheckForUpdatesViewModel(updater: updater)
|
|
}
|
|
|
|
var body: some View {
|
|
Button("检查更新...", action: updater.checkForUpdates)
|
|
.disabled(!checkForUpdatesViewModel.canCheckForUpdates)
|
|
}
|
|
}
|