Rename UserUpdaterDriver -> UserDriver

This ends up to be more natural to me.
This commit is contained in:
Zorg committed 2016-03-01 21:24:50 -05:00
1 parent d3a09cc68a
commit ba4bbbb99a
12 files changed
+77 -77

No files matched your search

+12 -12
View File
@@ -176,9 +176,9 @@
725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 725602D31C83551C00DAA70E /* SUApplicationInfo.h */; };
725602D61C83551C00DAA70E /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; };
725602D71C83576100DAA70E /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; };
725CB9571C7120410064365A /* SUUserUpdaterDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 725CB9561C7120410064365A /* SUUserUpdaterDriver.h */; settings = {ATTRIBUTES = (Public, ); }; };
725CB95A1C7121830064365A /* SUSparkleUserUpdaterDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 725CB9581C7121830064365A /* SUSparkleUserUpdaterDriver.h */; settings = {ATTRIBUTES = (Public, ); }; };
725CB95B1C7121830064365A /* SUSparkleUserUpdaterDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 725CB9591C7121830064365A /* SUSparkleUserUpdaterDriver.m */; };
725CB9571C7120410064365A /* SUUserDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 725CB9561C7120410064365A /* SUUserDriver.h */; settings = {ATTRIBUTES = (Public, ); }; };
725CB95A1C7121830064365A /* SUSparkleUserDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 725CB9581C7121830064365A /* SUSparkleUserDriver.h */; settings = {ATTRIBUTES = (Public, ); }; };
725CB95B1C7121830064365A /* SUSparkleUserDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 725CB9591C7121830064365A /* SUSparkleUserDriver.m */; };
7268AC631AD634C200C3E0C1 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */; };
726DF88E1C84277600188804 /* SUStatusCompletionResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 726DF88D1C84277500188804 /* SUStatusCompletionResults.h */; settings = {ATTRIBUTES = (Public, ); }; };
726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; };
@@ -635,9 +635,9 @@
7246E0A21C83B685003B4E75 /* SUUpdaterController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdaterController.m; sourceTree = "<group>"; };
725602D31C83551C00DAA70E /* SUApplicationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUApplicationInfo.h; sourceTree = "<group>"; };
725602D41C83551C00DAA70E /* SUApplicationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUApplicationInfo.m; sourceTree = "<group>"; };
725CB9561C7120410064365A /* SUUserUpdaterDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUserUpdaterDriver.h; sourceTree = "<group>"; };
725CB9581C7121830064365A /* SUSparkleUserUpdaterDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSparkleUserUpdaterDriver.h; sourceTree = "<group>"; };
725CB9591C7121830064365A /* SUSparkleUserUpdaterDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUSparkleUserUpdaterDriver.m; sourceTree = "<group>"; };
725CB9561C7120410064365A /* SUUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUserDriver.h; sourceTree = "<group>"; };
725CB9581C7121830064365A /* SUSparkleUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSparkleUserDriver.h; sourceTree = "<group>"; };
725CB9591C7121830064365A /* SUSparkleUserDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUSparkleUserDriver.m; sourceTree = "<group>"; };
7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBinaryDeltaCreate.m; sourceTree = "<group>"; };
7268AC641AD634E400C3E0C1 /* SUBinaryDeltaCreate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUBinaryDeltaCreate.h; sourceTree = "<group>"; };
726B2B5D1C645FC900388755 /* UI Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UI Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -998,8 +998,8 @@
children = (
7246E0A11C83B685003B4E75 /* SUUpdaterController.h */,
7246E0A21C83B685003B4E75 /* SUUpdaterController.m */,
725CB9581C7121830064365A /* SUSparkleUserUpdaterDriver.h */,
725CB9591C7121830064365A /* SUSparkleUserUpdaterDriver.m */,
725CB9581C7121830064365A /* SUSparkleUserDriver.h */,
725CB9591C7121830064365A /* SUSparkleUserDriver.m */,
6120721009CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.h */,
6120721109CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.m */,
6196CFE309C71ADE000DC222 /* SUStatusController.h */,
@@ -1093,7 +1093,7 @@
61CFB2C20E38496B007A1735 /* Drivers */ = {
isa = PBXGroup;
children = (
725CB9561C7120410064365A /* SUUserUpdaterDriver.h */,
725CB9561C7120410064365A /* SUUserDriver.h */,
726DF88D1C84277500188804 /* SUStatusCompletionResults.h */,
61B93B250DD0FDD300DCD2F8 /* SUAutomaticUpdateDriver.h */,
61B93B260DD0FDD300DCD2F8 /* SUAutomaticUpdateDriver.m */,
@@ -1176,8 +1176,8 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
725CB95A1C7121830064365A /* SUSparkleUserUpdaterDriver.h in Headers */,
725CB9571C7120410064365A /* SUUserUpdaterDriver.h in Headers */,
725CB95A1C7121830064365A /* SUSparkleUserDriver.h in Headers */,
725CB9571C7120410064365A /* SUUserDriver.h in Headers */,
72162B061C82C8B30013C1C5 /* SUParameterAssert.h in Headers */,
726DF88E1C84277600188804 /* SUStatusCompletionResults.h in Headers */,
72A450531C69A68900D67EEA /* SUUpdatePermissionPromptResult.h in Headers */,
@@ -1706,7 +1706,7 @@
72A450541C69A68900D67EEA /* SUUpdatePermissionPromptResult.m in Sources */,
7275F9C21B5F1F2900B1D19E /* SUFileManager.m in Sources */,
767B61AD1972D488004E0C3C /* SUGuidedPackageInstaller.m in Sources */,
725CB95B1C7121830064365A /* SUSparkleUserUpdaterDriver.m in Sources */,
725CB95B1C7121830064365A /* SUSparkleUserDriver.m in Sources */,
61EF67560E25B58D00F754E0 /* SUHost.m in Sources */,
618FA5020DAE88B40026945C /* SUInstaller.m in Sources */,
55C14F07136EF6DB00649790 /* SULog.m in Sources */,
+7 -7
View File
@@ -48,7 +48,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
{
self.interruptible = NO;
[self.updater.userUpdaterDriver showAutomaticUpdateFoundWithAppcastItem:self.updateItem reply:^(SUUpdateAlertChoice choice) {
[self.updater.userDriver showAutomaticUpdateFoundWithAppcastItem:self.updateItem reply:^(SUUpdateAlertChoice choice) {
dispatch_async(dispatch_get_main_queue(), ^{
[self automaticUpdateAlertFinishedWithChoice:choice];
});
@@ -73,7 +73,7 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
- (void)unarchiverDidFinish:(SUUnarchiver *)__unused ua
{
[self.updater.userUpdaterDriver registerApplicationTermination:^(SUApplicationTerminationStatus terminationStatus) {
[self.updater.userDriver registerApplicationTermination:^(SUApplicationTerminationStatus terminationStatus) {
// We use -performSelectorOnMainThread:withObject:waitUntilDone: rather than GCD because if we are on the main thread already,
// we don't want to run the operation asynchronously. It's also possible we aren't on the main thread (say due to IPC through a XPC service).
// Anyway, if we're on the main thread in a single process without the app delegate delaying termination,
@@ -81,11 +81,11 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
[self performSelectorOnMainThread:@selector(installUpdateWithTerminationStatus:) withObject:@(terminationStatus) waitUntilDone:YES];
}];
// At first, it may seem like we should register for system power off ourselves rather than the user updater driver
// At first, it may seem like we should register for system power off ourselves rather than the user driver
// This is a bad idea for a couple reasons. One is it may require linkage to AppKit, or some complex IOKit code
// Another is that we would be making the assumption that the user updater driver is on the same system as the updater,
// Another is that we would be making the assumption that the user driver is on the same system as the updater,
// which is something we would be better off not assuming!
[self.updater.userUpdaterDriver registerSystemPowerOff:^(SUSystemPowerOffStatus systemPowerOffStatus) {
[self.updater.userDriver registerSystemPowerOff:^(SUSystemPowerOffStatus systemPowerOffStatus) {
// See above for why we use -performSelectorOnMainThread:withObject:waitUntilDone:
[self performSelectorOnMainThread:@selector(systemWillPowerOff:) withObject:@(systemPowerOffStatus) waitUntilDone:YES];
}];
@@ -126,8 +126,8 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
{
self.willUpdateOnTermination = NO;
[self.updater.userUpdaterDriver unregisterApplicationTermination];
[self.updater.userUpdaterDriver unregisterSystemPowerOff];
[self.updater.userDriver unregisterApplicationTermination];
[self.updater.userDriver unregisterSystemPowerOff];
id<SUUpdaterDelegate> updaterDelegate = [self.updater delegate];
if ([updaterDelegate respondsToSelector:@selector(updater:didCancelInstallUpdateOnQuit:)])
+2 -2
View File
@@ -585,7 +585,7 @@
// Note: this is overridden by the automatic update driver to not terminate in some cases
- (void)terminateApp
{
[self.updater.userUpdaterDriver terminateApplication];
[self.updater.userDriver terminateApplication];
}
- (void)cleanUpDownload
@@ -626,7 +626,7 @@
- (void)abortUpdate
{
[self.updater.userUpdaterDriver dismissUpdateInstallation];
[self.updater.userDriver dismissUpdateInstallation];
[self cleanUpDownload];
[[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -1,5 +1,5 @@
//
// SUSparkleUserUpdaterDriver.h
// SUSparkleUserDriver.h
// Sparkle
//
// Created by Mayur Pawashe on 2/14/16.
@@ -7,33 +7,33 @@
//
#import <Cocoa/Cocoa.h>
#import "SUUserUpdaterDriver.h"
#import "SUUserDriver.h"
NS_ASSUME_NONNULL_BEGIN
@protocol SUVersionDisplay;
@protocol SUSparkleUserUpdaterDriverDelegate <NSObject>
@protocol SUSparkleUserDriverDelegate <NSObject>
@optional
- (BOOL)responsibleForInitiatingUpdateCheckForUserDriver:(id <SUUserUpdaterDriver>)userUpdaterDriver;
- (void)initiateUpdateCheckForUserDriver:(id <SUUserUpdaterDriver>)userUpdaterDriver;
- (BOOL)responsibleForInitiatingUpdateCheckForUserDriver:(id <SUUserDriver>)userDriver;
- (void)initiateUpdateCheckForUserDriver:(id <SUUserDriver>)userDriver;
- (BOOL)responsibleForSignalingApplicationTerminationForUserDriver:(id <SUUserUpdaterDriver>)userUpdaterDriver;
- (BOOL)responsibleForSignalingApplicationTerminationForUserDriver:(id <SUUserDriver>)userDriver;
- (void)userUpdaterDriverWillShowModalAlert:(id <SUUserUpdaterDriver>)userUpdaterDriver;
- (void)userUpdaterDriverDidShowModalAlert:(id <SUUserUpdaterDriver>)userUpdaterDriver;
- (void)userUpdaterDriverWillShowModalAlert:(id <SUUserDriver>)userDriver;
- (void)userUpdaterDriverDidShowModalAlert:(id <SUUserDriver>)userDriver;
- (_Nullable id <SUVersionDisplay>)versionDisplayerForUserDriver:(id <SUUserUpdaterDriver>)userUpdaterDriver;
- (_Nullable id <SUVersionDisplay>)versionDisplayerForUserDriver:(id <SUUserDriver>)userDriver;
@end
@interface SUSparkleUserUpdaterDriver : NSObject <SUUserUpdaterDriver>
@interface SUSparkleUserDriver : NSObject <SUUserDriver>
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(_Nullable id <SUSparkleUserUpdaterDriverDelegate>)delegate;
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(_Nullable id <SUSparkleUserDriverDelegate>)delegate;
@property (nonatomic, readonly, weak, nullable) id <SUSparkleUserUpdaterDriverDelegate> delegate;
@property (nonatomic, readonly, weak, nullable) id <SUSparkleUserDriverDelegate> delegate;
@property (nonatomic, readonly, getter=isUpdateInProgress) BOOL updateInProgress;
@@ -1,12 +1,12 @@
//
// SUSparkleUserUpdaterDriver.m
// SUSparkleUserDriver.m
// Sparkle
//
// Created by Mayur Pawashe on 2/14/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "SUSparkleUserUpdaterDriver.h"
#import "SUSparkleUserDriver.h"
#import "SUAppcastItem.h"
#import "SUVersionDisplayProtocol.h"
#import "SUHost.h"
@@ -18,7 +18,7 @@
#import "SULocalizations.h"
#import "SUApplicationInfo.h"
@interface SUSparkleUserUpdaterDriver ()
@interface SUSparkleUserDriver ()
@property (nonatomic, readonly) SUHost *host;
@@ -47,7 +47,7 @@
@end
@implementation SUSparkleUserUpdaterDriver
@implementation SUSparkleUserDriver
@synthesize host = _host;
@synthesize handlesTermination = _handlesTermination;
@@ -68,7 +68,7 @@
#pragma mark Birth
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(id<SUSparkleUserUpdaterDriverDelegate>)delegate
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(id<SUSparkleUserDriverDelegate>)delegate
{
self = [super init];
if (self != nil) {
@@ -208,7 +208,7 @@
versionDisplayer = [self.delegate versionDisplayerForUserDriver:self];
}
__weak SUSparkleUserUpdaterDriver *weakSelf = self;
__weak SUSparkleUserDriver *weakSelf = self;
self.activeUpdateAlert = [[SUUpdateAlert alloc] initWithAppcastItem:appcastItem host:self.host versionDisplayer:versionDisplayer allowsAutomaticUpdates:allowsAutomaticUpdates completionBlock:^(SUUpdateAlertChoice choice) {
reply(choice);
weakSelf.activeUpdateAlert = nil;
@@ -221,7 +221,7 @@
- (void)showAutomaticUpdateFoundWithAppcastItem:(SUAppcastItem *)appcastItem reply:(void (^)(SUUpdateAlertChoice))reply
{
dispatch_async(dispatch_get_main_queue(), ^{
__weak SUSparkleUserUpdaterDriver *weakSelf = self;
__weak SUSparkleUserDriver *weakSelf = self;
self.activeUpdateAlert = [[SUAutomaticUpdateAlert alloc] initWithAppcastItem:appcastItem host:self.host completionBlock:^(SUUpdateAlertChoice choice) {
reply(choice);
weakSelf.activeUpdateAlert = nil;
@@ -347,7 +347,7 @@
- (void)showAlert:(NSAlert *)alert
{
dispatch_async(dispatch_get_main_queue(), ^{
id <SUSparkleUserUpdaterDriverDelegate> delegate = self.delegate;
id <SUSparkleUserDriverDelegate> delegate = self.delegate;
if ([delegate respondsToSelector:@selector(userUpdaterDriverWillShowModalAlert:)]) {
[delegate userUpdaterDriverWillShowModalAlert:self];
+11 -11
View File
@@ -39,7 +39,7 @@
return;
}
[self.updater.userUpdaterDriver showUpdateFoundWithAppcastItem:self.updateItem allowsAutomaticUpdates:self.updater.allowsAutomaticUpdates reply:^(SUUpdateAlertChoice choice) {
[self.updater.userDriver showUpdateFoundWithAppcastItem:self.updateItem allowsAutomaticUpdates:self.updater.allowsAutomaticUpdates reply:^(SUUpdateAlertChoice choice) {
dispatch_async(dispatch_get_main_queue(), ^{
[self updateAlertFinishedWithChoice:choice];
});
@@ -54,7 +54,7 @@
if (!self.automaticallyInstallUpdates) {
[self showNotice:^{
[self.updater.userUpdaterDriver showUpdateNotFound];
[self.updater.userDriver showUpdateNotFound];
}];
[self abortUpdate];
@@ -67,7 +67,7 @@
switch (choice) {
case SUInstallUpdateChoice:
{
[self.updater.userUpdaterDriver showDownloadInitiatedWithCompletion:^(SUDownloadUpdateStatus downloadCompletionStatus) {
[self.updater.userDriver showDownloadInitiatedWithCompletion:^(SUDownloadUpdateStatus downloadCompletionStatus) {
switch (downloadCompletionStatus) {
case SUDownloadUpdateDone:
break;
@@ -102,25 +102,25 @@
- (void)download:(NSURLDownload *)__unused download didReceiveResponse:(NSURLResponse *)response
{
[self.updater.userUpdaterDriver showDownloadDidReceiveResponse:response];
[self.updater.userDriver showDownloadDidReceiveResponse:response];
}
- (void)download:(NSURLDownload *)__unused download didReceiveDataOfLength:(NSUInteger)length
{
[self.updater.userUpdaterDriver showDownloadDidReceiveDataOfLength:length];
[self.updater.userDriver showDownloadDidReceiveDataOfLength:length];
}
- (void)extractUpdate
{
// Now we have to extract the downloaded archive.
[self.updater.userUpdaterDriver showDownloadFinishedAndStartedExtractingUpdate];
[self.updater.userDriver showDownloadFinishedAndStartedExtractingUpdate];
[super extractUpdate];
}
- (void)unarchiver:(SUUnarchiver *)__unused ua extractedProgress:(double)progress
{
[self.updater.userUpdaterDriver showExtractionReceivedProgress:progress];
[self.updater.userDriver showExtractionReceivedProgress:progress];
}
- (void)unarchiverDidFinish:(SUUnarchiver *)__unused ua
@@ -130,7 +130,7 @@
return;
}
[self.updater.userUpdaterDriver showExtractionFinishedAndReadyToInstallAndRelaunch:^(SUInstallUpdateStatus installUpdateStatus) {
[self.updater.userDriver showExtractionFinishedAndReadyToInstallAndRelaunch:^(SUInstallUpdateStatus installUpdateStatus) {
dispatch_async(dispatch_get_main_queue(), ^{
switch (installUpdateStatus) {
case SUCancelUpdateInstallation:
@@ -146,7 +146,7 @@
- (void)installWithToolAndRelaunch:(BOOL)relaunch
{
[self.updater.userUpdaterDriver showInstallingUpdate];
[self.updater.userDriver showInstallingUpdate];
[super installWithToolAndRelaunch:relaunch];
}
@@ -158,7 +158,7 @@
// tabs open), the status window still stays on the screen and obscures
// other windows; with this fix, it doesn't
[self.updater.userUpdaterDriver dismissUpdateInstallation];
[self.updater.userDriver dismissUpdateInstallation];
[super terminateApp];
}
@@ -166,7 +166,7 @@
- (void)abortUpdateWithError:(NSError *)error
{
[self showNotice:^{
[self.updater.userUpdaterDriver showUpdaterError:error];
[self.updater.userDriver showUpdaterError:error];
}];
[super abortUpdateWithError:error];
+3 -3
View File
@@ -12,7 +12,7 @@
#import <Foundation/Foundation.h>
#import "SUExport.h"
#import "SUVersionComparisonProtocol.h"
#import "SUUserUpdaterDriver.h"
#import "SUUserDriver.h"
@class SUAppcastItem, SUAppcast;
@@ -27,9 +27,9 @@
SU_EXPORT @interface SUUpdater : NSObject
@property (unsafe_unretained) id<SUUpdaterDelegate> delegate;
@property (nonatomic, readonly) id<SUUserUpdaterDriver> userUpdaterDriver;
@property (nonatomic, readonly) id<SUUserDriver> userDriver;
- (instancetype)initWithHostBundle:(NSBundle *)bundle userUpdaterDriver:(id <SUUserUpdaterDriver>)userUpdaterDriver;
- (instancetype)initWithHostBundle:(NSBundle *)bundle userDriver:(id <SUUserDriver>)userDriver;
@property (readonly, strong) NSBundle *hostBundle;
@property (strong, readonly) NSBundle *sparkleBundle;
+10 -10
View File
@@ -45,7 +45,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
@implementation SUUpdater
@synthesize delegate;
@synthesize userUpdaterDriver = _userUpdaterDriver;
@synthesize userDriver = _userDriver;
@synthesize userAgentString = customUserAgentString;
@synthesize httpHeaders;
@synthesize driver;
@@ -53,7 +53,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
@synthesize sparkleBundle;
@synthesize decryptionPassword;
- (instancetype)initWithHostBundle:(NSBundle *)bundle userUpdaterDriver:(id <SUUserUpdaterDriver>)userUpdaterDriver
- (instancetype)initWithHostBundle:(NSBundle *)bundle userDriver:(id <SUUserDriver>)userDriver
{
self = [super init];
@@ -66,7 +66,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
host = [[SUHost alloc] initWithBundle:bundle];
_userUpdaterDriver = userUpdaterDriver;
_userDriver = userDriver;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDriverDidFinish:) name:SUUpdateDriverFinishedNotification object:nil];
@@ -140,7 +140,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
profileInfo = [profileInfo arrayByAddingObjectsFromArray:[self.delegate feedParametersForUpdater:self sendingSystemProfile:YES]];
}
[self.userUpdaterDriver requestUpdatePermissionWithSystemProfile:profileInfo reply:^(SUUpdatePermissionPromptResult *result) {
[self.userDriver requestUpdatePermissionWithSystemProfile:profileInfo reply:^(SUUpdatePermissionPromptResult *result) {
dispatch_async(dispatch_get_main_queue(), ^{
[self updatePermissionPromptFinishedWithResult:result];
});
@@ -166,7 +166,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
if ([note object] == self.driver && [self.driver finished])
{
self.driver = nil;
[self.userUpdaterDriver showUpdateInProgress:NO];
[self.userDriver showUpdateInProgress:NO];
[self updateLastUpdateCheckDate];
[self scheduleNextUpdateCheck];
}
@@ -186,7 +186,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
- (void)scheduleNextUpdateCheck
{
[self.userUpdaterDriver invalidateUpdateCheckTimer];
[self.userDriver invalidateUpdateCheckTimer];
if (![self automaticallyChecksForUpdates]) return;
// How long has it been since last we checked for an update?
@@ -200,7 +200,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
updateCheckInterval = SUMinimumUpdateCheckInterval;
if (intervalSinceCheck < updateCheckInterval) {
NSTimeInterval delayUntilCheck = (updateCheckInterval - intervalSinceCheck); // It hasn't been long enough.
[self.userUpdaterDriver startUpdateCheckTimerWithNextTimeInterval:delayUntilCheck reply:^(SUUpdateCheckTimerStatus checkTimerStatus) {
[self.userDriver startUpdateCheckTimerWithNextTimeInterval:delayUntilCheck reply:^(SUUpdateCheckTimerStatus checkTimerStatus) {
switch (checkTimerStatus) {
case SUCheckForUpdateWillOccurLater:
break;
@@ -326,7 +326,7 @@ static void SUCheckForUpdatesInBgReachabilityCheck(__weak SUUpdater *updater, SU
{
if ([self updateInProgress]) { return; }
[self.userUpdaterDriver invalidateUpdateCheckTimer];
[self.userDriver invalidateUpdateCheckTimer];
[self updateLastUpdateCheckDate];
@@ -345,7 +345,7 @@ static void SUCheckForUpdatesInBgReachabilityCheck(__weak SUUpdater *updater, SU
return;
}
[self.userUpdaterDriver showUpdateInProgress:YES];
[self.userDriver showUpdateInProgress:YES];
[self checkIfConfiguredProperly];
@@ -543,7 +543,7 @@ static void SUCheckForUpdatesInBgReachabilityCheck(__weak SUUpdater *updater, SU
// Stop checking for updates
[self cancelNextUpdateCycle];
[self.userUpdaterDriver invalidateUpdateCheckTimer];
[self.userDriver invalidateUpdateCheckTimer];
// Abort any on-going updates
// A driver could be retained by another object (eg: a timer),
+3 -3
View File
@@ -9,7 +9,7 @@
#import "SUUpdaterController.h"
#import "SUUpdater.h"
#import "SUHost.h"
#import "SUSparkleUserUpdaterDriver.h"
#import "SUSparkleUserDriver.h"
#import "SUConstants.h"
#import "SULog.h"
@@ -41,8 +41,8 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
- (void)instantiateUpdater
{
NSBundle *hostBundle = [NSBundle mainBundle];
id <SUUserUpdaterDriver> driver = [[SUSparkleUserUpdaterDriver alloc] initWithHostBundle:hostBundle delegate:nil];
self.updater = [[SUUpdater alloc] initWithHostBundle:hostBundle userUpdaterDriver:driver];
id <SUUserDriver> driver = [[SUSparkleUserDriver alloc] initWithHostBundle:hostBundle delegate:nil];
self.updater = [[SUUpdater alloc] initWithHostBundle:hostBundle userDriver:driver];
}
- (void)dealloc
+5 -5
View File
@@ -1,5 +1,5 @@
//
// SUUserUpdaterDriver.h
// SUUserDriver.h
// Sparkle
//
// Created by Mayur Pawashe on 2/14/16.
@@ -14,13 +14,13 @@ NS_ASSUME_NONNULL_BEGIN
@class SUUpdatePermissionPromptResult, SUAppcastItem;
/*!
The API in Sparkle for controlling the user update interaction.
The API in Sparkle for controlling the user interaction.
This protocol is used for implementing a user interface for the Sparkle updater. Sparkle's internal drivers tell
an object that implements this protocol what actions to take and show to the user.
Every method in this protocol has a void return type and can optionally take a single parameter block, which waits for
a response back from the user updater driver. Note that every parameter block, or reply, *must* be responded to eventually -
a response back from the user driver. Note that every parameter block, or reply, *must* be responded to eventually -
that is, none can be ignored. Furthermore, they can only be replied to *once* - a reply or completion block should be considered
invalidated after it's once used. The faster a reply can be made, the more Sparkle may be able to idle, and so the better.
Lastly, every method in this protocol can be called from any thread. Thus, an implementor may choose to always
@@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
An implementor of this protocol should act defensively. For example, it may be possible for an action that says to
invalidate or dismiss something to be called multiple times in succession, and the implementor may choose to ignore further requests.
*/
@protocol SUUserUpdaterDriver <NSObject>
@protocol SUUserDriver <NSObject>
/*!
* Show that an update is or is not in progress.
@@ -230,7 +230,7 @@ NS_ASSUME_NONNULL_BEGIN
*
* This is necessary for Sparkle's automatic updates. An implementor should listen for when an application terminates and reply back when it is happening.
* An implementor may also want to decide if they want to delay the application's termination until -terminateApplication is invoked, which will be
* necessary if the updater and user updater driver are in separate processes.
* necessary if the updater and user driver are in separate processes.
*
* @param applicationTerminationHandler A reply of SUApplicationWillTerminate should be used when the application is about to terminate. A reply of
* SUApplicationStoppedObservingTermination can be used to cancel observing application termination. Note this would have the side effect of cancelling
+2 -2
View File
@@ -26,7 +26,7 @@
- (void)dismissCheckingForUpdates
{
[self.updater.userUpdaterDriver dismissUserInitiatedUpdateCheck];
[self.updater.userDriver dismissUserInitiatedUpdateCheck];
}
- (void)cancelCheckForUpdates:(id)__unused sender
@@ -39,7 +39,7 @@
- (void)checkForUpdatesAtURL:(NSURL *)URL
{
[self.updater.userUpdaterDriver showUserInitiatedUpdateCheckWithCompletion:^(SUUserInitiatedCheckStatus completionStatus) {
[self.updater.userDriver showUserInitiatedUpdateCheckWithCompletion:^(SUUserInitiatedCheckStatus completionStatus) {
switch (completionStatus) {
case SUUserInitiatedCheckDone:
break;
+2 -2
View File
@@ -21,7 +21,7 @@
#import "SUVersionDisplayProtocol.h"
#import "SUErrors.h"
#import "SUUpdatePermissionPromptResult.h"
#import "SUUserUpdaterDriver.h"
#import "SUSparkleUserUpdaterDriver.h"
#import "SUUserDriver.h"
#import "SUSparkleUserDriver.h"
#endif