From b91ab180d54b19c4d3cf9ff1e1458de813f99f7d Mon Sep 17 00:00:00 2001 From: Zorg Date: Sat, 14 Nov 2026 14:00:02 -0800 Subject: [PATCH] Don't reset impatient check date when superseding an existing update in the background Also we reset the impatient check date whenever the update is presented to the user. --- Sparkle/SPUUpdateDriver.m | 10 ++++++++-- Sparkle/SPUUpdater.m | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Sparkle/SPUUpdateDriver.m b/Sparkle/SPUUpdateDriver.m index 7ec8b19f..885cbc4d 100644 --- a/Sparkle/SPUUpdateDriver.m +++ b/Sparkle/SPUUpdateDriver.m @@ -306,7 +306,7 @@ static BOOL SPUUpdateRequiresUserAttentionBeforeDownloading(SUAppcastItem *updat // For automatic install mode, if we are resuming an installing update we will // check if impatient interval elapsed, otherwise the last impatient update check date - // will be refreshed (when downloading a new fresh update or escalating to showing UI) + // will be refreshed (when downloading a new fresh update or showing the update through the user driver) if (resumingExistingUpdate) { if (_startedResumingInstallingUpdate) { // The update has already finished preparation from a previous cycle @@ -324,7 +324,10 @@ static BOOL SPUUpdateRequiresUserAttentionBeforeDownloading(SUAppcastItem *updat [self escalateToShowingUI]; [self presentUpdateFoundWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem]; } else { - _shouldResetImpatientCheckDate = YES; + // If we didn't supersede an existing update, we will want to reset the impatient check date + if (!_startedResumingInstallingUpdate && !_startedResumingDownloadedUpdate) { + _shouldResetImpatientCheckDate = YES; + } [self downloadUpdateFromAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem inBackground:YES]; } } @@ -583,6 +586,7 @@ static BOOL SPUUpdateRequiresUserAttentionBeforeDownloading(SUAppcastItem *updat }]; _showingUpdate = YES; + _shouldResetImpatientCheckDate = YES; [self fireUpdateShownHandlerIfNeeded]; NSURL *releaseNotesURL = updateItem.releaseNotesURL; @@ -850,6 +854,8 @@ static BOOL SPUUpdateRequiresUserAttentionBeforeDownloading(SUAppcastItem *updat }]; _showingUpdate = YES; + // If the user driver dismisses the install & relaunch we will want to reset the impatient check date + _shouldResetImpatientCheckDate = YES; [self fireUpdateShownHandlerIfNeeded]; } else { // Give the delegate a chance to handle installing on quit itself, bypassing Sparkle's own UI entirely - diff --git a/Sparkle/SPUUpdater.m b/Sparkle/SPUUpdater.m index 3fb88f13..f1af027d 100644 --- a/Sparkle/SPUUpdater.m +++ b/Sparkle/SPUUpdater.m @@ -818,7 +818,8 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification [strongSelf updateLastUpdateCheckDate]; // Track the last downloaded date locally the first time the automatic update driver - // downloads an update in the background. This is later used for the impatient update check. + // downloads an update in the background, or when an update is shown to the user. + // This is later used for the impatient update check. if (shouldResetImpatientCheckDate) { strongSelf->_updateLastImpatientCheckedDate = [strongSelf lastUpdateCheckDate]; }