diff --git a/SUConstants.h b/SUConstants.h index c0c427af..acec7483 100644 --- a/SUConstants.h +++ b/SUConstants.h @@ -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. diff --git a/SUConstants.m b/SUConstants.m index 10984812..20e8bd2b 100644 --- a/SUConstants.m +++ b/SUConstants.m @@ -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; diff --git a/SUUpdater.m b/SUUpdater.m index 3fa6e1e6..13084446 100644 --- a/SUUpdater.m +++ b/SUUpdater.m @@ -282,11 +282,22 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv // Determine all the parameters we're attaching to the base feed URL. BOOL sendingSystemProfile = ([host boolForUserDefaultsKey:SUSendProfileInfoKey] == YES); + + // Let's only send the system profiling information once per week at most, so we normalize daily-checkers vs. biweekly-checkers and the such. + NSDate *lastSubmitDate = [host objectForUserDefaultsKey:SULastProfileSubmitDateKey]; + if(!lastSubmitDate) + lastSubmitDate = [NSDate distantPast]; + const NSTimeInterval oneWeek = 60 * 60 * 24 * 7; + sendingSystemProfile &= (-[lastSubmitDate timeIntervalSinceNow] >= oneWeek); + NSArray *parameters = [NSArray array]; if ([delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) parameters = [parameters arrayByAddingObjectsFromArray:[delegate feedParametersForUpdater:self sendingSystemProfile:sendingSystemProfile]]; if (sendingSystemProfile) + { parameters = [parameters arrayByAddingObjectsFromArray:[host systemProfile]]; + [host setObject:[NSDate date] forUserDefaultsKey:SULastProfileSubmitDateKey]; + } if (parameters == nil || [parameters count] == 0) { return baseFeedURL; } // Build up the parameterized URL.