From 2f783e01f0a847f0bdc1f0a3ac994caa4ed2336d Mon Sep 17 00:00:00 2001 From: Zorg Date: Thu, 15 Apr 2021 22:56:41 -0700 Subject: [PATCH] Show the present update in focus when checkForUpdates is invoked When the update is shown to the user, the menu item for checking for updates is no longer disabled. Instead it is enabled, and when invoked, will bring the update to utmost focus back to the user again. This is consistent with other options (eg Preferences...) that bring up windows. Improved user experience here is that updates are now less "lost". We (re)define properties on SPUUpdater: canCheckForUpdates - to mean that the user can check for updates (start a new update check or show the already present update frontmost) sessionInProgress - to mean if Sparkle's internal driver / scheduler is running (i.e, downloading appcast or update, showing update, starting installation). --- Sparkle/SPUAutomaticUpdateDriver.m | 5 ++ Sparkle/SPUProbingUpdateDriver.m | 5 ++ Sparkle/SPUScheduledUpdateDriver.m | 8 ++++ Sparkle/SPUStandardUserDriver.m | 16 +++---- Sparkle/SPUUIBasedUpdateDriver.h | 4 +- Sparkle/SPUUIBasedUpdateDriver.m | 12 +++-- Sparkle/SPUUpdateDriver.h | 2 + Sparkle/SPUUpdater.h | 30 ++++++++++-- Sparkle/SPUUpdater.m | 51 +++++++++++---------- Sparkle/SPUUserDriver.h | 14 +++--- Sparkle/SPUUserInitiatedUpdateDriver.m | 12 +++++ Sparkle/SUUpdateAlert.h | 3 +- Sparkle/SUUpdateAlert.m | 9 +++- Sparkle/SUUpdater.m | 2 +- TestApplication/SUPopUpTitlebarUserDriver.m | 11 ++--- sparkle-cli/SPUCommandLineUserDriver.m | 8 ++-- 16 files changed, 129 insertions(+), 63 deletions(-) diff --git a/Sparkle/SPUAutomaticUpdateDriver.m b/Sparkle/SPUAutomaticUpdateDriver.m index 0515a9d7..91f54179 100644 --- a/Sparkle/SPUAutomaticUpdateDriver.m +++ b/Sparkle/SPUAutomaticUpdateDriver.m @@ -89,6 +89,11 @@ } } +- (BOOL)showingUpdate +{ + return NO; +} + - (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently { self.willInstallSilently = willInstallSilently; diff --git a/Sparkle/SPUProbingUpdateDriver.m b/Sparkle/SPUProbingUpdateDriver.m index 965f4b71..6cd8fc3b 100644 --- a/Sparkle/SPUProbingUpdateDriver.m +++ b/Sparkle/SPUProbingUpdateDriver.m @@ -60,6 +60,11 @@ [self abortUpdate]; } +- (BOOL)showingUpdate +{ + return NO; +} + - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error { [self abortUpdateWithError:error]; diff --git a/Sparkle/SPUScheduledUpdateDriver.m b/Sparkle/SPUScheduledUpdateDriver.m index f648b607..8029c138 100644 --- a/Sparkle/SPUScheduledUpdateDriver.m +++ b/Sparkle/SPUScheduledUpdateDriver.m @@ -19,6 +19,7 @@ @property (nonatomic, readonly) SPUUIBasedUpdateDriver *uiDriver; @property (nonatomic) BOOL showedUpdate; +@property (nonatomic) BOOL showingUpdate; @end @@ -26,6 +27,7 @@ @synthesize uiDriver = _uiDriver; @synthesize showedUpdate = _showedUpdate; +@synthesize showingUpdate = _showingUpdate; - (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id )userDriver updaterDelegate:(nullable id )updaterDelegate { @@ -63,6 +65,12 @@ - (void)uiDriverDidShowUpdate { self.showedUpdate = YES; + self.showingUpdate = YES; +} + +- (void)uiDriverFinishedShowingUpdate +{ + self.showingUpdate = NO; } - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *) error diff --git a/Sparkle/SPUStandardUserDriver.m b/Sparkle/SPUStandardUserDriver.m index ec544826..db2f5de9 100644 --- a/Sparkle/SPUStandardUserDriver.m +++ b/Sparkle/SPUStandardUserDriver.m @@ -57,13 +57,6 @@ return self; } -#pragma mark Is Update Busy? - -- (void)showCanCheckForUpdates:(BOOL)canCheckForUpdates -{ - assert(NSThread.isMainThread); -} - #pragma mark Update Permission - (void)showUpdatePermissionRequest:(SPUUpdatePermissionRequest *)request reply:(void (^)(SUUpdatePermissionResponse *))reply @@ -99,9 +92,7 @@ // Only show the update alert if the app is active; otherwise, we'll wait until it is. if ([NSApp isActive]) { - if (!userInitiated) { - [self.activeUpdateAlert disableKeyboardShortcutForInstallButton]; - } + [self.activeUpdateAlert setInstallButtonFocus:userInitiated]; [self.activeUpdateAlert.window makeKeyAndOrderFront:self]; } else { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:NSApp]; @@ -195,6 +186,11 @@ [self.activeUpdateAlert showReleaseNotesFailedToDownload]; } +- (void)showUpdateInFocus +{ + [self setUpFocusForActiveUpdateAlertWithUserInitiation:YES]; +} + #pragma mark Install & Relaunch Update - (void)showReadyToInstallAndRelaunch:(void (^)(SPUInstallUpdateStatus))installUpdateHandler diff --git a/Sparkle/SPUUIBasedUpdateDriver.h b/Sparkle/SPUUIBasedUpdateDriver.h index 188822e7..bcba39d6 100644 --- a/Sparkle/SPUUIBasedUpdateDriver.h +++ b/Sparkle/SPUUIBasedUpdateDriver.h @@ -17,10 +17,12 @@ NS_ASSUME_NONNULL_BEGIN - (void)coreDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error; - (void)uiDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error; +- (void)uiDriverDidShowUpdate; +- (void)uiDriverFinishedShowingUpdate; + @optional - (void)basicDriverDidFinishLoadingAppcast; -- (void)uiDriverDidShowUpdate; @end diff --git a/Sparkle/SPUUIBasedUpdateDriver.m b/Sparkle/SPUUIBasedUpdateDriver.m index d361509c..4ab14602 100644 --- a/Sparkle/SPUUIBasedUpdateDriver.m +++ b/Sparkle/SPUUIBasedUpdateDriver.m @@ -115,6 +115,8 @@ [self.userDriver showInformationalUpdateFoundWithAppcastItem:updateItem userInitiated:self.userInitiated reply:^(SPUInformationalUpdateAlertChoice choice) { dispatch_async(dispatch_get_main_queue(), ^{ + [self.delegate uiDriverFinishedShowingUpdate]; + switch (choice) { case SPUSkipThisInformationalVersionChoice: [self.host setObject:[updateItem versionString] forUserDefaultsKey:SUSkippedVersionKey]; @@ -132,6 +134,8 @@ } else if (self.resumingDownloadedUpdate) { [self.userDriver showDownloadedUpdateFoundWithAppcastItem:updateItem userInitiated:self.userInitiated reply:^(SPUUpdateAlertChoice choice) { dispatch_async(dispatch_get_main_queue(), ^{ + [self.delegate uiDriverFinishedShowingUpdate]; + [self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey]; switch (choice) { case SPUInstallUpdateChoice: @@ -154,6 +158,8 @@ } else if (!self.resumingInstallingUpdate) { [self.userDriver showUpdateFoundWithAppcastItem:updateItem userInitiated:self.userInitiated reply:^(SPUUpdateAlertChoice choice) { dispatch_async(dispatch_get_main_queue(), ^{ + [self.delegate uiDriverFinishedShowingUpdate]; + [self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey]; switch (choice) { case SPUInstallUpdateChoice: @@ -175,15 +181,15 @@ } else { [self.userDriver showResumableUpdateFoundWithAppcastItem:updateItem userInitiated:self.userInitiated reply:^(SPUInstallUpdateStatus choice) { dispatch_async(dispatch_get_main_queue(), ^{ + [self.delegate uiDriverFinishedShowingUpdate]; + [self.host setObject:nil forUserDefaultsKey:SUSkippedVersionKey]; [self.coreDriver finishInstallationWithResponse:choice displayingUserInterface:!self.preventsInstallerInteraction]; }); }]; } - if ([self.delegate respondsToSelector:@selector(uiDriverDidShowUpdate)]) { - [self.delegate uiDriverDidShowUpdate]; - } + [self.delegate uiDriverDidShowUpdate]; if (updateItem.releaseNotesURL != nil && (![updaterDelegate respondsToSelector:@selector(updaterShouldDownloadReleaseNotes:)] || [updaterDelegate updaterShouldDownloadReleaseNotes:self.updater])) { NSURLRequest *request = [NSURLRequest requestWithURL:updateItem.releaseNotesURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30]; diff --git a/Sparkle/SPUUpdateDriver.h b/Sparkle/SPUUpdateDriver.h index b991ba99..6a451492 100644 --- a/Sparkle/SPUUpdateDriver.h +++ b/Sparkle/SPUUpdateDriver.h @@ -25,6 +25,8 @@ typedef void (^SPUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, id)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock; +@property (nonatomic, readonly) BOOL showingUpdate; + // A likely implementation of -abortUpdate is invoking -abortUpdateWithError: by passing nil - (void)abortUpdate; diff --git a/Sparkle/SPUUpdater.h b/Sparkle/SPUUpdater.h index ff896eb3..20694741 100644 --- a/Sparkle/SPUUpdater.h +++ b/Sparkle/SPUUpdater.h @@ -79,9 +79,15 @@ SU_EXPORT @interface SPUUpdater : NSObject Checks for updates, and displays progress while doing so. This is meant for users initiating an update check. + + If an update session isn't in progress, the user will be shown that a check for new updates is occurring. + If a new update is already being shown, that update will be shown to the user in active focus. + This may find a resumable update that has already been downloaded or has begun installing, or this may find a new update that can start to be downloaded if the user requests it. This will find updates that the user has opted into skipping. + + See canCheckForUpdates property which can determine if this method may be invoked. */ - (void)checkForUpdates; @@ -111,16 +117,30 @@ SU_EXPORT @interface SPUUpdater : NSObject - (void)checkForUpdateInformation; /*! - A property indicating whether or not updates can be checked. + A property indicating whether or not updates can be checked by the user. - This property is useful for determining whether update checks can be made programatically or by the user. - An update check cannot be made when an on-going update check is in progress. + An update check can be made by the user when an update session isn't in progress, or when an update is presently being shown. - Note this property does not reflect whether or not an update itself is in progress. For example, - an update check can be done to check if there's an already started update that can be resumed. + This property is suitable to use for menu item validation for seeing if -checkForUpdates can be invoked. + + Note this property does not reflect whether or not an update session is in progress. Please see sessionInProgress property instead. */ @property (nonatomic, readonly) BOOL canCheckForUpdates; +/*! + A property indicating whether or not an update session is in progress. + + An update session is in progress when the appcast is being downloaded, an update is being downloaded, + an update is being shown, or the installer is being started. An active session is when Sparkle's fired scheduler is running. + + Note an update session may be inactive even though Sparkle's installer (ran as a separate process) may be running, + or even though the update has been downloaded but the installation has been deferred. In both of these cases, an update session + may be activated and resumed at a later point (automatically or manually). + + See also canCheckForUpdates property which is more suited for menu item validation. + */ +@property (nonatomic, readonly) BOOL sessionInProgress; + /*! A property indicating whether or not to check for updates automatically. diff --git a/Sparkle/SPUUpdater.m b/Sparkle/SPUUpdater.m index 2971837e..a4b4fea1 100644 --- a/Sparkle/SPUUpdater.m +++ b/Sparkle/SPUUpdater.m @@ -55,7 +55,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification @property (nonatomic, readonly) SPUUpdaterTimer *updaterTimer; @property (nonatomic) BOOL startedUpdater; @property (nonatomic, nullable) id resumableUpdate; -@property (nonatomic) BOOL canCheckForUpdates; +@property (nonatomic) BOOL sessionInProgress; @property (nonatomic, copy) NSDate *updateLastCheckedDate; @@ -79,7 +79,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification @synthesize sparkleBundle = _sparkleBundle; @synthesize startedUpdater = _startedUpdater; @synthesize resumableUpdate = _resumableUpdate; -@synthesize canCheckForUpdates = _canCheckForUpdates; +@synthesize sessionInProgress = _sessionInProgress; @synthesize updateLastCheckedDate = _updateLastCheckedDate; @synthesize loggedATSWarning = _loggedATSWarning; @synthesize loggedDSAWarning = _loggedDSAWarning; @@ -147,12 +147,11 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification } self.startedUpdater = YES; - [self setCanCheckForUpdates:YES]; // Start updater on next update cycle so we make sure the application invoking the updater is ready // This also gives the developer a cycle to check for updates before Sparkle's update cycle scheduler kicks in dispatch_async(dispatch_get_main_queue(), ^{ - if ([self canCheckForUpdates]) { + if (!self.sessionInProgress) { [self startUpdateCycle]; } }); @@ -357,11 +356,9 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification [self scheduleNextUpdateCheckFiringImmediately:NO]; } -- (void)setCanCheckForUpdates:(BOOL)canCheckForUpdates +- (BOOL)canCheckForUpdates { - _canCheckForUpdates = canCheckForUpdates; - - [self.userDriver showCanCheckForUpdates:canCheckForUpdates]; + return self.startedUpdater && (self.driver.showingUpdate || !self.sessionInProgress); } - (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately @@ -416,11 +413,11 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification return; } - if (!self.canCheckForUpdates) { - SULog(SULogLevelError, @"Error: -checkForUpdatesInBackground called but .canCheckForUpdates == NO"); + if (self.sessionInProgress) { + SULog(SULogLevelError, @"Error: -checkForUpdatesInBackground called but .sessionInProgress == YES"); } - [self setCanCheckForUpdates:NO]; + self.sessionInProgress = YES; // We don't want the probe check to act on the driver if the updater is going near death __weak SPUUpdater *weakSelf = self; @@ -469,26 +466,34 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification - (void)checkForUpdates { - __weak SPUUpdater *weakSelf = self; + if (self.driver.showingUpdate) { + if ([self.userDriver respondsToSelector:@selector(showUpdateInFocus)]) { + [self.userDriver showUpdateInFocus]; + } + return; + } + if (!self.startedUpdater) { SULog(SULogLevelError, @"Error: checkForUpdates - updater hasn't been started yet. Please call -startUpdater: first"); return; } - if (!self.canCheckForUpdates) { - SULog(SULogLevelError, @"Error: -checkForUpdates called but .canCheckForUpdates == NO"); + if (self.sessionInProgress) { + SULog(SULogLevelError, @"Error: -checkForUpdates called but .sessionInProgress == YES"); } if (self.driver != nil) { return; } - [self setCanCheckForUpdates:NO]; + self.sessionInProgress = YES; id theUpdateDriver = [[SPUUserInitiatedUpdateDriver alloc] initWithHost:self.host applicationBundle:self.applicationBundle sparkleBundle:self.sparkleBundle updater:self userDriver:self.userDriver updaterDelegate:self.delegate]; NSString *bundleIdentifier = self.host.bundle.bundleIdentifier; assert(bundleIdentifier != nil); + + __weak SPUUpdater *weakSelf = self; [SPUProbeInstallStatus probeInstallerInProgressForHostBundleIdentifier:bundleIdentifier completion:^(BOOL installerInProgress) { dispatch_async(dispatch_get_main_queue(), ^{ SPUUpdater *strongSelf = weakSelf; @@ -514,11 +519,11 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification return; } - if (!self.canCheckForUpdates) { - SULog(SULogLevelError, @"Error: -checkForUpdateInformation called but .canCheckForUpdates == NO"); + if (self.sessionInProgress) { + SULog(SULogLevelError, @"Error: -checkForUpdateInformation called but .sessionInProgress == YES"); } - [self setCanCheckForUpdates:NO]; + self.sessionInProgress = YES; NSString *bundleIdentifier = self.host.bundle.bundleIdentifier; assert(bundleIdentifier != nil); @@ -544,7 +549,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification if( [self.delegate respondsToSelector: @selector((updaterMayCheckForUpdates:))] && ![self.delegate updaterMayCheckForUpdates:self] ) { - [self setCanCheckForUpdates:YES]; + self.sessionInProgress = NO; [self scheduleNextUpdateCheck]; return; } @@ -560,7 +565,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification SULog(SULogLevelError, @"Sparkle configuration error (%ld): %@", (long)configurationError.code, configurationError.localizedDescription); SULog(SULogLevelDefault, @"Disabling scheduled updates.."); - [self setCanCheckForUpdates:YES]; + self.sessionInProgress = NO; [self.driver abortUpdateWithError:configurationError]; self.driver = nil; @@ -575,7 +580,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification if (strongSelf != nil) { strongSelf.resumableUpdate = resumableUpdate; strongSelf.driver = nil; - [strongSelf setCanCheckForUpdates:YES]; + self.sessionInProgress = NO; [strongSelf updateLastUpdateCheckDate]; [strongSelf scheduleNextUpdateCheckFiringImmediately:shouldShowUpdateImmediately]; } @@ -591,7 +596,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification } else { // I think this is really unlikely to occur but better be safe [self.driver abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInvalidFeedURLError userInfo:@{ NSLocalizedDescriptionKey: @"Sparkle cannot form a valid feed URL." }]]; - [self setCanCheckForUpdates:YES]; + self.sessionInProgress = NO; self.driver = nil; } } @@ -608,7 +613,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification return; // not even ready yet } - if (self.canCheckForUpdates) { + if (!self.sessionInProgress) { [self cancelNextUpdateCycle]; [self scheduleNextUpdateCheck]; } diff --git a/Sparkle/SPUUserDriver.h b/Sparkle/SPUUserDriver.h index 00391c4a..9e08a0a3 100644 --- a/Sparkle/SPUUserDriver.h +++ b/Sparkle/SPUUserDriver.h @@ -32,13 +32,6 @@ NS_ASSUME_NONNULL_BEGIN */ SU_EXPORT @protocol SPUUserDriver -/*! - * Show that an update can be checked by the user or not - * - * A client may choose to update the interface letting the user know if they can check for updates. - */ -- (void)showCanCheckForUpdates:(BOOL)canCheckForUpdates; - /*! * Show an updater permission request to the user * @@ -131,6 +124,13 @@ SU_EXPORT @protocol SPUUserDriver */ - (void)showInformationalUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated reply:(void (^)(SPUInformationalUpdateAlertChoice))reply; +/*! + * Show the user currently presented update in utmost focus + * + * Sparkle uses this to make its update frontmost again + */ +- (void)showUpdateInFocus; + /*! * Show the user the release notes for the new update * diff --git a/Sparkle/SPUUserInitiatedUpdateDriver.m b/Sparkle/SPUUserInitiatedUpdateDriver.m index 5bcdaa28..499f2da3 100644 --- a/Sparkle/SPUUserInitiatedUpdateDriver.m +++ b/Sparkle/SPUUserInitiatedUpdateDriver.m @@ -18,6 +18,7 @@ @property (nonatomic, readonly) SPUUIBasedUpdateDriver *uiDriver; @property (nonatomic, readonly) id userDriver; @property (nonatomic) BOOL showingUserInitiatedProgress; +@property (nonatomic) BOOL showingUpdate; @property (nonatomic) BOOL aborted; @end @@ -26,6 +27,7 @@ @synthesize uiDriver = _uiDriver; @synthesize userDriver = _userDriver; +@synthesize showingUpdate = _showingUpdate; @synthesize showingUserInitiatedProgress = _showingUserInitiatedProgress; @synthesize aborted = _aborted; @@ -91,6 +93,16 @@ [self.uiDriver resumeUpdate:resumableUpdate completion:completionBlock]; } +- (void)uiDriverDidShowUpdate +{ + self.showingUpdate = YES; +} + +- (void)uiDriverFinishedShowingUpdate +{ + self.showingUpdate = NO; +} + - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error { [self abortUpdateWithError:error]; diff --git a/Sparkle/SUUpdateAlert.h b/Sparkle/SUUpdateAlert.h index 09f9cbf7..e737881c 100644 --- a/Sparkle/SUUpdateAlert.h +++ b/Sparkle/SUUpdateAlert.h @@ -32,7 +32,8 @@ - (IBAction)installUpdate:sender; - (IBAction)skipThisVersion:sender; - (IBAction)remindMeLater:sender; -- (void)disableKeyboardShortcutForInstallButton; + +- (void)setInstallButtonFocus:(BOOL)focus; @end diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 76fa5705..2064828c 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -133,8 +133,13 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE - (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], [self.host bundlePath]]; } -- (void)disableKeyboardShortcutForInstallButton { - self.installButton.keyEquivalent = @""; +- (void)setInstallButtonFocus:(BOOL)focus +{ + if (focus) { + self.installButton.keyEquivalent = @"\r"; + } else { + self.installButton.keyEquivalent = @""; + } } - (void)endWithSelection:(SPUUpdateAlertChoice)choice diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index 0065dde1..cb8c7efe 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -212,7 +212,7 @@ static NSMutableDictionary *sharedUpdaters = nil; { // This is not quite true -- we may be able to check / resume an update if one is in progress // But this is a close enough approximation for 1.x updater API - return !self.updater.canCheckForUpdates; + return self.updater.sessionInProgress; } // Not implemented properly at the moment - leaning towards it not be in the future diff --git a/TestApplication/SUPopUpTitlebarUserDriver.m b/TestApplication/SUPopUpTitlebarUserDriver.m index 46d58477..db6108eb 100644 --- a/TestApplication/SUPopUpTitlebarUserDriver.m +++ b/TestApplication/SUPopUpTitlebarUserDriver.m @@ -96,12 +96,6 @@ self.updateButtonAction = nil; } -#pragma mark Can Check for Updates? - -- (void)showCanCheckForUpdates:(BOOL)canCheckForUpdates -{ -} - #pragma mark Update Permission - (void)showUpdatePermissionRequest:(SPUUpdatePermissionRequest *)__unused request reply:(void (^)(SUUpdatePermissionResponse *))reply @@ -182,6 +176,11 @@ { } +- (void)showUpdateInFocus +{ + [self.window makeKeyAndOrderFront:nil]; +} + #pragma mark Install & Relaunch Update - (void)showReadyToInstallAndRelaunch:(void (^)(SPUInstallUpdateStatus))installUpdateHandler diff --git a/sparkle-cli/SPUCommandLineUserDriver.m b/sparkle-cli/SPUCommandLineUserDriver.m index 2ca61bdf..e8ba6e03 100644 --- a/sparkle-cli/SPUCommandLineUserDriver.m +++ b/sparkle-cli/SPUCommandLineUserDriver.m @@ -41,10 +41,6 @@ return self; } -- (void)showCanCheckForUpdates:(BOOL)canCheckForUpdates -{ -} - - (void)showUpdatePermissionRequest:(SPUUpdatePermissionRequest *)__unused request reply:(void (^)(SUUpdatePermissionResponse *))reply { if (self.updatePermissionResponse == nil) { @@ -138,6 +134,10 @@ reply(SPUDismissInformationalNoticeChoice); } +- (void)showUpdateInFocus +{ +} + - (void)showUpdateReleaseNotesWithDownloadData:(SPUDownloadData *)downloadData { if (self.verbose) {