Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ public final class NativeHostApplicationController: NSObject, NSApplicationDeleg
refreshStatusMenuState()
sessionController.prepareLiveFrameStreamSampler(reason: "launch")
scheduleLaunchPermissionOnboardingIfNeeded()
scheduleLaunchUpdateCheckIfEnabled()
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(250)) { [weak self] in
self?.sessionController.refreshShareableContentCacheIfPermitted(source: "launch")
}
Expand Down Expand Up @@ -266,12 +265,6 @@ public final class NativeHostApplicationController: NSObject, NSApplicationDeleg
}
}

private func scheduleLaunchUpdateCheckIfEnabled() {
Task { @MainActor [weak self] in
self?.softwareUpdater.checkForUpdatesInBackgroundOnLaunchIfEnabled()
}
}

@discardableResult
private func presentPermissionRecoveryIfNeeded(
source: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ final class NativeHostSoftwareUpdater {

init() {
if Self.hasSparkleConfiguration {
updaterController = SPUStandardUpdaterController(
let controller = SPUStandardUpdaterController(
startingUpdater: true,
updaterDelegate: nil,
userDriverDelegate: nil)
updaterController = controller
NativeHostTelemetry.lifecycleEvent("native_host.sparkle_updater_started")
requestImmediateLaunchUpdateCheckIfEnabled(using: controller.updater)
} else {
updaterController = nil
NativeHostTelemetry.lifecycleWarning(
Expand Down Expand Up @@ -132,16 +134,19 @@ final class NativeHostSoftwareUpdater {
updaterController.checkForUpdates(sender)
}

func checkForUpdatesInBackgroundOnLaunchIfEnabled() {
guard let updater = updaterController?.updater else {
return
}
private func requestImmediateLaunchUpdateCheckIfEnabled(using updater: SPUUpdater) {
guard updater.automaticallyChecksForUpdates else {
NativeHostTelemetry.lifecycleDebug(
"native_host.sparkle_update_check_skipped",
detail: "source=launch,reason=disabled")
return
}
guard updater.sessionInProgress == false else {
NativeHostTelemetry.lifecycleDebug(
"native_host.sparkle_update_check_skipped",
detail: "source=launch,reason=session_in_progress")
return
}
updater.checkForUpdatesInBackground()
NativeHostTelemetry.lifecycleEvent(
"native_host.sparkle_update_check_scheduled",
Expand Down Expand Up @@ -174,7 +179,7 @@ final class NativeHostSoftwareUpdater {
guard let checkedAt else {
return "Never checked."
}
return "Last checked \(checkedAt.formatted(date: .abbreviated, time: .shortened))."
return "Checked \(checkedAt.formatted(date: .omitted, time: .shortened))."
}

private static func nonEmptyInfoValue(forKey key: String) -> String? {
Expand Down
Loading