Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 162 lines (115 sloc) 6.615 kb
9fa3da5 Holy restructuring, batman! Watch out for falling folders.
andym authored
1 //
2 // SUUpdater.h
3 // Sparkle
4 //
5 // Created by Andy Matuschak on 1/4/06.
6 // Copyright 2006 Andy Matuschak. All rights reserved.
7 //
8
5aa1e18 Improved headers from Charles D. H. Williams.
andym authored
9 #ifndef SUUPDATER_H
10 #define SUUPDATER_H
9fa3da5 Holy restructuring, batman! Watch out for falling folders.
andym authored
11
43a0a7d Uli Kusterer Merge of changes from SVN repository:
uliwitness authored
12 #import "SUVersionComparisonProtocol.h"
a453afa Delegate can now control how version numbers are formatted/displayed to ...
Uli Kusterer authored
13 #import "SUVersionDisplayProtocol.h"
14
f815eec Andy Matuschak Fixes 243884
andymatuschak authored
15 @class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast;
a453afa Delegate can now control how version numbers are formatted/displayed to ...
Uli Kusterer authored
16
17 @interface SUUpdater : NSObject
18 {
d7774c0 performed a code review, specifically:
Sean McBride authored
19 @private
9fa3da5 Holy restructuring, batman! Watch out for falling folders.
andym authored
20 NSTimer *checkTimer;
bc3be9a Touched practically every line of code in a super-monster-awesome refact...
andym authored
21 SUUpdateDriver *driver;
dfe0eff Mark Rowe Provide the ability to set a custom user agent string on all HTTP reques...
bdash authored
22
23 NSString *customUserAgentString;
98832c4 Andy Matuschak Beginnings of insane SUHost-based refactoring to get rid of NSBundle+Spa...
andymatuschak authored
24 SUHost *host;
a687271 Andy Matuschak Made SUUpdater's delegate an IBOutlet.
andymatuschak authored
25 IBOutlet id delegate;
9fa3da5 Holy restructuring, batman! Watch out for falling folders.
andym authored
26 }
27
6295c36 Andy Matuschak Added the (important) sharedUpdater method to SUUpdater.h. Oops!
andymatuschak authored
28 + (SUUpdater *)sharedUpdater;
98832c4 Andy Matuschak Beginnings of insane SUHost-based refactoring to get rid of NSBundle+Spa...
andymatuschak authored
29 + (SUUpdater *)updaterForBundle:(NSBundle *)bundle;
d6288c1 Andy Matuschak Fixing Bug #301614: "SUUpdater initForBundle: should be public"
andymatuschak authored
30 - initForBundle:(NSBundle *)bundle;
31
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
32 - (NSBundle *)hostBundle;
6295c36 Andy Matuschak Added the (important) sharedUpdater method to SUUpdater.h. Oops!
andymatuschak authored
33
645a96e Made a good deal more progress integrating the profile checking features...
andym authored
34 - (void)setDelegate:(id)delegate;
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
35 - delegate;
5e05339 #76 Support for Plug-ins
catlan authored
36
1aea1b6 Andy Matuschak The Sparkle preference keys are now declared private / deprecated / allo...
andymatuschak authored
37 - (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyChecks;
38 - (BOOL)automaticallyChecksForUpdates;
39
40 - (void)setUpdateCheckInterval:(NSTimeInterval)interval;
41 - (NSTimeInterval)updateCheckInterval;
42
43 - (void)setFeedURL:(NSURL *)feedURL;
43a0a7d Uli Kusterer Merge of changes from SVN repository:
uliwitness authored
44 - (NSURL *)feedURL; // *** MUST BE CALLED ON MAIN THREAD ***
1aea1b6 Andy Matuschak The Sparkle preference keys are now declared private / deprecated / allo...
andymatuschak authored
45
dfe0eff Mark Rowe Provide the ability to set a custom user agent string on all HTTP reques...
bdash authored
46 - (void)setUserAgentString:(NSString *)userAgent;
47 - (NSString *)userAgentString;
48
ec7f38d Andy Matuschak Fixes 258547
andymatuschak authored
49 - (void)setSendsSystemProfile:(BOOL)sendsSystemProfile;
50 - (BOOL)sendsSystemProfile;
51
52 - (void)setAutomaticallyDownloadsUpdates:(BOOL)automaticallyDownloadsUpdates;
53 - (BOOL)automaticallyDownloadsUpdates;
54
9fa3da5 Holy restructuring, batman! Watch out for falling folders.
andym authored
55 // This IBAction is meant for a main menu item. Hook up any menu item to this action,
56 // and Sparkle will check for updates and report back its findings verbosely.
43a0a7d Uli Kusterer Merge of changes from SVN repository:
uliwitness authored
57 - (IBAction)checkForUpdates:(id)sender;
9fa3da5 Holy restructuring, batman! Watch out for falling folders.
andym authored
58
9a266ca Andy Matuschak Added checkForUpdatesInBackground back to SUUpdater.h
andymatuschak authored
59 // This kicks off an update meant to be programmatically initiated. That is, it will display no UI unless it actually finds an update,
60 // in which case it proceeds as usual. If the fully automated updating is turned on, however, this will invoke that behavior, and if an
61 // update is found, it will be downloaded and prepped for installation.
62 - (void)checkForUpdatesInBackground;
63
ba6c3b6 Andy Matuschak Cleaned up SUUpdater.h
andymatuschak authored
64 // Date of last update check. Returns nil if no check has been performed.
c71bf3c Provide getter for SULastCheckTimeKey
Peter Speck authored
65 - (NSDate*)lastUpdateCheckDate;
66
f815eec Andy Matuschak Fixes 243884
andymatuschak authored
67 // This begins a "probing" check for updates which will not actually offer to update to that version. The delegate methods, though,
68 // (up to updater:didFindValidUpdate: and updaterDidNotFindUpdate:), are called, so you can use that information in your UI.
69 - (void)checkForUpdateInformation;
9fa3da5 Holy restructuring, batman! Watch out for falling folders.
andym authored
70
c71bf3c Provide getter for SULastCheckTimeKey
Peter Speck authored
71 // Call this to appropriately schedule or cancel the update checking timer according to the preferences for time interval and automatic checks. This call does not change the date of the next check, but only the internal NSTimer.
ac4e4e4 Andy Matuschak Fixes 245991
andymatuschak authored
72 - (void)resetUpdateCycle;
a55f11d Andy Matuschak Fixed 236240
andymatuschak authored
73
bc3be9a Touched practically every line of code in a super-monster-awesome refact...
andym authored
74 - (BOOL)updateInProgress;
43a0a7d Uli Kusterer Merge of changes from SVN repository:
uliwitness authored
75
9fa3da5 Holy restructuring, batman! Watch out for falling folders.
andym authored
76 @end
6a7c8b3 Substantial changes made to how Sparkle works on startup now. SUCheckAtS...
andym authored
77
a453afa Delegate can now control how version numbers are formatted/displayed to ...
Uli Kusterer authored
78
79 // -----------------------------------------------------------------------------
80 // SUUpdater Delegate:
81 // -----------------------------------------------------------------------------
82
645a96e Made a good deal more progress integrating the profile checking features...
andym authored
83 @interface NSObject (SUUpdaterDelegateInformalProtocol)
43a0a7d Uli Kusterer Merge of changes from SVN repository:
uliwitness authored
84
85 // Use this to keep Sparkle from popping up e.g. while your setup assistant is showing:
86 - (BOOL)updaterMayCheckForUpdates:(SUUpdater *)bundle;
87
4da902b Andy Matuschak Fixes 251968
andymatuschak authored
88 // This method allows you to add extra parameters to the appcast URL, potentially based on whether or not Sparkle will also be sending along the system profile. This method should return an array of dictionaries with keys: "key", "value", "displayKey", "displayValue", the latter two being specifically for display to the user.
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
89 - (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
645a96e Made a good deal more progress integrating the profile checking features...
andym authored
90
ba6c3b6 Andy Matuschak Cleaned up SUUpdater.h
andymatuschak authored
91 // Override this to dynamically specify the entire URL.
92 - (NSString*)feedURLStringForUpdater:(SUUpdater*)updater;
43a0a7d Uli Kusterer Merge of changes from SVN repository:
uliwitness authored
93
5c32832 Andy Matuschak Fixes bug 228446
andymatuschak authored
94 // Use this to override the default behavior for Sparkle prompting the user about automatic update checks.
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
95 - (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SUUpdater *)bundle;
5c32832 Andy Matuschak Fixes bug 228446
andymatuschak authored
96
97 // Implement this if you want to do some special handling with the appcast once it finishes loading.
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
98 - (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcast;
5c32832 Andy Matuschak Fixes bug 228446
andymatuschak authored
99
100 // If you're using special logic or extensions in your appcast, implement this to use your own logic for finding
101 // a valid update, if any, in the given appcast.
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
102 - (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SUUpdater *)bundle;
5c32832 Andy Matuschak Fixes bug 228446
andymatuschak authored
103
104 // Sent when a valid update is found by the update driver.
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
105 - (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)update;
7d8ada5 Andy Matuschak Improved delegate names and made SUProbingUpdateDriver use SUUpdater's d...
andymatuschak authored
106
107 // Sent when a valid update is not found.
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
108 - (void)updaterDidNotFindUpdate:(SUUpdater *)update;
5c32832 Andy Matuschak Fixes bug 228446
andymatuschak authored
109
110 // Sent immediately before installing the specified update.
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
111 - (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update;
5c32832 Andy Matuschak Fixes bug 228446
andymatuschak authored
112
113 // Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue.
43a0a7d Uli Kusterer Merge of changes from SVN repository:
uliwitness authored
114 // This is not called if the user didn't relaunch on the previous update, in that case it will immediately
115 // restart.
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
116 - (BOOL)updater:(SUUpdater *)updater shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update untilInvoking:(NSInvocation *)invocation;
5c32832 Andy Matuschak Fixes bug 228446
andymatuschak authored
117
43a0a7d Uli Kusterer Merge of changes from SVN repository:
uliwitness authored
118 // Some apps *can not* be relaunched in certain circumstances. They can use this method
119 // to prevent a relaunch "hard":
120 - (BOOL)updaterShouldRelaunchApplication:(SUUpdater *)updater;
121
5c32832 Andy Matuschak Fixes bug 228446
andymatuschak authored
122 // Called immediately before relaunching.
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
123 - (void)updaterWillRelaunchApplication:(SUUpdater *)updater;
645a96e Made a good deal more progress integrating the profile checking features...
andym authored
124
aaa60d2 Andy Matuschak Fixed 244761
andymatuschak authored
125 // This method allows you to provide a custom version comparator.
126 // If you don't implement this method or return nil, the standard version comparator will be used.
b3f3944 Andy Matuschak Fixes 244857
andymatuschak authored
127 - (id <SUVersionComparison>)versionComparatorForUpdater:(SUUpdater *)updater;
aaa60d2 Andy Matuschak Fixed 244761
andymatuschak authored
128
a453afa Delegate can now control how version numbers are formatted/displayed to ...
Uli Kusterer authored
129 // This method allows you to provide a custom version comparator.
ba6c3b6 Andy Matuschak Cleaned up SUUpdater.h
andymatuschak authored
130 // If you don't implement this method or return nil, the standard version displayer will be used.
a453afa Delegate can now control how version numbers are formatted/displayed to ...
Uli Kusterer authored
131 - (id <SUVersionDisplay>)versionDisplayerForUpdater:(SUUpdater *)updater;
132
e249e3c Andy Matuschak Fixes 253187
andymatuschak authored
133 // Returns the path which is used to relaunch the client after the update is installed. By default, the path of the host bundle.
134 - (NSString *)pathToRelaunchForUpdater:(SUUpdater *)updater;
135
ba6c3b6 Andy Matuschak Cleaned up SUUpdater.h
andymatuschak authored
136 // Called before and after, respectively, an updater shows a modal alert window, to give the host
f6710e2 Uli Kusterer Sparkle now warns the delegate before and after it brings up a modal pan...
uliwitness authored
137 // the opportunity to hide attached windows etc. that may get in the way:
138 -(void) updaterWillShowModalAlert:(SUUpdater *)updater;
139 -(void) updaterDidShowModalAlert:(SUUpdater *)updater;
140
645a96e Made a good deal more progress integrating the profile checking features...
andym authored
141 @end
142
a453afa Delegate can now control how version numbers are formatted/displayed to ...
Uli Kusterer authored
143
144 // -----------------------------------------------------------------------------
145 // Constants:
146 // -----------------------------------------------------------------------------
147
6a7c8b3 Substantial changes made to how Sparkle works on startup now. SUCheckAtS...
andym authored
148 // Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds.
436107f Kent Sutherland Fixed preprocessor error if DEBUG isn't defined.
ksuther authored
149 #if defined(DEBUG) && DEBUG && 0
645a96e Made a good deal more progress integrating the profile checking features...
andym authored
150 #define SU_MIN_CHECK_INTERVAL 60
6a7c8b3 Substantial changes made to how Sparkle works on startup now. SUCheckAtS...
andym authored
151 #else
645a96e Made a good deal more progress integrating the profile checking features...
andym authored
152 #define SU_MIN_CHECK_INTERVAL 60*60
6a7c8b3 Substantial changes made to how Sparkle works on startup now. SUCheckAtS...
andym authored
153 #endif
154
436107f Kent Sutherland Fixed preprocessor error if DEBUG isn't defined.
ksuther authored
155 #if defined(DEBUG) && DEBUG && 0
645a96e Made a good deal more progress integrating the profile checking features...
andym authored
156 #define SU_DEFAULT_CHECK_INTERVAL 60
6a7c8b3 Substantial changes made to how Sparkle works on startup now. SUCheckAtS...
andym authored
157 #else
645a96e Made a good deal more progress integrating the profile checking features...
andym authored
158 #define SU_DEFAULT_CHECK_INTERVAL 60*60*24
5aa1e18 Improved headers from Charles D. H. Williams.
andym authored
159 #endif
160
87f2893 Fixed warnings for missing newlines at the end of the file.
andym authored
161 #endif
Something went wrong with that request. Please try again.