From bb990ad172197be600202374b5e1ff67f730eae3 Mon Sep 17 00:00:00 2001 From: "C.W. Betts" Date: Sat, 28 Jun 2014 13:19:27 -0600 Subject: [PATCH] Finish moving all informal protocols to formal protocols. Fix improperly-named protocols. --- SUAutomaticUpdateAlert.h | 6 +++--- SUAutomaticUpdateAlert.m | 4 ++-- SUAutomaticUpdateDriver.h | 2 +- SUInstaller.h | 8 +++++--- SUInstaller.m | 4 ++-- SUPlainInstaller.h | 2 +- SUPlainInstaller.m | 2 +- SUUpdatePermissionPrompt.h | 8 ++++---- SUUpdatePermissionPrompt.m | 2 +- SUUpdater.h | 7 +++++-- SUUpdater.m | 2 +- finish_installation.m | 2 +- 12 files changed, 27 insertions(+), 22 deletions(-) diff --git a/SUAutomaticUpdateAlert.h b/SUAutomaticUpdateAlert.h index 7a9022d9..5d1a91f5 100644 --- a/SUAutomaticUpdateAlert.h +++ b/SUAutomaticUpdateAlert.h @@ -11,7 +11,7 @@ #import "SUWindowController.h" -@protocol SUAutomaticUpdateAlertDelegateProtocol; +@protocol SUAutomaticUpdateAlertDelegate; typedef enum { @@ -23,14 +23,14 @@ typedef enum @class SUAppcastItem, SUHost; @interface SUAutomaticUpdateAlert : SUWindowController -- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)hostBundle delegate:(id)delegate; +- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)hostBundle delegate:(id)delegate; - (IBAction)installNow:sender; - (IBAction)installLater:sender; - (IBAction)doNotInstall:sender; @end -@protocol SUAutomaticUpdateAlertDelegateProtocol +@protocol SUAutomaticUpdateAlertDelegate - (void)automaticUpdateAlert:(SUAutomaticUpdateAlert *)aua finishedWithChoice:(SUAutomaticInstallationChoice)choice; @end diff --git a/SUAutomaticUpdateAlert.m b/SUAutomaticUpdateAlert.m index 36da1ec6..26c0ff05 100644 --- a/SUAutomaticUpdateAlert.m +++ b/SUAutomaticUpdateAlert.m @@ -12,7 +12,7 @@ @interface SUAutomaticUpdateAlert () @property (retain) SUAppcastItem *updateItem; -@property (assign) id delegate; +@property (assign) id delegate; @property (retain) SUHost *host; @end @@ -21,7 +21,7 @@ @synthesize host; @synthesize updateItem; -- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost delegate:(id)del +- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost delegate:(id)del { self = [super initWithHost:aHost windowNibName:@"SUAutomaticUpdateAlert"]; if (self) diff --git a/SUAutomaticUpdateDriver.h b/SUAutomaticUpdateDriver.h index bcc1276b..390be48d 100644 --- a/SUAutomaticUpdateDriver.h +++ b/SUAutomaticUpdateDriver.h @@ -13,7 +13,7 @@ #import "SUBasicUpdateDriver.h" #import "SUAutomaticUpdateAlert.h" -@interface SUAutomaticUpdateDriver : SUBasicUpdateDriver +@interface SUAutomaticUpdateDriver : SUBasicUpdateDriver { @private BOOL postponingInstallation, showErrors; diff --git a/SUInstaller.h b/SUInstaller.h index ebca441c..0277d792 100644 --- a/SUInstaller.h +++ b/SUInstaller.h @@ -12,15 +12,17 @@ #import #import "SUVersionComparisonProtocol.h" +@protocol SUInstallerDelegate; + @class SUHost; @interface SUInstaller : NSObject + (NSString *) appPathInUpdateFolder:(NSString *)updateFolder forHost:(SUHost *)host; -+ (void) installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator; -+ (void) finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate; ++ (void) installFromUpdateFolder:(NSString *)updateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:(id)delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator; ++ (void) finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:(id)delegate; + (NSString*) updateFolder; @end -@interface NSObject (SUInstallerDelegateInformalProtocol) +@protocol SUInstallerDelegate - (void)installerFinishedForHost:(SUHost *)host; - (void)installerForHost:(SUHost *)host failedWithError:(NSError *)error; @end diff --git a/SUInstaller.m b/SUInstaller.m index 3fa3287b..6ba9f5cf 100644 --- a/SUInstaller.m +++ b/SUInstaller.m @@ -117,7 +117,7 @@ static NSString* sUpdateFolder = nil; return isPackage ? nil : path; } -+ (void)installFromUpdateFolder:(NSString *)inUpdateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator ++ (void)installFromUpdateFolder:(NSString *)inUpdateFolder overHost:(SUHost *)host installationPath:(NSString *)installationPath delegate:(id)delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator { BOOL isPackage = NO; NSString *newAppDownloadPath = [self installSourcePathInUpdateFolder:inUpdateFolder forHost:host isPackage:&isPackage]; @@ -158,7 +158,7 @@ static NSString* sUpdateFolder = nil; #define SUNotifyDictErrorKey @"SUNotifyDictError" #define SUNotifyDictDelegateKey @"SUNotifyDictDelegate" -+ (void)finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:delegate ++ (void)finishInstallationToPath:(NSString *)installationPath withResult:(BOOL)result host:(SUHost *)host error:(NSError *)error delegate:(id)delegate { if (result) { diff --git a/SUPlainInstaller.h b/SUPlainInstaller.h index 939d260d..414bbc5e 100644 --- a/SUPlainInstaller.h +++ b/SUPlainInstaller.h @@ -20,7 +20,7 @@ @class SUHost; @interface SUPlainInstaller : SUInstaller -+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator; ++ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:(id)delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator; @end #endif diff --git a/SUPlainInstaller.m b/SUPlainInstaller.m index dac28c39..47fdb733 100644 --- a/SUPlainInstaller.m +++ b/SUPlainInstaller.m @@ -58,7 +58,7 @@ static NSString * const SUInstallerInstallationPathKey = @"SUInstallerInstallati } } -+ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator ++ (void)performInstallationToPath:(NSString *)installationPath fromPath:(NSString *)path host:(SUHost *)host delegate:(id)delegate synchronously:(BOOL)synchronously versionComparator:(id )comparator { // Prevent malicious downgrades: #if !PERMIT_AUTOMATED_DOWNGRADES diff --git a/SUUpdatePermissionPrompt.h b/SUUpdatePermissionPrompt.h index d3882e85..d29f8876 100644 --- a/SUUpdatePermissionPrompt.h +++ b/SUUpdatePermissionPrompt.h @@ -16,24 +16,24 @@ typedef enum { SUDoNotAutomaticallyCheck } SUPermissionPromptResult; -@protocol SUUpdatePermissionPromptDelegateProtocol; +@protocol SUUpdatePermissionPromptDelegate; @class SUHost; @interface SUUpdatePermissionPrompt : SUWindowController { SUHost *host; NSArray *systemProfileInformationArray; - id delegate; + id delegate; IBOutlet NSTextField *descriptionTextField; IBOutlet NSView *moreInfoView; IBOutlet NSButton *moreInfoButton; IBOutlet NSTableView *profileTableView; } -+ (void)promptWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d; ++ (void)promptWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d; - (IBAction)toggleMoreInfo:(id)sender; - (IBAction)finishPrompt:(id)sender; @end -@protocol SUUpdatePermissionPromptDelegateProtocol +@protocol SUUpdatePermissionPromptDelegate - (void)updatePermissionPromptFinishedWithResult:(SUPermissionPromptResult)result; @end diff --git a/SUUpdatePermissionPrompt.m b/SUUpdatePermissionPrompt.m index ae25a228..d8e4656e 100644 --- a/SUUpdatePermissionPrompt.m +++ b/SUUpdatePermissionPrompt.m @@ -22,7 +22,7 @@ return [[host objectForInfoDictionaryKey:SUEnableSystemProfilingKey] boolValue]; } -- (instancetype)initWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d +- (instancetype)initWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d { self = [super initWithHost:aHost windowNibName:@"SUUpdatePermissionPrompt"]; if (self) diff --git a/SUUpdater.h b/SUUpdater.h index 90bda895..99b615a8 100644 --- a/SUUpdater.h +++ b/SUUpdater.h @@ -14,6 +14,8 @@ @class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast; +@protocol SUUpdaterDelegate; + @interface SUUpdater : NSObject { @private @@ -21,7 +23,7 @@ SUHost *host; } -@property (assign) IBOutlet id delegate; +@property (assign) IBOutlet id delegate; + (SUUpdater *)sharedUpdater; + (SUUpdater *)updaterForBundle:(NSBundle *)bundle; @@ -84,7 +86,8 @@ extern NSString *const SUUpdaterAppcastNotificationKey; // SUUpdater Delegate: // ----------------------------------------------------------------------------- -@interface NSObject (SUUpdaterDelegateInformalProtocol) +@protocol SUUpdaterDelegate +@optional // Use this to keep Sparkle from popping up e.g. while your setup assistant is showing: - (BOOL)updaterMayCheckForUpdates:(SUUpdater *)bundle; diff --git a/SUUpdater.m b/SUUpdater.m index d9f5eee4..50336169 100644 --- a/SUUpdater.m +++ b/SUUpdater.m @@ -27,7 +27,7 @@ NSString *const SUUpdaterWillRestartNotification = @"SUUpdaterWillRestartNotific NSString *const SUUpdaterAppcastItemNotificationKey = @"SUUpdaterAppcastItemNotificationKey"; NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotificationKey"; -@interface SUUpdater () +@interface SUUpdater () @property (retain) NSTimer *checkTimer; - (instancetype)initForBundle:(NSBundle *)bundle; - (void)startUpdateCycle; diff --git a/finish_installation.m b/finish_installation.m index 90186f0f..9a880c5a 100644 --- a/finish_installation.m +++ b/finish_installation.m @@ -12,7 +12,7 @@ #define LONG_INSTALLATION_TIME 5 // If the Installation takes longer than this time the Application Icon is shown in the Dock so that the user has some feedback. #define CHECK_FOR_PARENT_TO_QUIT_TIME .5 // Time this app uses to recheck if the parent has already died. -@interface TerminationListener : NSObject +@interface TerminationListener : NSObject { const char *hostpath; const char *executablepath;