source: trunk/macosx/Sparkle.framework/Versions/A/Headers/SUUpdater.h @ 6529

Last change on this file since 6529 was 6529, checked in by livings124, 13 years ago

initial Sparkle 1.5 b5 commit

File size: 4.4 KB
Line 
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 <Sparkle/SUVersionComparisonProtocol.h>
13
14@class SUUpdateDriver, SUAppcastItem, SUHost, SUAppcast;
15@interface SUUpdater : NSObject {
16        NSTimer *checkTimer;
17        SUUpdateDriver *driver;
18       
19        SUHost *host;
20        IBOutlet id delegate;
21}
22
23+ (SUUpdater *)sharedUpdater;
24+ (SUUpdater *)updaterForBundle:(NSBundle *)bundle;
25- (NSBundle *)hostBundle;
26
27- (void)setDelegate:(id)delegate;
28- delegate;
29
30- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyChecks;
31- (BOOL)automaticallyChecksForUpdates;
32
33- (void)setUpdateCheckInterval:(NSTimeInterval)interval;
34- (NSTimeInterval)updateCheckInterval;
35
36- (void)setFeedURL:(NSURL *)feedURL;
37- (NSURL *)feedURL;
38
39// This IBAction is meant for a main menu item. Hook up any menu item to this action,
40// and Sparkle will check for updates and report back its findings verbosely.
41- (IBAction)checkForUpdates:sender;
42
43// This kicks off an update meant to be programmatically initiated. That is, it will display no UI unless it actually finds an update,
44// in which case it proceeds as usual. If the fully automated updating is turned on, however, this will invoke that behavior, and if an
45// update is found, it will be downloaded and prepped for installation.
46- (void)checkForUpdatesInBackground;
47
48// This begins a "probing" check for updates which will not actually offer to update to that version. The delegate methods, though,
49// (up to updater:didFindValidUpdate: and updaterDidNotFindUpdate:), are called, so you can use that information in your UI.
50- (void)checkForUpdateInformation;
51
52// Call this to appropriately schedule or cancel the update checking timer according to the preferences for time interval and automatic checks.
53- (void)resetUpdateCycle;
54
55- (BOOL)updateInProgress;
56@end
57
58@interface NSObject (SUUpdaterDelegateInformalProtocol)
59// 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.
60- (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile;
61
62// Use this to override the default behavior for Sparkle prompting the user about automatic update checks.
63- (BOOL)updaterShouldPromptForPermissionToCheckForUpdates:(SUUpdater *)bundle;
64
65// Implement this if you want to do some special handling with the appcast once it finishes loading.
66- (void)updater:(SUUpdater *)updater didFinishLoadingAppcast:(SUAppcast *)appcast;
67
68// If you're using special logic or extensions in your appcast, implement this to use your own logic for finding
69// a valid update, if any, in the given appcast.
70- (SUAppcastItem *)bestValidUpdateInAppcast:(SUAppcast *)appcast forUpdater:(SUUpdater *)bundle;
71
72// Sent when a valid update is found by the update driver.
73- (void)updater:(SUUpdater *)updater didFindValidUpdate:(SUAppcastItem *)update;
74
75// Sent when a valid update is not found.
76- (void)updaterDidNotFindUpdate:(SUUpdater *)update;
77
78// Sent immediately before installing the specified update.
79- (void)updater:(SUUpdater *)updater willInstallUpdate:(SUAppcastItem *)update;
80
81// Return YES to delay the relaunch until you do some processing; invoke the given NSInvocation to continue.
82- (BOOL)updater:(SUUpdater *)updater shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update untilInvoking:(NSInvocation *)invocation;
83
84// Called immediately before relaunching.
85- (void)updaterWillRelaunchApplication:(SUUpdater *)updater;
86
87// This method allows you to provide a custom version comparator.
88// If you don't implement this method or return nil, the standard version comparator will be used.
89- (id <SUVersionComparison>)versionComparatorForUpdater:(SUUpdater *)updater;
90
91// Returns the path which is used to relaunch the client after the update is installed. By default, the path of the host bundle.
92- (NSString *)pathToRelaunchForUpdater:(SUUpdater *)updater;
93
94@end
95
96// Define some minimum intervals to avoid DOS-like checking attacks. These are in seconds.
97#ifdef DEBUG
98#define SU_MIN_CHECK_INTERVAL 60
99#else
100#define SU_MIN_CHECK_INTERVAL 60*60
101#endif
102
103#ifdef DEBUG
104#define SU_DEFAULT_CHECK_INTERVAL 60
105#else
106#define SU_DEFAULT_CHECK_INTERVAL 60*60*24
107#endif
108
109#endif
Note: See TracBrowser for help on using the repository browser.