mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-27 05:04:27 +00:00
Merge pull request #1726 from zorgiepoo/cancheckforupdates
This commit is contained in:
16 files changed
+39
-131
No files matched your search
@@ -218,7 +218,6 @@
|
||||
725F97841C8AA90000265BE4 /* SUPopUpTitlebarUserDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 725F97831C8AA90000265BE4 /* SUPopUpTitlebarUserDriver.m */; };
|
||||
725F97A51C8B304D00265BE4 /* SUInstallUpdateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 725F97A31C8B304D00265BE4 /* SUInstallUpdateViewController.m */; };
|
||||
725F97A61C8B304D00265BE4 /* SUInstallUpdateViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 725F97A41C8B304D00265BE4 /* SUInstallUpdateViewController.xib */; };
|
||||
725F97A81C8B42D700265BE4 /* SPUStandardUserDriverProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 725F97A71C8B42D700265BE4 /* SPUStandardUserDriverProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
7267E5751D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E56F1D3D895B00D1BF90 /* SUBinaryDeltaApply.m */; };
|
||||
7267E5761D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E56F1D3D895B00D1BF90 /* SUBinaryDeltaApply.m */; };
|
||||
7267E5771D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */; };
|
||||
@@ -1195,7 +1194,6 @@
|
||||
725F97A21C8B304D00265BE4 /* SUInstallUpdateViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUInstallUpdateViewController.h; sourceTree = "<group>"; };
|
||||
725F97A31C8B304D00265BE4 /* SUInstallUpdateViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUInstallUpdateViewController.m; sourceTree = "<group>"; };
|
||||
725F97A41C8B304D00265BE4 /* SUInstallUpdateViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUInstallUpdateViewController.xib; sourceTree = "<group>"; };
|
||||
725F97A71C8B42D700265BE4 /* SPUStandardUserDriverProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUStandardUserDriverProtocol.h; sourceTree = "<group>"; };
|
||||
7267E56E1D3D895B00D1BF90 /* SUBinaryDeltaApply.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUBinaryDeltaApply.h; path = Autoupdate/SUBinaryDeltaApply.h; sourceTree = SOURCE_ROOT; };
|
||||
7267E56F1D3D895B00D1BF90 /* SUBinaryDeltaApply.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUBinaryDeltaApply.m; path = Autoupdate/SUBinaryDeltaApply.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E5701D3D895B00D1BF90 /* SUBinaryDeltaCommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUBinaryDeltaCommon.h; path = Autoupdate/SUBinaryDeltaCommon.h; sourceTree = SOURCE_ROOT; };
|
||||
@@ -2125,7 +2123,6 @@
|
||||
725CB9581C7121830064365A /* SPUStandardUserDriver.h */,
|
||||
725CB9591C7121830064365A /* SPUStandardUserDriver.m */,
|
||||
726E4A361C89116000C57C6A /* SPUStandardUserDriverDelegate.h */,
|
||||
725F97A71C8B42D700265BE4 /* SPUStandardUserDriverProtocol.h */,
|
||||
726DF88D1C84277500188804 /* SPUStatusCompletionResults.h */,
|
||||
725CB9561C7120410064365A /* SPUUserDriver.h */,
|
||||
725F97791C8A896F00265BE4 /* SPUUserDriverCoreComponent.h */,
|
||||
@@ -2425,7 +2422,6 @@
|
||||
7246E0A31C83B685003B4E75 /* SPUStandardUpdaterController.h in Headers */,
|
||||
725CB95A1C7121830064365A /* SPUStandardUserDriver.h in Headers */,
|
||||
726E4A371C89116000C57C6A /* SPUStandardUserDriverDelegate.h in Headers */,
|
||||
725F97A81C8B42D700265BE4 /* SPUStandardUserDriverProtocol.h in Headers */,
|
||||
726DF88E1C84277600188804 /* SPUStatusCompletionResults.h in Headers */,
|
||||
72B767DA1C9CD2E400A07552 /* SPUUIBasedUpdateDriver.h in Headers */,
|
||||
7229E1B61C97C91100CB50D0 /* SPUUpdateDriver.h in Headers */,
|
||||
|
||||
+4
-3
@@ -19,7 +19,8 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class SPUUpdater;
|
||||
@protocol SPUUserDriver, SPUStandardUserDriverProtocol, SPUUpdaterDelegate, SPUStandardUserDriverDelegate;
|
||||
@class SPUStandardUserDriver;
|
||||
@protocol SPUUserDriver, SPUUpdaterDelegate, SPUStandardUserDriverDelegate;
|
||||
|
||||
/*!
|
||||
A controller class that instantiates a SPUUpdater and allows binding UI to it.
|
||||
@@ -67,7 +68,7 @@ SU_EXPORT @interface SPUStandardUpdaterController : NSObject
|
||||
This is nil before being loaded from the nib.
|
||||
You may access this property after your application has finished launching, or after your window controller has finished loading.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) id <SPUStandardUserDriverProtocol> userDriver;
|
||||
@property (nonatomic, readonly, nullable) SPUStandardUserDriver *userDriver;
|
||||
|
||||
/*!
|
||||
Use initWithUpdaterDelegate:userDriverDelegate: instead.
|
||||
@@ -94,7 +95,7 @@ SU_EXPORT @interface SPUStandardUpdaterController : NSObject
|
||||
/*!
|
||||
Validates if the menu item for checkForUpdates: can be invoked or not
|
||||
|
||||
This validates the menu item by checking -[SPUStandardUserDriver canCheckForUpdates]
|
||||
This validates the menu item by checking -SPUUpdater.canCheckForUpdates
|
||||
*/
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)item;
|
||||
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
@interface SPUStandardUpdaterController ()
|
||||
|
||||
@property (nonatomic) SPUUpdater *updater;
|
||||
@property (nonatomic) id <SPUStandardUserDriverProtocol> userDriver;
|
||||
@property (nonatomic) SPUStandardUserDriver *userDriver;
|
||||
@property (nonatomic) BOOL initializedUpdater;
|
||||
|
||||
@end
|
||||
@@ -56,7 +56,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
self.initializedUpdater = YES;
|
||||
|
||||
NSBundle *hostBundle = [NSBundle mainBundle];
|
||||
id <SPUUserDriver, SPUStandardUserDriverProtocol> userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle delegate:self.userDriverDelegate];
|
||||
SPUStandardUserDriver *userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle delegate:self.userDriverDelegate];
|
||||
self.updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle applicationBundle:hostBundle userDriver:userDriver delegate:self.updaterDelegate];
|
||||
self.userDriver = userDriver;
|
||||
|
||||
@@ -93,7 +93,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)item
|
||||
{
|
||||
if ([item action] == @selector(checkForUpdates:)) {
|
||||
return self.userDriver.canCheckForUpdates;
|
||||
return self.updater.canCheckForUpdates;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
Vendored
+1
-2
@@ -15,7 +15,6 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
#import "SPUUserDriver.h"
|
||||
#import "SPUStandardUserDriverProtocol.h"
|
||||
#import "SUExport.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@@ -25,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/*!
|
||||
Sparkle's standard built-in user driver for updater interactions
|
||||
*/
|
||||
SU_EXPORT @interface SPUStandardUserDriver : NSObject <SPUUserDriver, SPUStandardUserDriverProtocol>
|
||||
SU_EXPORT @interface SPUStandardUserDriver : NSObject <SPUUserDriver>
|
||||
|
||||
/*!
|
||||
Initializes a Sparkle's standard user driver for user update interactions
|
||||
|
||||
Vendored
-9
@@ -61,15 +61,6 @@
|
||||
- (void)showCanCheckForUpdates:(BOOL)canCheckForUpdates
|
||||
{
|
||||
assert(NSThread.isMainThread);
|
||||
|
||||
[self.coreComponent showCanCheckForUpdates:canCheckForUpdates];
|
||||
}
|
||||
|
||||
- (BOOL)canCheckForUpdates
|
||||
{
|
||||
assert(NSThread.isMainThread);
|
||||
|
||||
return self.coreComponent.canCheckForUpdates;
|
||||
}
|
||||
|
||||
#pragma mark Update Permission
|
||||
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
//
|
||||
// SPUStandardUserDriverProtocol.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 3/5/16.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#if __has_feature(modules)
|
||||
#if __has_warning("-Watimport-in-framework-header")
|
||||
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||
#endif
|
||||
@import Foundation;
|
||||
#else
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
||||
|
||||
@protocol SPUStandardUserDriverDelegate;
|
||||
|
||||
/*!
|
||||
Protocol for Sparkle's standard built-in user driver for updater interactions.
|
||||
|
||||
Other user drivers may wish to implement this protocol.
|
||||
Note that this protocol does not adopt SUUserDriver because one may want to *only* export properties from this protocol.
|
||||
*/
|
||||
@protocol SPUStandardUserDriverProtocol <NSObject>
|
||||
|
||||
/*!
|
||||
Indicates whether or not an update is in progress as far as the user's perspective is concerned
|
||||
|
||||
A typical application may rely on this property for its check for updates menu item validation
|
||||
*/
|
||||
@property (nonatomic, readonly) BOOL canCheckForUpdates;
|
||||
|
||||
@end
|
||||
Vendored
+11
@@ -103,6 +103,17 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
*/
|
||||
- (void)checkForUpdateInformation;
|
||||
|
||||
/*!
|
||||
A property indicating whether or not updates can be checked.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
*/
|
||||
@property (nonatomic, readonly) BOOL canCheckForUpdates;
|
||||
|
||||
/*!
|
||||
A property indicating whether or not to check for updates automatically.
|
||||
|
||||
|
||||
Vendored
+12
-3
@@ -56,6 +56,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@property (nonatomic) BOOL startedUpdater;
|
||||
@property (nonatomic, copy) void (^preStartedScheduledUpdateBlock)(void);
|
||||
@property (nonatomic, nullable) id<SPUResumableUpdate> resumableUpdate;
|
||||
@property (nonatomic) BOOL canCheckForUpdates;
|
||||
|
||||
@property (nonatomic, copy) NSDate *updateLastCheckedDate;
|
||||
|
||||
@@ -80,6 +81,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@synthesize startedUpdater = _startedUpdater;
|
||||
@synthesize preStartedScheduledUpdateBlock = _preStartedScheduledUpdateBlock;
|
||||
@synthesize resumableUpdate = _resumableUpdate;
|
||||
@synthesize canCheckForUpdates = _canCheckForUpdates;
|
||||
@synthesize updateLastCheckedDate = _updateLastCheckedDate;
|
||||
@synthesize loggedATSWarning = _loggedATSWarning;
|
||||
@synthesize loggedDSAWarning = _loggedDSAWarning;
|
||||
@@ -349,13 +351,20 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
[self scheduleNextUpdateCheckFiringImmediately:NO];
|
||||
}
|
||||
|
||||
- (void)setCanCheckForUpdates:(BOOL)canCheckForUpdates
|
||||
{
|
||||
_canCheckForUpdates = canCheckForUpdates;
|
||||
|
||||
[self.userDriver showCanCheckForUpdates:canCheckForUpdates];
|
||||
}
|
||||
|
||||
- (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately
|
||||
{
|
||||
[self.updaterTimer invalidate];
|
||||
|
||||
BOOL automaticallyCheckForUpdates = [self automaticallyChecksForUpdates];
|
||||
|
||||
[self.userDriver showCanCheckForUpdates:!automaticallyCheckForUpdates];
|
||||
[self setCanCheckForUpdates:!automaticallyCheckForUpdates];
|
||||
|
||||
if (!automaticallyCheckForUpdates) {
|
||||
if ([self.delegate respondsToSelector:@selector(updaterWillIdleSchedulingUpdates:)]) {
|
||||
@@ -367,7 +376,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
if (firingImmediately) {
|
||||
[self checkForUpdatesInBackground];
|
||||
} else {
|
||||
[self.userDriver showCanCheckForUpdates:YES];
|
||||
[self setCanCheckForUpdates:YES];
|
||||
|
||||
[self retrieveNextUpdateCheckInterval:^(NSTimeInterval updateCheckInterval) {
|
||||
// This callback is asynchronous, so the timer may be set. Invalidate to make sure it isn't.
|
||||
@@ -563,7 +572,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
};
|
||||
|
||||
[self.userDriver showCanCheckForUpdates:NO];
|
||||
[self setCanCheckForUpdates:NO];
|
||||
|
||||
if (installerInProgress) {
|
||||
[self.driver resumeInstallingUpdateWithCompletion:completionBlock];
|
||||
|
||||
Vendored
-43
@@ -47,9 +47,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* 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.
|
||||
* For example, this can be used for menu item validation on the "Check for Updates" action.
|
||||
*
|
||||
* This can be called from any thread.
|
||||
*/
|
||||
- (void)showCanCheckForUpdates:(BOOL)canCheckForUpdates;
|
||||
|
||||
@@ -61,8 +58,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
*
|
||||
* @param request The update permission request.
|
||||
* @param reply A reply with a update permission response.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showUpdatePermissionRequest:(SPUUpdatePermissionRequest *)request reply:(void (^)(SUUpdatePermissionResponse *))reply;
|
||||
|
||||
@@ -74,8 +69,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* @param updateCheckStatusCompletion A reply indicating whether the initiated update check is done or canceled.
|
||||
* Attempts to canceling can be made before -dismissUserInitiatedUpdateCheck is invoked. Replying with SPUUserInitiatedCheckDone
|
||||
* on the other hand should not be done until -dismissUserInitiatedUpdateCheck is invoked.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showUserInitiatedUpdateCheckWithCompletion:(void (^)(SPUUserInitiatedCheckStatus))updateCheckStatusCompletion;
|
||||
|
||||
@@ -84,8 +77,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
*
|
||||
* Dismiss whatever was started in -showUserInitiatedUpdateCheckWithCompletion:
|
||||
* This is an appropriate time to reply with SPUUserInitiatedCheckDone if not having done so already
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)dismissUserInitiatedUpdateCheck;
|
||||
|
||||
@@ -105,8 +96,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
*
|
||||
* A reply of SPUSkipThisVersionChoice skips this particular version and won't bother the user again,
|
||||
* unless they initiate an update check themselves.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated reply:(void (^)(SPUUpdateAlertChoice))reply;
|
||||
|
||||
@@ -133,8 +122,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* A reply of SPUInstallUpdateNow installs the update immediately but does not relaunch the new update.
|
||||
* A reply of SPUDismissUpdateInstallation dismisses the update installation. Note the update will attempt to finish installation
|
||||
* after the application terminates.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showResumableUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated reply:(void (^)(SPUInstallUpdateStatus))reply;
|
||||
|
||||
@@ -154,8 +141,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
*
|
||||
* A reply of SPUSkipThisInformationalVersionChoice skips this particular version and won't bother the user again,
|
||||
* unless they initiate an update check themselves.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showInformationalUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem userInitiated:(BOOL)userInitiated reply:(void (^)(SPUInformationalUpdateAlertChoice))reply;
|
||||
|
||||
@@ -167,8 +152,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* That is, this may be invoked if the releaseNotesURL from the appcast item is non-nil.
|
||||
*
|
||||
* @param downloadData The data for the release notes that was downloaded from the new update's appcast.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showUpdateReleaseNotesWithDownloadData:(SPUDownloadData *)downloadData;
|
||||
|
||||
@@ -180,8 +163,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* That is, this may be invoked if the releaseNotesURL from the appcast item is non-nil.
|
||||
*
|
||||
* @param error The error associated with why the new update's release notes could not be downloaded.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showUpdateReleaseNotesFailedToDownloadWithError:(NSError *)error;
|
||||
|
||||
@@ -191,8 +172,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* Let the user know a new update was not found after they tried initiating an update check.
|
||||
*
|
||||
* @param acknowledgement Acknowledge to the updater that no update found was shown.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showUpdateNotFoundWithAcknowledgement:(void (^)(void))acknowledgement;
|
||||
|
||||
@@ -203,8 +182,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* aware that an update was in progress.
|
||||
*
|
||||
* @param acknowledgement Acknowledge to the updater that the error was shown.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showUpdaterError:(NSError *)error acknowledgement:(void (^)(void))acknowledgement;
|
||||
|
||||
@@ -217,8 +194,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* the download at any point before -showDownloadDidStartExtractingUpdate is invoked.
|
||||
* A reply of SPUDownloadUpdateDone signifies that the download is done, which should not be invoked until
|
||||
* -showDownloadDidStartExtractingUpdate
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showDownloadInitiatedWithCompletion:(void (^)(SPUDownloadUpdateStatus))downloadUpdateStatusCompletion;
|
||||
|
||||
@@ -228,8 +203,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* @param expectedContentLength The expected content length of the new update being downloaded.
|
||||
* An implementor should be able to handle if this value is invalid (more or less than actual content length downloaded).
|
||||
* Additionally, this method may be called more than once for the same download in rare scenarios.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showDownloadDidReceiveExpectedContentLength:(uint64_t)expectedContentLength;
|
||||
|
||||
@@ -238,8 +211,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
*
|
||||
* This may be an appropriate time to advance a visible progress indicator of the download
|
||||
* @param length The length of the data that was just downloaded
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showDownloadDidReceiveDataOfLength:(uint64_t)length;
|
||||
|
||||
@@ -251,8 +222,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
*
|
||||
* Note that an update can resume at this point after having been downloaded before,
|
||||
* so this may be called without any of the download callbacks being invoked prior.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showDownloadDidStartExtractingUpdate;
|
||||
|
||||
@@ -262,8 +231,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* Let the user know how far along the update extraction is.
|
||||
*
|
||||
* @param progress The progress of the extraction from a 0.0 to 1.0 scale
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showExtractionReceivedProgress:(double)progress;
|
||||
|
||||
@@ -279,8 +246,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* A reply of SPUInstallUpdateNow installes the update immediately but does not relaunch the new update.
|
||||
* A reply of SPUDismissUpdateInstallation dismisses the update installation. Note the update may still be installed after
|
||||
* the application terminates, however there is not a strong guarantee that this will happen.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showReadyToInstallAndRelaunch:(void (^)(SPUInstallUpdateStatus))installUpdateHandler;
|
||||
|
||||
@@ -288,8 +253,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* Show the user that the update is installing
|
||||
*
|
||||
* Let the user know that the update is currently installing. Sparkle uses this to show an indeterminate progress bar.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showInstallingUpdate;
|
||||
|
||||
@@ -301,8 +264,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
*
|
||||
* It is up to the implementor whether or not to decide to continue showing installation progress
|
||||
* or dismissing UI that won't remain obscuring other parts of the user interface.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showSendingTerminationSignal;
|
||||
|
||||
@@ -314,8 +275,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* the updater's lifetime is tied to the application it is updating.
|
||||
*
|
||||
* @param acknowledgement Acknowledge to the updater that the installation finish was shown.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)showUpdateInstallationDidFinishWithAcknowledgement:(void (^)(void))acknowledgement;
|
||||
|
||||
@@ -325,8 +284,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* Stop and tear down everything. Reply to all outstanding reply/completion blocks.
|
||||
* Dismiss all update windows, alerts, progress, etc from the user.
|
||||
* Basically, stop everything that could have been started. Sparkle may invoke this when aborting or finishing an update.
|
||||
*
|
||||
* This can be called from any thread
|
||||
*/
|
||||
- (void)dismissUpdateInstallation;
|
||||
|
||||
|
||||
Vendored
-4
@@ -21,10 +21,6 @@
|
||||
|
||||
SU_EXPORT @interface SPUUserDriverCoreComponent : NSObject
|
||||
|
||||
- (void)showCanCheckForUpdates:(BOOL)canCheckForUpdates;
|
||||
|
||||
@property (nonatomic, readonly) BOOL canCheckForUpdates;
|
||||
|
||||
- (void)registerInstallUpdateHandler:(void (^)(SPUInstallUpdateStatus))installUpdateHandler;
|
||||
- (void)installUpdateWithChoice:(SPUInstallUpdateStatus)choice;
|
||||
|
||||
|
||||
Vendored
-10
@@ -13,8 +13,6 @@
|
||||
|
||||
@interface SPUUserDriverCoreComponent ()
|
||||
|
||||
@property (nonatomic) BOOL canCheckForUpdates;
|
||||
|
||||
@property (nonatomic, copy) void (^installUpdateHandler)(SPUInstallUpdateStatus);
|
||||
@property (nonatomic, copy) void (^updateCheckStatusCompletion)(SPUUserInitiatedCheckStatus);
|
||||
@property (nonatomic, copy) void (^downloadStatusCompletion)(SPUDownloadUpdateStatus);
|
||||
@@ -24,19 +22,11 @@
|
||||
|
||||
@implementation SPUUserDriverCoreComponent
|
||||
|
||||
@synthesize canCheckForUpdates = _canCheckForUpdates;
|
||||
@synthesize installUpdateHandler = _installUpdateHandler;
|
||||
@synthesize updateCheckStatusCompletion = _updateCheckStatusCompletion;
|
||||
@synthesize downloadStatusCompletion = _downloadStatusCompletion;
|
||||
@synthesize acknowledgement = _acknowledgement;
|
||||
|
||||
#pragma mark Is Update Busy?
|
||||
|
||||
- (void)showCanCheckForUpdates:(BOOL)canCheckForUpdates
|
||||
{
|
||||
self.canCheckForUpdates = canCheckForUpdates;
|
||||
}
|
||||
|
||||
#pragma mark Install Updates
|
||||
|
||||
- (void)registerInstallUpdateHandler:(void (^)(SPUInstallUpdateStatus))installUpdateHandler
|
||||
|
||||
Vendored
+4
-2
@@ -192,7 +192,7 @@ static NSMutableDictionary *sharedUpdaters = nil;
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)item
|
||||
{
|
||||
if ([item action] == @selector(checkForUpdates:)) {
|
||||
return self.userDriver.canCheckForUpdates;
|
||||
return self.updater.canCheckForUpdates;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
@@ -214,7 +214,9 @@ static NSMutableDictionary *sharedUpdaters = nil;
|
||||
|
||||
- (BOOL)updateInProgress
|
||||
{
|
||||
return !self.userDriver.canCheckForUpdates;
|
||||
// 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;
|
||||
}
|
||||
|
||||
// Not implemented properly at the moment - leaning towards it not be in the future
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <Sparkle/Sparkle.h>
|
||||
|
||||
@interface SUPopUpTitlebarUserDriver : NSObject <SPUUserDriver, SPUStandardUserDriverProtocol>
|
||||
@interface SUPopUpTitlebarUserDriver : NSObject <SPUUserDriver>
|
||||
|
||||
- (instancetype)initWithWindow:(NSWindow *)window;
|
||||
|
||||
|
||||
@@ -103,14 +103,6 @@
|
||||
|
||||
- (void)showCanCheckForUpdates:(BOOL)canCheckForUpdates
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.coreComponent showCanCheckForUpdates:canCheckForUpdates];
|
||||
});
|
||||
}
|
||||
|
||||
- (BOOL)canCheckForUpdates
|
||||
{
|
||||
return self.coreComponent.canCheckForUpdates;
|
||||
}
|
||||
|
||||
#pragma mark Update Permission
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
@property (nonatomic) SPUUpdater *updater;
|
||||
@property (nonatomic, readonly) BOOL customUserDriver;
|
||||
@property (nonatomic) id<SPUStandardUserDriverProtocol> userDriver;
|
||||
@property (nonatomic) SPUStandardUserDriver *userDriver;
|
||||
|
||||
@end
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
NSBundle *hostBundle = [NSBundle mainBundle];
|
||||
NSBundle *applicationBundle = hostBundle;
|
||||
|
||||
id<SPUUserDriver, SPUStandardUserDriverProtocol> userDriver;
|
||||
id<SPUUserDriver> userDriver;
|
||||
if (self.customUserDriver) {
|
||||
userDriver = [[SUPopUpTitlebarUserDriver alloc] initWithWindow:self.window];
|
||||
} else {
|
||||
@@ -73,7 +73,7 @@
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
|
||||
{
|
||||
if (menuItem.action == @selector(checkForUpdates:)) {
|
||||
return self.userDriver.canCheckForUpdates;
|
||||
return self.updater.canCheckForUpdates;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
|
||||
- (void)showCanCheckForUpdates:(BOOL)canCheckForUpdates
|
||||
{
|
||||
[self.coreComponent showCanCheckForUpdates:canCheckForUpdates];
|
||||
}
|
||||
|
||||
- (void)showUpdatePermissionRequest:(SPUUpdatePermissionRequest *)__unused request reply:(void (^)(SUUpdatePermissionResponse *))reply
|
||||
|
||||
Reference in new issue
Block a user