Added docs to sparkle's user driver

Also split SUSparkleUserDriverDelegate into two protocols, since it
just makes sense.
This commit is contained in:
Zorg committed 2016-03-02 00:53:28 -05:00
1 parent 4a2c3dd922
commit 5eb715f1f3
6 files changed
+157 -35

No files matched your search

+8 -4
View File
@@ -181,7 +181,8 @@
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, ); }; };
726E4A0E1C86881600C57C6A /* SUSparkleUserDriverDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E4A0D1C86881600C57C6A /* SUSparkleUserDriverDelegate.h */; };
726E4A0E1C86881600C57C6A /* SUSparkleUserDriverUIDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E4A0D1C86881600C57C6A /* SUSparkleUserDriverUIDelegate.h */; };
726E4A101C86B5A200C57C6A /* SUSparkleUserDriverRemoteDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E4A0F1C86B5A200C57C6A /* SUSparkleUserDriverRemoteDelegate.h */; };
726F2CDE1BC9BE5B001971A4 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7275F9C01B5F1F2900B1D19E /* SUFileManager.m */; };
726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */; };
726F2CE61BC9C33D001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
@@ -643,7 +644,8 @@
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; };
726DF88D1C84277500188804 /* SUStatusCompletionResults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUStatusCompletionResults.h; sourceTree = "<group>"; };
726E4A0D1C86881600C57C6A /* SUSparkleUserDriverDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSparkleUserDriverDelegate.h; sourceTree = "<group>"; };
726E4A0D1C86881600C57C6A /* SUSparkleUserDriverUIDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSparkleUserDriverUIDelegate.h; sourceTree = "<group>"; };
726E4A0F1C86B5A200C57C6A /* SUSparkleUserDriverRemoteDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUSparkleUserDriverRemoteDelegate.h; sourceTree = "<group>"; };
726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUOperatingSystem.h; sourceTree = "<group>"; };
726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUOperatingSystem.m; sourceTree = "<group>"; };
7275F9BF1B5F1F2900B1D19E /* SUFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUFileManager.h; sourceTree = "<group>"; };
@@ -1000,7 +1002,8 @@
children = (
7246E0A11C83B685003B4E75 /* SUUpdaterController.h */,
7246E0A21C83B685003B4E75 /* SUUpdaterController.m */,
726E4A0D1C86881600C57C6A /* SUSparkleUserDriverDelegate.h */,
726E4A0D1C86881600C57C6A /* SUSparkleUserDriverUIDelegate.h */,
726E4A0F1C86B5A200C57C6A /* SUSparkleUserDriverRemoteDelegate.h */,
725CB9581C7121830064365A /* SUSparkleUserDriver.h */,
725CB9591C7121830064365A /* SUSparkleUserDriver.m */,
6120721009CC5C4B007FE0F6 /* SUAutomaticUpdateAlert.h */,
@@ -1184,6 +1187,7 @@
72162B061C82C8B30013C1C5 /* SUParameterAssert.h in Headers */,
726DF88E1C84277600188804 /* SUStatusCompletionResults.h in Headers */,
72A450531C69A68900D67EEA /* SUUpdatePermissionPromptResult.h in Headers */,
726E4A101C86B5A200C57C6A /* SUSparkleUserDriverRemoteDelegate.h in Headers */,
611142E910FB1BE5009810AA /* bspatch.h in Headers */,
61299B3609CB04E000B7442F /* Sparkle.h in Headers */,
61CFB3290E385186007A1735 /* Sparkle.pch in Headers */,
@@ -1225,7 +1229,7 @@
61B5F8ED09C4CE3C00B25A18 /* SUUpdater.h in Headers */,
6158A1C5137904B300487EC1 /* SUUpdater_Private.h in Headers */,
61A354550DF113C70076ECB1 /* SUUserInitiatedUpdateDriver.h in Headers */,
726E4A0E1C86881600C57C6A /* SUSparkleUserDriverDelegate.h in Headers */,
726E4A0E1C86881600C57C6A /* SUSparkleUserDriverUIDelegate.h in Headers */,
61A2259E0D1C495D00430CCD /* SUVersionComparisonProtocol.h in Headers */,
3772FEA913DE0B6B00F79537 /* SUVersionDisplayProtocol.h in Headers */,
);
+39 -1
View File
@@ -11,16 +11,54 @@
NS_ASSUME_NONNULL_BEGIN
@protocol SUSparkleUserDriverDelegate;
@protocol SUSparkleUserDriverUIDelegate, SUSparkleUserDriverRemoteDelegate;
/*!
A protocol for Sparkle's user driver's delegate
If you are interested in UI interactions, check out SUSparkleUserDriverUIDelegate
If you are interested in XPC or remote process communications for efficiency and reliability, check out SUSparkleUserDriverRemoteDelegate
*/
@protocol SUSparkleUserDriverDelegate <SUSparkleUserDriverUIDelegate, SUSparkleUserDriverRemoteDelegate>
@end
/*!
Sparkle's standard built-in driver for user updater interactions
*/
@interface SUSparkleUserDriver : NSObject <SUUserDriver>
/*!
Initializes a Sparkle's standard user driver for user update interactions
@param hostBundle The target bundle of the host that is being updated
@param delegate The delegate to this user driver. Pass nil if you don't want to provide one.
*/
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(_Nullable id <SUSparkleUserDriverDelegate>)delegate;
/*!
Readable and writable property for this user driver's delegate
*/
@property (nonatomic, weak, nullable) id <SUSparkleUserDriverDelegate> delegate;
/*!
Indicates whether or not an update is in progress as far as the user is concerned
A typical application may rely on this property for its check for updates menu item validation
*/
@property (nonatomic, readonly, getter=isUpdateInProgress) BOOL updateInProgress;
/*!
Send a signal to the user driver that the user application should terminate.
This should only be invoked if the user driver's delegate says it's responsible for signaling application termination,
and this should only be called from NSApplicationDelegate's applicationShouldTerminate: method.
This is particularly useful when the user driver and updater live in separate processes, and the updater
wants to install an automatic update on termination. If the updater is in a separate process, that means
we may have to defer application termination a bit until the updater is ready to launch its auto updater.
@return The NSApplication termination reply. Use this as a return value to NSApplicationDelegate's applicationShouldTerminate:
*/
- (NSApplicationTerminateReply)sendApplicationTerminationSignal;
@end
+2 -1
View File
@@ -7,7 +7,8 @@
//
#import "SUSparkleUserDriver.h"
#import "SUSparkleUserDriverDelegate.h"
#import "SUSparkleUserDriverUIDelegate.h"
#import "SUSparkleUserDriverRemoteDelegate.h"
#import "SUAppcastItem.h"
#import "SUVersionDisplayProtocol.h"
#import "SUHost.h"
-29
View File
@@ -1,29 +0,0 @@
//
// SUSparkleUserDriverDelegate.h
// Sparkle
//
// Created by Mayur Pawashe on 3/1/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol SUUserDriver, SUVersionDisplay;
@protocol SUSparkleUserDriverDelegate <NSObject>
- (void)userDriverWillShowModalAlert:(id <SUUserDriver>)userDriver;
- (void)userDriverDidShowModalAlert:(id <SUUserDriver>)userDriver;
- (_Nullable id <SUVersionDisplay>)versionDisplayerForUserDriver:(id <SUUserDriver>)userDriver;
- (BOOL)responsibleForInitiatingUpdateCheckForUserDriver:(id <SUUserDriver>)userDriver;
- (void)initiateUpdateCheckForUserDriver:(id <SUUserDriver>)userDriver;
- (BOOL)responsibleForSignalingApplicationTerminationForUserDriver:(id <SUUserDriver>)userDriver;
@end
NS_ASSUME_NONNULL_END
+62
View File
@@ -0,0 +1,62 @@
//
// SUSparkleUserDriverRemoteDelegate.h
// Sparkle
//
// Created by Mayur Pawashe on 3/2/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol SUUserDriver;
/*!
A delegate protocol for Sparkle's user driver related to efficiency and reliablity when Sparkle's updater lives in a separate process
*/
@protocol SUSparkleUserDriverRemoteDelegate <NSObject>
/*!
Asks whether or not the delegate is responsible for initiating updater checks.
The user driver uses this to decide whether or not it should be the one initiating update checks.
If the delegate wants to initiate update checks, then the user driver lets the updater know it shouldn't
wait for a response from the user driver. When the user driver and updater live in separate processes,
having a delegate implement this can be more efficient for the system and therefore is encouraged.
@return Returns if the delegate is responsible for initiating update checks. If the delegate returns YES,
then the delegate must also implement -initiateUpdateCheckForUserDriver: which is when the delegate should
initiate update checks.
@param userDriver The user driver instance.
*/
- (BOOL)responsibleForInitiatingUpdateCheckForUserDriver:(id <SUUserDriver>)userDriver;
/*!
Called when user driver tells the delegate to initiate an update check
This is called if the delegate returned YES from -responsibleForInitiatingUpdateCheckForUserDriver:
The delegate will have to find a pathway to tell the SUUpdater instance to check for updates, that
does not go through the user driver. See -responsibleForInitiatingUpdateCheckForUserDriver: as to why
a delegate may want to implement this.
@param userDriver The user driver instance.
*/
- (void)initiateUpdateCheckForUserDriver:(id <SUUserDriver>)userDriver;
/*!
Asks whether or not the delegate is responsible for letting the user driver know when the application is about to terminate
This is necessary to implement when automatic updates are possible and when the updater and user driver live in separate processes.
See -[SUSparkleUserDriver sendApplicationTerminationSignal] for more details on how to follow up
@param userDriver The user driver instance.
*/
- (BOOL)responsibleForSignalingApplicationTerminationForUserDriver:(id <SUUserDriver>)userDriver;
@end
NS_ASSUME_NONNULL_END
+46
View File
@@ -0,0 +1,46 @@
//
// SUSparkleUserDriverUIDelegate.h
// Sparkle
//
// Created by Mayur Pawashe on 3/1/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@protocol SUUserDriver, SUVersionDisplay;
/*!
A delegate protocol for Sparkle's user driver related to user interactions
*/
@protocol SUSparkleUserDriverUIDelegate <NSObject>
/*!
Called before showing a modal alert window,
to give the opportunity to hide attached windows that may get in the way.
@param userDriver The user driver instance.
*/
- (void)userDriverWillShowModalAlert:(id <SUUserDriver>)userDriver;
/*!
Called after showing a modal alert window,
to give the opportunity to hide attached windows that may get in the way.
@param userDriver The user driver instance.
*/
- (void)userDriverDidShowModalAlert:(id <SUUserDriver>)userDriver;
/*!
Returns an object that formats version numbers for display to the user.
If you don't implement this method or return \c nil,
the standard version formatter will be used.
\param userDriver The user driver instance.
*/
- (_Nullable id <SUVersionDisplay>)versionDisplayerForUserDriver:(id <SUUserDriver>)userDriver;
@end
NS_ASSUME_NONNULL_END