A cleaned up and tested version of the one-submit-per-week code

This commit is contained in:
David Smith committed 2008-07-30 01:30:11 -07:00
1 parent d6acd07d5c
commit e3226d3511
3 files changed
+11

No files matched your search

+1
View File
@@ -29,6 +29,7 @@ extern NSString *SUEnableAutomaticChecksKey;
extern NSString *SUEnableAutomaticChecksKeyOld;
extern NSString *SUEnableSystemProfilingKey;
extern NSString *SUSendProfileInfoKey;
extern NSString *SULastProfileSubmitDateKey;
extern NSString *SUSparkleErrorDomain;
// Appcast phase errors.
+1
View File
@@ -27,6 +27,7 @@ NSString *SUEnableSystemProfilingKey = @"SUEnableSystemProfiling";
NSString *SUEnableAutomaticChecksKey = @"SUEnableAutomaticChecks";
NSString *SUEnableAutomaticChecksKeyOld = @"SUCheckAtStartup";
NSString *SUSendProfileInfoKey = @"SUSendProfileInfo";
NSString *SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate";
NSString *SUSparkleErrorDomain = @"SUSparkleErrorDomain";
OSStatus SUAppcastParseError = 1000;
+9
View File
@@ -282,6 +282,15 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
// Determine all the parameters we're attaching to the base feed URL.
BOOL sendingSystemProfile = ([host boolForUserDefaultsKey:SUSendProfileInfoKey] == YES);
NSDate *lastSubmitDate = [host objectForUserDefaultsKey:SULastProfileSubmitDateKey];
if(!lastSubmitDate)
lastSubmitDate = [NSDate distantPast];
#define ONE_WEEK (NSTimeInterval)(60 * 60 * 24 * 7)
sendingSystemProfile = sendingSystemProfile && (-[lastSubmitDate timeIntervalSinceNow] >= ONE_WEEK);
if(sendingSystemProfile)
[host setObject:[NSDate date] forUserDefaultsKey:SULastProfileSubmitDateKey];
NSArray *parameters = [NSArray array];
if ([delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)])
parameters = [parameters arrayByAddingObjectsFromArray:[delegate feedParametersForUpdater:self sendingSystemProfile:sendingSystemProfile]];