mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-27 05:04:27 +00:00
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).
39 lines
1.8 KiB
Objective-C
39 lines
1.8 KiB
Objective-C
//
|
|
// SPUUpdateDriver.h
|
|
// Sparkle
|
|
//
|
|
// Created by Mayur Pawashe on 3/15/16.
|
|
// Copyright © 2016 Sparkle Project. All rights reserved.
|
|
//
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@protocol SPUResumableUpdate;
|
|
|
|
typedef void (^SPUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, id<SPUResumableUpdate> _Nullable resumableUpdate);
|
|
|
|
// This protocol describes an update driver that drives updates
|
|
// An update driver may have multiple levels of other controller components (eg: basic update driver, core based update driver, ui based update driver, appcast driver, etc)
|
|
// The update driver and the components the driver has communicates via parameter passing and delegation..
|
|
// The old Sparkle architecture communicated via subclassing and method overriding, but this lead to bugs due to high coupling, and complexity of not being aware of methods being executed.
|
|
// The newer architecture is still complex but should be more reliable to maintain and extend.
|
|
@protocol SPUUpdateDriver <NSObject>
|
|
|
|
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders preventingInstallerInteraction:(BOOL)preventsInstallerInteraction completion:(SPUUpdateDriverCompletion)completionBlock;
|
|
|
|
- (void)resumeInstallingUpdateWithCompletion:(SPUUpdateDriverCompletion)completionBlock;
|
|
|
|
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate completion:(SPUUpdateDriverCompletion)completionBlock;
|
|
|
|
@property (nonatomic, readonly) BOOL showingUpdate;
|
|
|
|
// A likely implementation of -abortUpdate is invoking -abortUpdateWithError: by passing nil
|
|
- (void)abortUpdate;
|
|
|
|
// This should be invoked on the update driver to finish the update driver's work
|
|
- (void)abortUpdateWithError:(NSError * _Nullable)error;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|