From ba4bbbb99a78ec6a3e83d04f223220646b5cb5c1 Mon Sep 17 00:00:00 2001 From: Zorg Date: Tue, 1 Mar 2016 21:24:50 -0500 Subject: [PATCH] Rename UserUpdaterDriver -> UserDriver This ends up to be more natural to me. --- Sparkle.xcodeproj/project.pbxproj | 24 +++++++++---------- Sparkle/SUAutomaticUpdateDriver.m | 14 +++++------ Sparkle/SUBasicUpdateDriver.m | 4 ++-- ...rUpdaterDriver.h => SUSparkleUserDriver.h} | 24 +++++++++---------- ...rUpdaterDriver.m => SUSparkleUserDriver.m} | 16 ++++++------- Sparkle/SUUIBasedUpdateDriver.m | 22 ++++++++--------- Sparkle/SUUpdater.h | 6 ++--- Sparkle/SUUpdater.m | 20 ++++++++-------- Sparkle/SUUpdaterController.m | 6 ++--- .../{SUUserUpdaterDriver.h => SUUserDriver.h} | 10 ++++---- Sparkle/SUUserInitiatedUpdateDriver.m | 4 ++-- Sparkle/Sparkle.h | 4 ++-- 12 files changed, 77 insertions(+), 77 deletions(-) rename Sparkle/{SUSparkleUserUpdaterDriver.h => SUSparkleUserDriver.h} (51%) rename Sparkle/{SUSparkleUserUpdaterDriver.m => SUSparkleUserDriver.m} (98%) rename Sparkle/{SUUserUpdaterDriver.h => SUUserDriver.h} (97%) diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 3daad439..83981b5d 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -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 = ""; }; 725602D31C83551C00DAA70E /* SUApplicationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUApplicationInfo.h; sourceTree = ""; }; 725602D41C83551C00DAA70E /* SUApplicationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUApplicationInfo.m; sourceTree = ""; }; - 725CB9561C7120410064365A /* SUUserUpdaterDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUserUpdaterDriver.h; sourceTree = ""; }; - 725CB9581C7121830064365A /* SUSparkleUserUpdaterDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSparkleUserUpdaterDriver.h; sourceTree = ""; }; - 725CB9591C7121830064365A /* SUSparkleUserUpdaterDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUSparkleUserUpdaterDriver.m; sourceTree = ""; }; + 725CB9561C7120410064365A /* SUUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUserDriver.h; sourceTree = ""; }; + 725CB9581C7121830064365A /* SUSparkleUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSparkleUserDriver.h; sourceTree = ""; }; + 725CB9591C7121830064365A /* SUSparkleUserDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUSparkleUserDriver.m; sourceTree = ""; }; 7268AC621AD634C200C3E0C1 /* SUBinaryDeltaCreate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUBinaryDeltaCreate.m; sourceTree = ""; }; 7268AC641AD634E400C3E0C1 /* SUBinaryDeltaCreate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUBinaryDeltaCreate.h; sourceTree = ""; }; 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 */, diff --git a/Sparkle/SUAutomaticUpdateDriver.m b/Sparkle/SUAutomaticUpdateDriver.m index 465e15d0..ff38eb60 100644 --- a/Sparkle/SUAutomaticUpdateDriver.m +++ b/Sparkle/SUAutomaticUpdateDriver.m @@ -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 updaterDelegate = [self.updater delegate]; if ([updaterDelegate respondsToSelector:@selector(updater:didCancelInstallUpdateOnQuit:)]) diff --git a/Sparkle/SUBasicUpdateDriver.m b/Sparkle/SUBasicUpdateDriver.m index baa73e4e..f4dea316 100644 --- a/Sparkle/SUBasicUpdateDriver.m +++ b/Sparkle/SUBasicUpdateDriver.m @@ -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]; diff --git a/Sparkle/SUSparkleUserUpdaterDriver.h b/Sparkle/SUSparkleUserDriver.h similarity index 51% rename from Sparkle/SUSparkleUserUpdaterDriver.h rename to Sparkle/SUSparkleUserDriver.h index ea7b2e90..5534c7c1 100644 --- a/Sparkle/SUSparkleUserUpdaterDriver.h +++ b/Sparkle/SUSparkleUserDriver.h @@ -1,5 +1,5 @@ // -// SUSparkleUserUpdaterDriver.h +// SUSparkleUserDriver.h // Sparkle // // Created by Mayur Pawashe on 2/14/16. @@ -7,33 +7,33 @@ // #import -#import "SUUserUpdaterDriver.h" +#import "SUUserDriver.h" NS_ASSUME_NONNULL_BEGIN @protocol SUVersionDisplay; -@protocol SUSparkleUserUpdaterDriverDelegate +@protocol SUSparkleUserDriverDelegate @optional -- (BOOL)responsibleForInitiatingUpdateCheckForUserDriver:(id )userUpdaterDriver; -- (void)initiateUpdateCheckForUserDriver:(id )userUpdaterDriver; +- (BOOL)responsibleForInitiatingUpdateCheckForUserDriver:(id )userDriver; +- (void)initiateUpdateCheckForUserDriver:(id )userDriver; -- (BOOL)responsibleForSignalingApplicationTerminationForUserDriver:(id )userUpdaterDriver; +- (BOOL)responsibleForSignalingApplicationTerminationForUserDriver:(id )userDriver; -- (void)userUpdaterDriverWillShowModalAlert:(id )userUpdaterDriver; -- (void)userUpdaterDriverDidShowModalAlert:(id )userUpdaterDriver; +- (void)userUpdaterDriverWillShowModalAlert:(id )userDriver; +- (void)userUpdaterDriverDidShowModalAlert:(id )userDriver; -- (_Nullable id )versionDisplayerForUserDriver:(id )userUpdaterDriver; +- (_Nullable id )versionDisplayerForUserDriver:(id )userDriver; @end -@interface SUSparkleUserUpdaterDriver : NSObject +@interface SUSparkleUserDriver : NSObject -- (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(_Nullable id )delegate; +- (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(_Nullable id )delegate; -@property (nonatomic, readonly, weak, nullable) id delegate; +@property (nonatomic, readonly, weak, nullable) id delegate; @property (nonatomic, readonly, getter=isUpdateInProgress) BOOL updateInProgress; diff --git a/Sparkle/SUSparkleUserUpdaterDriver.m b/Sparkle/SUSparkleUserDriver.m similarity index 98% rename from Sparkle/SUSparkleUserUpdaterDriver.m rename to Sparkle/SUSparkleUserDriver.m index dd6a38b8..5042dba1 100644 --- a/Sparkle/SUSparkleUserUpdaterDriver.m +++ b/Sparkle/SUSparkleUserDriver.m @@ -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)delegate +- (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(id)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 delegate = self.delegate; + id delegate = self.delegate; if ([delegate respondsToSelector:@selector(userUpdaterDriverWillShowModalAlert:)]) { [delegate userUpdaterDriverWillShowModalAlert:self]; diff --git a/Sparkle/SUUIBasedUpdateDriver.m b/Sparkle/SUUIBasedUpdateDriver.m index 4068b254..351d9c5b 100644 --- a/Sparkle/SUUIBasedUpdateDriver.m +++ b/Sparkle/SUUIBasedUpdateDriver.m @@ -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]; diff --git a/Sparkle/SUUpdater.h b/Sparkle/SUUpdater.h index d1011768..ef47883a 100644 --- a/Sparkle/SUUpdater.h +++ b/Sparkle/SUUpdater.h @@ -12,7 +12,7 @@ #import #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 delegate; -@property (nonatomic, readonly) id userUpdaterDriver; +@property (nonatomic, readonly) id userDriver; -- (instancetype)initWithHostBundle:(NSBundle *)bundle userUpdaterDriver:(id )userUpdaterDriver; +- (instancetype)initWithHostBundle:(NSBundle *)bundle userDriver:(id )userDriver; @property (readonly, strong) NSBundle *hostBundle; @property (strong, readonly) NSBundle *sparkleBundle; diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index e55b7089..e390febf 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -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 )userUpdaterDriver +- (instancetype)initWithHostBundle:(NSBundle *)bundle userDriver:(id )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), diff --git a/Sparkle/SUUpdaterController.m b/Sparkle/SUUpdaterController.m index 70310352..05c69b5e 100644 --- a/Sparkle/SUUpdaterController.m +++ b/Sparkle/SUUpdaterController.m @@ -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 driver = [[SUSparkleUserUpdaterDriver alloc] initWithHostBundle:hostBundle delegate:nil]; - self.updater = [[SUUpdater alloc] initWithHostBundle:hostBundle userUpdaterDriver:driver]; + id driver = [[SUSparkleUserDriver alloc] initWithHostBundle:hostBundle delegate:nil]; + self.updater = [[SUUpdater alloc] initWithHostBundle:hostBundle userDriver:driver]; } - (void)dealloc diff --git a/Sparkle/SUUserUpdaterDriver.h b/Sparkle/SUUserDriver.h similarity index 97% rename from Sparkle/SUUserUpdaterDriver.h rename to Sparkle/SUUserDriver.h index 18436991..54c66a9c 100644 --- a/Sparkle/SUUserUpdaterDriver.h +++ b/Sparkle/SUUserDriver.h @@ -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 +@protocol SUUserDriver /*! * 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 diff --git a/Sparkle/SUUserInitiatedUpdateDriver.m b/Sparkle/SUUserInitiatedUpdateDriver.m index 917e6833..a2f56589 100644 --- a/Sparkle/SUUserInitiatedUpdateDriver.m +++ b/Sparkle/SUUserInitiatedUpdateDriver.m @@ -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; diff --git a/Sparkle/Sparkle.h b/Sparkle/Sparkle.h index 1c65d693..bb56d56d 100644 --- a/Sparkle/Sparkle.h +++ b/Sparkle/Sparkle.h @@ -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