Skip to content

Commit 726175a

Browse files
committed
Updated Sparkle update framework to version 2.2.2 (from 1.2.9)
1 parent 45ef4ca commit 726175a

File tree

115 files changed

+7502
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+7502
-1
lines changed

Sparkle/Sparkle.framework/Autoupdate

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Autoupdate

Sparkle/Sparkle.framework/Updater.app

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Updater.app
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//
2+
// SPUDownloadData.h
3+
// Sparkle
4+
//
5+
// Created by Mayur Pawashe on 8/10/16.
6+
// Copyright © 2016 Sparkle Project. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
#ifdef BUILDING_SPARKLE_DOWNLOADER_SERVICE
12+
// Ignore incorrect warning
13+
#pragma clang diagnostic push
14+
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
15+
#import "SUExport.h"
16+
#pragma clang diagnostic pop
17+
#else
18+
#import <Sparkle/SUExport.h>
19+
#endif
20+
21+
NS_ASSUME_NONNULL_BEGIN
22+
23+
/**
24+
* A class for containing downloaded data along with some information about it.
25+
*/
26+
SU_EXPORT @interface SPUDownloadData : NSObject <NSSecureCoding>
27+
28+
/**
29+
* The raw data that was downloaded.
30+
*/
31+
@property (nonatomic, readonly) NSData *data;
32+
33+
/**
34+
* The URL that was fetched from.
35+
*
36+
* This may be different from the URL in the request if there were redirects involved.
37+
*/
38+
@property (nonatomic, readonly, copy) NSURL *URL;
39+
40+
/**
41+
* The IANA charset encoding name if available. Eg: "utf-8"
42+
*/
43+
@property (nonatomic, readonly, nullable, copy) NSString *textEncodingName;
44+
45+
/**
46+
* The MIME type if available. Eg: "text/plain"
47+
*/
48+
@property (nonatomic, readonly, nullable, copy) NSString *MIMEType;
49+
50+
@end
51+
52+
NS_ASSUME_NONNULL_END
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
//
2+
// SPUStandardUpdaterController.h
3+
// Sparkle
4+
//
5+
// Created by Mayur Pawashe on 2/28/16.
6+
// Copyright © 2016 Sparkle Project. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
#import <Sparkle/SUExport.h>
11+
12+
NS_ASSUME_NONNULL_BEGIN
13+
14+
@class SPUUpdater;
15+
@class SPUStandardUserDriver;
16+
@class NSMenuItem;
17+
@protocol SPUUserDriver, SPUUpdaterDelegate, SPUStandardUserDriverDelegate;
18+
19+
/**
20+
A controller class that instantiates a `SPUUpdater` and allows binding UI to its updater settings.
21+
22+
This class can be instantiated in a nib or created programatically using `-initWithUpdaterDelegate:userDriverDelegate:` or `-initWithStartingUpdater:updaterDelegate:userDriverDelegate:`.
23+
24+
The controller's updater targets the application's main bundle and uses Sparkle's standard user interface.
25+
Typically, this class is used by sticking it as a custom NSObject subclass in an Interface Builder nib (probably in MainMenu) but it works well programatically too.
26+
27+
The controller creates an `SPUUpdater` instance using a `SPUStandardUserDriver` and allows hooking up the check for updates action and handling menu item validation.
28+
It also allows hooking up the updater's and user driver's delegates.
29+
30+
If you need more control over what bundle you want to update, or you want to provide a custom user interface (via `SPUUserDriver`), please use `SPUUpdater` directly instead.
31+
*/
32+
SU_EXPORT @interface SPUStandardUpdaterController : NSObject
33+
{
34+
#pragma clang diagnostic push
35+
#pragma clang diagnostic ignored "-Wobjc-interface-ivars"
36+
/**
37+
* Interface builder outlet for the updater's delegate.
38+
*/
39+
IBOutlet __weak id<SPUUpdaterDelegate> updaterDelegate;
40+
41+
/**
42+
* Interface builder outlet for the user driver's delegate.
43+
*/
44+
IBOutlet __weak id<SPUStandardUserDriverDelegate> userDriverDelegate;
45+
#pragma clang diagnostic pop
46+
}
47+
48+
/**
49+
Accessible property for the updater. Some properties on the updater can be binded via KVO
50+
51+
When instantiated from a nib, don't perform update checks before the application has finished launching in a MainMenu nib (i.e applicationDidFinishLaunching:) or before the corresponding window/view controller has been loaded (i.e, windowDidLoad or viewDidLoad). The updater is not guaranteed to be started yet before these points.
52+
*/
53+
@property (nonatomic, readonly) SPUUpdater *updater;
54+
55+
/**
56+
Accessible property for the updater's user driver.
57+
*/
58+
@property (nonatomic, readonly) SPUStandardUserDriver *userDriver;
59+
60+
/**
61+
Create a new `SPUStandardUpdaterController` from a nib.
62+
63+
You cannot call this initializer directly. You must instantiate a `SPUStandardUpdaterController` inside of a nib (typically the MainMenu nib) to use it.
64+
65+
To create a `SPUStandardUpdaterController` programatically, use `-initWithUpdaterDelegate:userDriverDelegate:` or `-initWithStartingUpdater:updaterDelegate:userDriverDelegate:` instead.
66+
*/
67+
- (instancetype)init NS_UNAVAILABLE;
68+
69+
/**
70+
Create a new `SPUStandardUpdaterController` programmatically.
71+
72+
The updater is started automatically. See `-startUpdater` for more information.
73+
*/
74+
- (instancetype)initWithUpdaterDelegate:(nullable id<SPUUpdaterDelegate>)updaterDelegate userDriverDelegate:(nullable id<SPUStandardUserDriverDelegate>)userDriverDelegate;
75+
76+
/**
77+
Create a new `SPUStandardUpdaterController` programmatically allowing you to specify whether or not to start the updater immediately.
78+
79+
You can specify whether or not you want to start the updater immediately.
80+
If you do not start the updater, you must invoke `-startUpdater` at a later time to start it.
81+
*/
82+
- (instancetype)initWithStartingUpdater:(BOOL)startUpdater updaterDelegate:(nullable id<SPUUpdaterDelegate>)updaterDelegate userDriverDelegate:(nullable id<SPUStandardUserDriverDelegate>)userDriverDelegate;
83+
84+
/**
85+
Starts the updater if it has not already been started.
86+
87+
You should only call this method yourself if you opted out of starting the updater on initialization.
88+
Hence, do not call this yourself if you are instantiating this controller from a nib.
89+
90+
This invokes `-[SPUUpdater startUpdater:]`. If the application is misconfigured with Sparkle, an error is logged and an alert is shown to the user (after a few seconds) to contact the developer.
91+
If you want more control over this behavior, you can create your own `SPUUpdater` instead of using `SPUStandardUpdaterController`.
92+
*/
93+
- (void)startUpdater;
94+
95+
/**
96+
Explicitly checks for updates and displays a progress dialog while doing so.
97+
98+
This method is meant for a main menu item.
99+
Connect any NSMenuItem to this action in Interface Builder or programmatically,
100+
and Sparkle will check for updates and report back its findings verbosely when it is invoked.
101+
102+
When the target/action of the menu item is set to this controller and this method,
103+
this controller also handles enabling/disabling the menu item by checking
104+
`-[SPUUpdater canCheckForUpdates]`
105+
106+
This action checks updates by invoking `-[SPUUpdater checkForUpdates]`
107+
*/
108+
- (IBAction)checkForUpdates:(nullable id)sender;
109+
110+
@end
111+
112+
NS_ASSUME_NONNULL_END
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//
2+
// SPUStandardUserDriver.h
3+
// Sparkle
4+
//
5+
// Created by Mayur Pawashe on 2/14/16.
6+
// Copyright © 2016 Sparkle Project. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
#import <Sparkle/SPUUserDriver.h>
11+
#import <Sparkle/SUExport.h>
12+
13+
NS_ASSUME_NONNULL_BEGIN
14+
15+
@protocol SPUStandardUserDriverDelegate;
16+
17+
/**
18+
Sparkle's standard built-in user driver for updater interactions
19+
*/
20+
SU_EXPORT @interface SPUStandardUserDriver : NSObject <SPUUserDriver>
21+
22+
/**
23+
Initializes a Sparkle's standard user driver for user update interactions
24+
25+
@param hostBundle The target bundle of the host that is being updated.
26+
@param delegate The optional delegate to this user driver.
27+
*/
28+
- (instancetype)initWithHostBundle:(NSBundle *)hostBundle delegate:(nullable id<SPUStandardUserDriverDelegate>)delegate;
29+
30+
/**
31+
Use initWithHostBundle:delegate: instead.
32+
*/
33+
- (instancetype)init NS_UNAVAILABLE;
34+
35+
@end
36+
37+
NS_ASSUME_NONNULL_END
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
//
2+
// SPUStandardUserDriverDelegate.h
3+
// Sparkle
4+
//
5+
// Created by Mayur Pawashe on 3/3/16.
6+
// Copyright © 2016 Sparkle Project. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
#import <Sparkle/SUExport.h>
11+
12+
NS_ASSUME_NONNULL_BEGIN
13+
14+
@protocol SUVersionDisplay;
15+
@class SUAppcastItem;
16+
@class SPUUserUpdateState;
17+
18+
/**
19+
A protocol for Sparkle's standard user driver's delegate
20+
21+
This includes methods related to UI interactions
22+
*/
23+
SU_EXPORT @protocol SPUStandardUserDriverDelegate <NSObject>
24+
25+
@optional
26+
27+
/**
28+
Called before showing a modal alert window,
29+
to give the opportunity to hide attached windows that may get in the way.
30+
*/
31+
- (void)standardUserDriverWillShowModalAlert;
32+
33+
/**
34+
Called after showing a modal alert window,
35+
to give the opportunity to hide attached windows that may get in the way.
36+
*/
37+
- (void)standardUserDriverDidShowModalAlert;
38+
39+
/**
40+
Returns an object that formats version numbers for display to the user.
41+
If you don't implement this method or return @c nil, the standard version formatter will be used.
42+
*/
43+
- (_Nullable id <SUVersionDisplay>)standardUserDriverRequestsVersionDisplayer;
44+
45+
/**
46+
Handles showing the full release notes to the user.
47+
48+
When a user checks for new updates and no new update is found, Sparkle will offer to show the application's version history to the user
49+
by providing a "Version History" button in the no new update available alert.
50+
51+
If this delegate method is not implemented, Sparkle will instead offer to open the
52+
`fullReleaseNotesLink` (or `releaseNotesLink` if the former is unavailable) from the appcast's latest `item` in the user's web browser.
53+
54+
If this delegate method is implemented, Sparkle will instead ask the delegate to show the full release notes to the user.
55+
A delegate may want to implement this method if they want to show in-app or offline release notes.
56+
57+
@param item The appcast item corresponding to the latest version available.
58+
*/
59+
- (void)standardUserDriverShowVersionHistoryForAppcastItem:(SUAppcastItem *)item;
60+
61+
/**
62+
Specifies whether or not the download, extraction, and installing status windows allows to be minimized.
63+
64+
By default, the status window showing the current status of the update (download, extraction, ready to install) is allowed to be minimized
65+
for regular application bundle updates.
66+
67+
@return @c YES if the status window is allowed to be minimized (default behavior), otherwise @c NO.
68+
*/
69+
- (BOOL)standardUserDriverAllowsMinimizableStatusWindow;
70+
71+
/**
72+
Declares whether or not gentle scheduled update reminders are supported.
73+
74+
The delegate may implement scheduled update reminders that are presented in a gentle manner by implementing one or both of:
75+
`-standardUserDriverWillHandleShowingUpdate:forUpdate:state:` and `-standardUserDriverShouldHandleShowingScheduledUpdate:andInImmediateFocus:`
76+
77+
Visit https://sparkle-project.org/documentation/gentle-reminders for more information and examples.
78+
79+
@return @c YES if gentle scheduled update reminders are implemented by standard user driver delegate, otherwise @c NO (default).
80+
*/
81+
@property (nonatomic, readonly) BOOL supportsGentleScheduledUpdateReminders;
82+
83+
/**
84+
Specifies if the standard user driver should handle showing a new scheduled update, or if its delegate should handle showing the update instead.
85+
86+
If you implement this method and return @c NO the delegate is then responsible for showing the update,
87+
which must be implemented and done in `-standardUserDriverWillHandleShowingUpdate:forUpdate:state:`
88+
The motivation for the delegate being responsible for showing updates is to override Sparkle's default behavior
89+
and add gentle reminders for new updates.
90+
91+
Returning @c YES is the default behavior and allows the standard user driver to handle showing the update.
92+
93+
If the standard user driver handles showing the update, `immediateFocus` reflects whether or not it will show the update in immediate and utmost focus.
94+
The standard user driver may choose to show the update in immediate and utmost focus when the app was launched recently
95+
or the system has been idle for some time.
96+
97+
If `immediateFocus` is @c NO the standard user driver may want to defer showing the update until the user comes back to the app.
98+
For background running applications, when `immediateFocus` is @c NO the standard user driver will always want to show
99+
the update alert immediately, but behind other running applications or behind the app's own windows if it's currently active.
100+
101+
There should be no side effects made when implementing this method so you should just return @c YES or @c NO
102+
You will also want to implement `-standardUserDriverWillHandleShowingUpdate:forUpdate:state:` for adding additional update reminders.
103+
104+
This method is not called for user-initiated update checks. The standard user driver always handles those.
105+
106+
Visit https://sparkle-project.org/documentation/gentle-reminders for more information and examples.
107+
108+
@param update The update the standard user driver should show.
109+
@param immediateFocus If @c immediateFocus is @c YES, then the standard user driver proposes to show the update in immediate and utmost focus. See discussion for more details.
110+
111+
@return @c YES if the standard user should handle showing the scheduled update (default behavior), otherwise @c NO if the delegate handles showing it.
112+
*/
113+
- (BOOL)standardUserDriverShouldHandleShowingScheduledUpdate:(SUAppcastItem *)update andInImmediateFocus:(BOOL)immediateFocus;
114+
115+
/**
116+
Called before an update will be shown to the user.
117+
118+
If the standard user driver handles showing the update, `handleShowingUpdate` will be `YES`.
119+
Please see `-standardUserDriverShouldHandleShowingScheduledUpdate:andInImmediateFocus:` for how the standard user driver
120+
may handle showing scheduled updates when `handleShowingUpdate` is `YES` and `state.userInitiated` is `NO`.
121+
122+
If the delegate declared it handles showing the update by returning @c NO in `-standardUserDriverShouldHandleShowingScheduledUpdate:andInImmediateFocus:`
123+
then the delegate should handle showing update reminders in this method, or at some later point.
124+
In this case, `handleShowingUpdate` will be @c NO.
125+
To bring the update alert in focus, you may call `-[SPUStandardUpdaterController checkForUpdates:]` or `-[SPUUpdater checkForUpdates]`.
126+
You may want to show additional UI indicators in your application that will show this update in focus
127+
and want to dismiss additional UI indicators in `-standardUserDriverWillFinishUpdateSession` or `-standardUserDriverDidReceiveUserAttentionForUpdate:`
128+
129+
If `state.userInitiated` is @c YES then the standard user driver always handles showing the new update and `handleShowingUpdate` will be @c YES.
130+
In this case, it may still be useful for the delegate to intercept this method right before a new update will be shown.
131+
132+
This method is not called when bringing an update that has already been presented back in focus.
133+
134+
Visit https://sparkle-project.org/documentation/gentle-reminders for more information and examples.
135+
136+
@param handleShowingUpdate @c YES if the standard user driver handles showing the update, otherwise @c NO if the delegate handles showing the update.
137+
@param update The update that will be shown.
138+
@param state The user state of the update which includes if the update check was initiated by the user.
139+
*/
140+
- (void)standardUserDriverWillHandleShowingUpdate:(BOOL)handleShowingUpdate forUpdate:(SUAppcastItem *)update state:(SPUUserUpdateState *)state;
141+
142+
/**
143+
Called when a new update first receives attention from the user.
144+
145+
This occurs either when the user first brings the update alert in utmost focus or when the user makes a choice to install an update or dismiss/skip it.
146+
147+
This may be useful to intercept for dismissing custom attention-based UI indicators (e.g, user notifications) introduced when implementing
148+
`-standardUserDriverWillHandleShowingUpdate:forUpdate:state:`
149+
150+
For custom UI indicators that need to still be on screen after the user has started to install an update, please see `-standardUserDriverWillFinishUpdateSession`.
151+
152+
@param update The new update that the user gave attention to.
153+
*/
154+
- (void)standardUserDriverDidReceiveUserAttentionForUpdate:(SUAppcastItem *)update;
155+
156+
/**
157+
Called before the standard user driver session will finish its current update session.
158+
159+
This may occur after the user has dismissed / skipped a new update or after an update error has occurred.
160+
For updaters updating external/other bundles, this may also be called after an update has been successfully installed.
161+
162+
This may be useful to intercept for dismissing custom UI indicators introduced when implementing
163+
`-standardUserDriverWillHandleShowingUpdate:forUpdate:state:`
164+
165+
For UI indicators that need to be dismissed when the user has given attention to a new update alert,
166+
please see `-standardUserDriverDidReceiveUserAttentionForUpdate:`
167+
*/
168+
- (void)standardUserDriverWillFinishUpdateSession;
169+
170+
@end
171+
172+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)