]> src.bluestatic.org Git - macgdbp.git/blob - Sparkle.framework/Versions/A/Headers/SUUpdater.h
Add the Sparkle keys to Info.plist
[macgdbp.git] / Sparkle.framework / Versions / A / Headers / SUUpdater.h
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
9 #ifndef SUUPDATER_H
10 #define SUUPDATER_H
11
12 #import "SUUpdateAlert.h"
13 #import "SUVersionComparisonProtocol.h"
14
15 @class SUUpdateDriver, SUAppcastItem, SUAppcast;
16 @interface SUUpdater : NSObject {
17 NSTimer *checkTimer;
18 SUUpdateDriver *driver;
19
20 NSBundle *hostBundle;
21 IBOutlet id delegate;
22 }
23
24 + (SUUpdater *)sharedUpdater;
25
26 - (void)setDelegate:(id)delegate;
27
28 // This IBAction is meant for a main menu item. Hook up any menu item to this action,
29 // and Sparkle will check for updates and report back its findings verbosely.
30 - (IBAction)checkForUpdates:sender;
31
32 // This kicks off an update meant to be programmatically initiated. That is, it will display no UI unless it actually finds an update,
33 // in which case it proceeds as usual. If the fully automated updating is turned on, however, this will invoke that behavior, and if an
34 // update is found, it will be downloaded and prepped for installation.
35 - (void)checkForUpdatesInBackground;
36
37 // This forces an update to begin with a particular driver (see SU*UpdateDriver.h)
38 - (void)checkForUpdatesWithDriver:(SUUpdateDriver *)driver;
39
40 // For non-.app updates:
41 // Call this when your bundle is loaded to tell Sparkle what to update.
42 - (void)setHostBundle:(NSBundle *)hostBundle;
43
44 // Call this to appropriately reschedule or cancel the update checking timer if preferences for time interval or automatic checks change.
45 // If you're using a .app, this'll be picked up automatically via NSUserDefaultsController, but for non-.apps, there's no way to observe changes.
46 - (void)updatePreferencesChanged;
47
48 - (BOOL)updateInProgress;
49 @end
50
51 @interface NSObject (SUUpdaterDelegateInformalProtocol)
52 // This method allows you to add extra parameters to the appcast URL, potentially based on whether or not
53 // Sparkle will also be sending along the system profile. This method should return an array of dictionaries with the following keys:
54 - (NSArray *)feedParametersForHostBundle:(NSBundle *)bundle sendingSystemProfile:(BOOL)sendingProfile;
55
56 // Use this to override the default behavior for Sparkle prompting the user about automatic update checks.
57 - (BOOL)shouldPromptForPermissionToCheckForUpdatesToHostBundle:(NSBundle *)bundle;
58
59 // Implement this if you want to do some special handling with the appcast once it finishes loading.
60 - (void)appcastDidFinishLoading:(SUAppcast *)appcast forHostBundle:(NSBundle *)bundle;
61
62 // If you're using special logic or extensions in your appcast, implement this to use your own logic for finding
63 // a valid update, if any, in the given appcast.
64 - (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forHostBundle:(NSBundle *)bundle;
65
66 // Sent when a valid update is found by the update driver.
67 - (void)didFindValidUpdate:(SUAppcastItem *)update toHostBundle:(NSBundle *)bundle;
68
69 // Sent when a valid update is not found.
70 - (void)didNotFindUpdateToHostBundle:(NSBundle *)hb;
71
72 // Sent when the user makes a choice in the update alert dialog (install now / remind me later / skip this version).
73 - (void)userChoseAction:(SUUpdateAlertChoice)action forUpdate:(SUAppcastItem *)update toHostBundle:(NSBundle *)bundle;
74
75 // Sent immediately before installing the specified update.
76 - (void)updateWillInstall:(SUAppcastItem *)update toHostBundle:(NSBundle *)bundle;
77
78 // Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue.
79 - (BOOL)shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update toHostBundle:(NSBundle *)hostBundle untilInvoking:(NSInvocation *)invocation;
80
81 // Called immediately before relaunching.
82 - (void)updaterWillRelaunchApplication;
83
84 // This method allows you to provide a custom version comparator.
85 // If you don't implement this method or return nil, the standard version comparator will be used.
86 - (id <SUVersionComparison>)versionComparatorForHostBundle:(NSBundle *)hb;
87
88 @end
89
90 // Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds.
91 #ifdef DEBUG
92 #define SU_MIN_CHECK_INTERVAL 60
93 #else
94 #define SU_MIN_CHECK_INTERVAL 60*60
95 #endif
96
97 #ifdef DEBUG
98 #define SU_DEFAULT_CHECK_INTERVAL 60
99 #else
100 #define SU_DEFAULT_CHECK_INTERVAL 60*60*24
101 #endif
102
103 #endif