mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-16 06:46:09 +00:00
macos: hook up our new update controller
This commit is contained in:
@@ -99,11 +99,10 @@ class AppDelegate: NSObject,
|
||||
)
|
||||
|
||||
/// Manages updates
|
||||
let updaterController: SPUStandardUpdaterController
|
||||
let updaterDelegate: UpdaterDelegate = UpdaterDelegate()
|
||||
|
||||
/// Update view model for UI display
|
||||
@Published private(set) var updateViewModel = UpdateViewModel()
|
||||
let updateController = UpdateController()
|
||||
var updateViewModel: UpdateViewModel {
|
||||
updateController.viewModel
|
||||
}
|
||||
|
||||
/// The elapsed time since the process was started
|
||||
var timeSinceLaunch: TimeInterval {
|
||||
@@ -130,15 +129,6 @@ class AppDelegate: NSObject,
|
||||
}
|
||||
|
||||
override init() {
|
||||
updaterController = SPUStandardUpdaterController(
|
||||
// Important: we must not start the updater here because we need to read our configuration
|
||||
// first to determine whether we're automatically checking, downloading, etc. The updater
|
||||
// is started later in applicationDidFinishLaunching
|
||||
startingUpdater: false,
|
||||
updaterDelegate: updaterDelegate,
|
||||
userDriverDelegate: nil
|
||||
)
|
||||
|
||||
super.init()
|
||||
|
||||
ghostty.delegate = self
|
||||
@@ -183,7 +173,7 @@ class AppDelegate: NSObject,
|
||||
ghosttyConfigDidChange(config: ghostty.config)
|
||||
|
||||
// Start our update checker.
|
||||
updaterController.startUpdater()
|
||||
updateController.startUpdater()
|
||||
|
||||
// Register our service provider. This must happen after everything is initialized.
|
||||
NSApp.servicesProvider = ServiceProvider()
|
||||
@@ -810,12 +800,12 @@ class AppDelegate: NSObject,
|
||||
// defined by our "auto-update" configuration (if set) or fall back to Sparkle
|
||||
// user-based defaults.
|
||||
if Bundle.main.infoDictionary?["SUEnableAutomaticChecks"] as? Bool == false {
|
||||
updaterController.updater.automaticallyChecksForUpdates = false
|
||||
updaterController.updater.automaticallyDownloadsUpdates = false
|
||||
updateController.updater.automaticallyChecksForUpdates = false
|
||||
updateController.updater.automaticallyDownloadsUpdates = false
|
||||
} else if let autoUpdate = config.autoUpdate {
|
||||
updaterController.updater.automaticallyChecksForUpdates =
|
||||
updateController.updater.automaticallyChecksForUpdates =
|
||||
autoUpdate == .check || autoUpdate == .download
|
||||
updaterController.updater.automaticallyDownloadsUpdates =
|
||||
updateController.updater.automaticallyDownloadsUpdates =
|
||||
autoUpdate == .download
|
||||
}
|
||||
|
||||
@@ -1008,7 +998,8 @@ class AppDelegate: NSObject,
|
||||
}
|
||||
|
||||
@IBAction func checkForUpdates(_ sender: Any?) {
|
||||
UpdateSimulator.permissionRequest.simulate(with: updateViewModel)
|
||||
updateController.checkForUpdates()
|
||||
//UpdateSimulator.permissionRequest.simulate(with: updateViewModel)
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user