mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Pass application bundle into SPUUpdater instead of relying on delegate method
This commit is contained in:
1 parent
26107994f4
commit
29d790c63c
20 files changed
+54
-57
No files matched your search
+1
-1
@@ -41,7 +41,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
||||
|
||||
NSBundle *hostBundle = [NSBundle mainBundle];
|
||||
id <SPUUserDriver, SPUStandardUserDriverProtocol> userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:hostBundle applicationBundle:hostBundle delegate:self.userDriverDelegate];
|
||||
self.updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle userDriver:userDriver delegate:self.updaterDelegate];
|
||||
self.updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle applicationBundle:hostBundle userDriver:userDriver delegate:self.updaterDelegate];
|
||||
self.userDriver = userDriver;
|
||||
|
||||
// In the case this is being called right as an application is being launched,
|
||||
|
||||
Vendored
+2
-1
@@ -39,12 +39,13 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
* Related: See SPUStandardUpdaterController which wraps a SPUUpdater instance and is suitable for instantiating in nib files
|
||||
*
|
||||
* @param hostBundle The bundle that should be targetted for updating. This must not be nil.
|
||||
* @param applicationBundle The application bundle that should be relaunched and waited for termination. Usually this can be the same as hostBundle.
|
||||
* @param userDriver The user driver that Sparkle uses for user update interaction
|
||||
* @param delegate The delegate for SPUUpdater. This may be nil.
|
||||
*
|
||||
* This must be called on the main thread.
|
||||
*/
|
||||
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle userDriver:(id <SPUUserDriver>)userDriver delegate:(id<SPUUpdaterDelegate> _Nullable)delegate;
|
||||
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle applicationBundle:(NSBundle *)applicationBundle userDriver:(id <SPUUserDriver>)userDriver delegate:(id<SPUUpdaterDelegate> _Nullable)delegate;
|
||||
|
||||
/*!
|
||||
* Starts the updater.
|
||||
|
||||
Vendored
+10
-5
@@ -46,6 +46,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
@property (nonatomic) id <SUUpdateDriver> driver;
|
||||
@property (nonatomic, readonly) SUHost *host;
|
||||
@property (nonatomic, readonly) NSBundle *applicationBundle;
|
||||
@property (nonatomic, readonly) SPUUpdaterSettings *updaterSettings;
|
||||
@property (nonatomic, readonly) SPUUpdaterCycle *updaterCycle;
|
||||
@property (nonatomic, readonly) SPUUpdaterTimer *updaterTimer;
|
||||
@@ -66,6 +67,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@synthesize httpHeaders;
|
||||
@synthesize driver;
|
||||
@synthesize host = _host;
|
||||
@synthesize applicationBundle = _applicationBundle;
|
||||
@synthesize updaterSettings = _updaterSettings;
|
||||
@synthesize updaterCycle = _updaterCycle;
|
||||
@synthesize updaterTimer = _updaterTimer;
|
||||
@@ -85,7 +87,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
#endif
|
||||
|
||||
- (instancetype)initWithHostBundle:(NSBundle *)bundle userDriver:(id <SPUUserDriver>)userDriver delegate:(id <SPUUpdaterDelegate>)theDelegate
|
||||
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle applicationBundle:(NSBundle *)applicationBundle userDriver:(id <SPUUserDriver>)userDriver delegate:(id<SPUUpdaterDelegate> _Nullable)delegate
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
@@ -93,15 +95,16 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
// Use explicit class to use the correct bundle even when subclassed
|
||||
_sparkleBundle = [NSBundle bundleForClass:[SPUUpdater class]];
|
||||
|
||||
_host = [[SUHost alloc] initWithBundle:bundle];
|
||||
_host = [[SUHost alloc] initWithBundle:hostBundle];
|
||||
_applicationBundle = applicationBundle;
|
||||
|
||||
_updaterSettings = [[SPUUpdaterSettings alloc] initWithHostBundle:bundle];
|
||||
_updaterSettings = [[SPUUpdaterSettings alloc] initWithHostBundle:hostBundle];
|
||||
_updaterCycle = [[SPUUpdaterCycle alloc] initWithDelegate:self];
|
||||
_updaterTimer = [[SPUUpdaterTimer alloc] initWithDelegate:self];
|
||||
|
||||
_userDriver = userDriver;
|
||||
|
||||
_delegate = theDelegate;
|
||||
_delegate = delegate;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -410,6 +413,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
updateDriver =
|
||||
[[SUAutomaticUpdateDriver alloc]
|
||||
initWithHost:strongSelf.host
|
||||
applicationBundle:strongSelf.applicationBundle
|
||||
sparkleBundle:strongSelf.sparkleBundle
|
||||
updater:strongSelf
|
||||
userDriver:strongSelf.userDriver
|
||||
@@ -418,6 +422,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
updateDriver =
|
||||
[[SUScheduledUpdateDriver alloc]
|
||||
initWithHost:strongSelf.host
|
||||
applicationBundle:strongSelf.applicationBundle
|
||||
sparkleBundle:strongSelf.sparkleBundle
|
||||
updater:strongSelf
|
||||
userDriver:strongSelf.userDriver
|
||||
@@ -443,7 +448,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
return;
|
||||
}
|
||||
|
||||
id <SUUpdateDriver> theUpdateDriver = [[SUUserInitiatedUpdateDriver alloc] initWithHost:self.host sparkleBundle:self.sparkleBundle updater:self userDriver:self.userDriver updaterDelegate:self.delegate];
|
||||
id <SUUpdateDriver> theUpdateDriver = [[SUUserInitiatedUpdateDriver 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);
|
||||
|
||||
Vendored
-12
@@ -211,18 +211,6 @@ SU_EXPORT extern NSString *const SUUpdaterAppcastNotificationKey;
|
||||
*/
|
||||
- (nullable id<SUVersionComparison>)versionComparatorForUpdater:(SPUUpdater *)updater;
|
||||
|
||||
/*!
|
||||
Returns the path to the application which is used to relaunch after the update is installed.
|
||||
|
||||
The installer also waits for the termination of the application at this path.
|
||||
|
||||
The default is the path of the host bundle.
|
||||
|
||||
\param updater The updater instance.
|
||||
\return The path to the application bundle to relaunch and wait for termination, or nil if you don't want to be delegated this task.
|
||||
*/
|
||||
- (nullable NSString *)pathToRelaunchForUpdater:(SPUUpdater *)updater;
|
||||
|
||||
/*!
|
||||
Returns whether or not the updater should allow interaction with its installer
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUAutomaticUpdateDriver : NSObject <SUUpdateDriver>
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate;
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -40,7 +40,7 @@
|
||||
@synthesize updateItem = _updateItem;
|
||||
@synthesize willInstallSilently = _willInstallSilently;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
@@ -48,7 +48,7 @@
|
||||
// The user driver is only used for a termination callback
|
||||
_userDriver = userDriver;
|
||||
_updaterDelegate = updaterDelegate;
|
||||
_coreDriver = [[SUCoreBasedUpdateDriver alloc] initWithHost:host sparkleBundle:sparkleBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
_coreDriver = [[SUCoreBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle sparkleBundle:sparkleBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUCoreBasedUpdateDriver : NSObject
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SUCoreBasedUpdateDriverDelegate>)delegate;
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SUCoreBasedUpdateDriverDelegate>)delegate;
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates requiresSilentInstall:(BOOL)silentInstall completion:(SUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -53,7 +53,7 @@
|
||||
@synthesize userAgent = _userAgent;
|
||||
@synthesize downloadedUpdate = _downloadedUpdate;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SUCoreBasedUpdateDriverDelegate>)delegate
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SUCoreBasedUpdateDriverDelegate>)delegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
@@ -63,7 +63,7 @@
|
||||
assert(bundleIdentifier != nil);
|
||||
|
||||
_basicDriver = [[SUBasicUpdateDriver alloc] initWithHost:host updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
_installerDriver = [[SUInstallerDriver alloc] initWithHost:host sparkleBundle:sparkleBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
_installerDriver = [[SUInstallerDriver alloc] initWithHost:host applicationBundle:applicationBundle sparkleBundle:sparkleBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
|
||||
_host = host;
|
||||
_updater = updater;
|
||||
|
||||
Vendored
+1
-1
@@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUInstallerDriver : NSObject
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(nullable id<SPUUpdaterDelegate>)updaterDelegate delegate:(nullable id<SUInstallerDriverDelegate>)delegate;
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(nullable id<SPUUpdaterDelegate>)updaterDelegate delegate:(nullable id<SUInstallerDriverDelegate>)delegate;
|
||||
|
||||
- (void)resumeInstallingUpdateWithUpdateItem:(SUAppcastItem *)updateItem;
|
||||
|
||||
|
||||
Vendored
+14
-4
@@ -31,9 +31,16 @@
|
||||
|
||||
#define FIRST_INSTALLER_MESSAGE_TIMEOUT 7ull
|
||||
|
||||
@interface NSObject (PrivateDelegateMethods)
|
||||
|
||||
- (nullable NSString *)_pathToRelaunchForUpdater:(SPUUpdater *)updater;
|
||||
|
||||
@end
|
||||
|
||||
@interface SUInstallerDriver () <SUInstallerCommunicationProtocol>
|
||||
|
||||
@property (nonatomic, readonly) SUHost *host;
|
||||
@property (nonatomic, readonly) NSBundle *applicationBundle;
|
||||
@property (nonatomic, readonly) NSBundle *sparkleBundle;
|
||||
@property (nonatomic, weak, readonly) id<SUInstallerDriverDelegate> delegate;
|
||||
@property (nonatomic) SPUInstallerMessageType currentStage;
|
||||
@@ -58,6 +65,7 @@
|
||||
@implementation SUInstallerDriver
|
||||
|
||||
@synthesize host = _host;
|
||||
@synthesize applicationBundle = _applicationBundle;
|
||||
@synthesize sparkleBundle = _sparkleBundle;
|
||||
@synthesize delegate = _delegate;
|
||||
@synthesize currentStage = _currentStage;
|
||||
@@ -73,11 +81,12 @@
|
||||
@synthesize temporaryDirectory = _temporaryDirectory;
|
||||
@synthesize aborted = _aborted;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(id<SPUUpdaterDelegate>)updaterDelegate delegate:(nullable id<SUInstallerDriverDelegate>)delegate
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater updaterDelegate:(id<SPUUpdaterDelegate>)updaterDelegate delegate:(nullable id<SUInstallerDriverDelegate>)delegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_host = host;
|
||||
_applicationBundle = applicationBundle;
|
||||
_sparkleBundle = sparkleBundle;
|
||||
_updater = updater;
|
||||
_updaterDelegate = updaterDelegate;
|
||||
@@ -154,9 +163,10 @@
|
||||
|
||||
- (void)sendInstallationData
|
||||
{
|
||||
NSString *pathToRelaunch = [self.host bundlePath];
|
||||
if ([self.updaterDelegate respondsToSelector:@selector(pathToRelaunchForUpdater:)]) {
|
||||
NSString *relaunchPath = [self.updaterDelegate pathToRelaunchForUpdater:self.updater];
|
||||
NSString *pathToRelaunch = self.applicationBundle.bundlePath;
|
||||
// Give the delegate one more chance for determining the path to relaunch via a private API used by SUUpdater
|
||||
if ([self.updaterDelegate respondsToSelector:@selector(_pathToRelaunchForUpdater:)]) {
|
||||
NSString *relaunchPath = [(NSObject *)self.updaterDelegate _pathToRelaunchForUpdater:self.updater];
|
||||
if (relaunchPath != nil) {
|
||||
pathToRelaunch = relaunchPath;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUScheduledUpdateDriver : NSObject <SUUpdateDriver>
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate;
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -26,11 +26,11 @@
|
||||
|
||||
@synthesize uiDriver = _uiDriver;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_uiDriver = [[SUUIBasedUpdateDriver alloc] initWithHost:host sparkleBundle:sparkleBundle updater:updater userDriver:userDriver updaterDelegate:updaterDelegate delegate:self];
|
||||
_uiDriver = [[SUUIBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle sparkleBundle:sparkleBundle updater:updater userDriver:userDriver updaterDelegate:updaterDelegate delegate:self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUUIBasedUpdateDriver : NSObject
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SUUIBasedUpdateDriverDelegate>)delegate;
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SUUIBasedUpdateDriverDelegate>)delegate;
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary *)httpHeaders includesSkippedUpdates:(BOOL)includesSkippedUpdates completion:(SUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -45,7 +45,7 @@
|
||||
@synthesize resumingInstallingUpdate = _resumingInstallingUpdate;
|
||||
@synthesize resumingDownloadedUpdate = _resumingDownloadedUpdate;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SUUIBasedUpdateDriverDelegate>)delegate
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SUUIBasedUpdateDriverDelegate>)delegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
@@ -55,7 +55,7 @@
|
||||
_updaterDelegate = updaterDelegate;
|
||||
_host = host;
|
||||
|
||||
_coreDriver = [[SUCoreBasedUpdateDriver alloc] initWithHost:host sparkleBundle:sparkleBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
_coreDriver = [[SUCoreBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle sparkleBundle:sparkleBundle updater:updater updaterDelegate:updaterDelegate delegate:self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
Vendored
+5
-4
@@ -76,9 +76,9 @@ static NSMutableDictionary *sharedUpdaters = nil;
|
||||
|
||||
// This bundle may not necessarily be the correct application bundle
|
||||
// Unfortunately we won't know the correct application bundle until after the delegate is set
|
||||
// See -[SUUpdater _standardUserDriverRequestsPathToRelaunch] below which resolves this
|
||||
// See -[SUUpdater _standardUserDriverRequestsPathToRelaunch] and -[SUUpdater _pathToRelaunchForUpdater:] implemented below which resolves this
|
||||
_userDriver = [[SPUStandardUserDriver alloc] initWithHostBundle:bundle applicationBundle:bundle delegate:self];
|
||||
_updater = [[SPUUpdater alloc] initWithHostBundle:bundle userDriver:_userDriver delegate:self];
|
||||
_updater = [[SPUUpdater alloc] initWithHostBundle:bundle applicationBundle:bundle userDriver:_userDriver delegate:self];
|
||||
|
||||
NSError *updaterError = nil;
|
||||
if (![_updater startUpdater:&updaterError]) {
|
||||
@@ -402,7 +402,8 @@ static NSMutableDictionary *sharedUpdaters = nil;
|
||||
return versionComparator;
|
||||
}
|
||||
|
||||
- (NSString *)pathToRelaunchForUpdater:(SPUUpdater *)__unused updater
|
||||
// Private SPUUpdater API that allows us to defer providing an application path to relaunch
|
||||
- (NSString * _Nullable)_pathToRelaunchForUpdater:(SPUUpdater *)__unused updater
|
||||
{
|
||||
NSString *relaunchPath = nil;
|
||||
if ([self.delegate respondsToSelector:@selector(pathToRelaunchForUpdater:)]) {
|
||||
@@ -414,7 +415,7 @@ static NSMutableDictionary *sharedUpdaters = nil;
|
||||
// Private SPUStandardUserDriver API that allows us to defer providing an application path to terminate
|
||||
- (NSString * _Nullable)_pathToTerminateForStandardUserDriver
|
||||
{
|
||||
return [self pathToRelaunchForUpdater:self.updater];
|
||||
return [self _pathToRelaunchForUpdater:self.updater];
|
||||
}
|
||||
|
||||
- (NSString *)decryptionPasswordForUpdater:(SPUUpdater *)__unused updater
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SUUserInitiatedUpdateDriver : NSObject <SUUpdateDriver>
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate;
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+2
-2
@@ -28,11 +28,11 @@
|
||||
@synthesize userDriver = _userDriver;
|
||||
@synthesize showingUserInitiatedProgress = _showingUserInitiatedProgress;
|
||||
|
||||
- (instancetype)initWithHost:(SUHost *)host sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate
|
||||
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle sparkleBundle:(NSBundle *)sparkleBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_uiDriver = [[SUUIBasedUpdateDriver alloc] initWithHost:host sparkleBundle:sparkleBundle updater:updater userDriver:userDriver updaterDelegate:updaterDelegate delegate:self];
|
||||
_uiDriver = [[SUUIBasedUpdateDriver alloc] initWithHost:host applicationBundle:applicationBundle sparkleBundle:sparkleBundle updater:updater userDriver:userDriver updaterDelegate:updaterDelegate delegate:self];
|
||||
_userDriver = userDriver;
|
||||
}
|
||||
return self;
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
}
|
||||
|
||||
self.userDriver = userDriver;
|
||||
self.updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle userDriver:userDriver delegate:nil];
|
||||
self.updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle applicationBundle:applicationBundle userDriver:userDriver delegate:nil];
|
||||
|
||||
NSError *updaterError = nil;
|
||||
if (![self.updater startUpdater:&updaterError]) {
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
{
|
||||
[super setUp];
|
||||
|
||||
// We really want a useless / not really functional user driver so we will pass nil here
|
||||
// For real world applications we should pass a valid user driver which is why this is not a nullable parameter
|
||||
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wnonnull"
|
||||
self.updater = [[SPUUpdater alloc] initWithHostBundle:[NSBundle bundleForClass:[self class]] userDriver:nil delegate:self];
|
||||
// We really want a useless / not really functional user driver so we will pass nil here
|
||||
// For real world applications we should pass a valid user driver which is why this is not a nullable parameter
|
||||
self.updater = [[SPUUpdater alloc] initWithHostBundle:bundle applicationBundle:bundle userDriver:nil delegate:self];
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
NSError *error = nil;
|
||||
|
||||
@@ -15,7 +15,6 @@ void _SULogDisableStandardErrorStream(void);
|
||||
@interface SPUCommandLineDriver () <SPUUpdaterDelegate>
|
||||
|
||||
@property (nonatomic, readonly) SPUUpdater *updater;
|
||||
@property (nonatomic, readonly) NSString *applicationBundlePath;
|
||||
@property (nonatomic, readonly) BOOL verbose;
|
||||
@property (nonatomic) BOOL probingForUpdates;
|
||||
@property (nonatomic, readonly) BOOL interactive;
|
||||
@@ -25,7 +24,6 @@ void _SULogDisableStandardErrorStream(void);
|
||||
@implementation SPUCommandLineDriver
|
||||
|
||||
@synthesize updater = _updater;
|
||||
@synthesize applicationBundlePath = _applicationBundlePath;
|
||||
@synthesize verbose = _verbose;
|
||||
@synthesize probingForUpdates = _probingForUpdates;
|
||||
@synthesize interactive = _interactive;
|
||||
@@ -52,14 +50,12 @@ void _SULogDisableStandardErrorStream(void);
|
||||
_verbose = verbose;
|
||||
_interactive = interactiveInstallation;
|
||||
|
||||
_applicationBundlePath = applicationBundle.bundlePath;
|
||||
|
||||
#ifndef DEBUG
|
||||
_SULogDisableStandardErrorStream();
|
||||
#endif
|
||||
|
||||
id <SPUUserDriver> userDriver = [[SPUCommandLineUserDriver alloc] initWithApplicationBundle:applicationBundle updatePermission:updatePermission deferInstallation:deferInstallation verbose:verbose];
|
||||
_updater = [[SPUUpdater alloc] initWithHostBundle:updateBundle userDriver:userDriver delegate:self];
|
||||
_updater = [[SPUUpdater alloc] initWithHostBundle:updateBundle applicationBundle:applicationBundle userDriver:userDriver delegate:self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -104,11 +100,6 @@ void _SULogDisableStandardErrorStream(void);
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)pathToRelaunchForUpdater:(SPUUpdater *)__unused updater
|
||||
{
|
||||
return self.applicationBundlePath;
|
||||
}
|
||||
|
||||
- (BOOL)updaterShouldDownloadReleaseNotes:(SPUUpdater *)__unused updater
|
||||
{
|
||||
return self.verbose;
|
||||
|
||||
Reference in new issue
Block a user