diff --git a/SUSystemProfiler.m b/SUSystemProfiler.m index 05099f7a..47d5909c 100644 --- a/SUSystemProfiler.m +++ b/SUSystemProfiler.m @@ -33,7 +33,7 @@ // Gather profile information and append it to the URL. NSMutableArray *profileArray = [NSMutableArray array]; - NSArray *profileDictKeys = [NSArray arrayWithObjects:@"key", @"visibleKey", @"value", @"visibleValue", nil]; + NSArray *profileDictKeys = [NSArray arrayWithObjects:@"key", @"displayKey", @"value", @"displayValue", nil]; int error = 0 ; int value = 0 ; unsigned long length = sizeof(value) ; diff --git a/SUUpdatePermissionPrompt.h b/SUUpdatePermissionPrompt.h index 09bb3b4b..fae8d0de 100644 --- a/SUUpdatePermissionPrompt.h +++ b/SUUpdatePermissionPrompt.h @@ -19,13 +19,14 @@ typedef enum { @class SUHost; @interface SUUpdatePermissionPrompt : SUWindowController { SUHost *host; + NSArray *systemProfileInformationArray; id delegate; IBOutlet NSTextField *descriptionTextField; IBOutlet NSView *moreInfoView; IBOutlet NSButton *moreInfoButton; BOOL isShowingMoreInfo, shouldSendProfile; } -+ (void)promptWithHost:(SUHost *)aHost delegate:(id)d; ++ (void)promptWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d; - (IBAction)toggleMoreInfo:(id)sender; - (IBAction)finishPrompt:(id)sender; @end diff --git a/SUUpdatePermissionPrompt.m b/SUUpdatePermissionPrompt.m index 0eba27f5..8d0b80b5 100644 --- a/SUUpdatePermissionPrompt.m +++ b/SUUpdatePermissionPrompt.m @@ -17,7 +17,7 @@ return [[host objectForInfoDictionaryKey:SUEnableSystemProfilingKey] boolValue]; } -- (id)initWithHost:(SUHost *)aHost delegate:(id)d +- (id)initWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d { self = [super initWithHost:aHost windowNibName:@"SUUpdatePermissionPrompt"]; if (self) @@ -26,19 +26,20 @@ delegate = [d retain]; isShowingMoreInfo = NO; shouldSendProfile = [self shouldAskAboutProfile]; + systemProfileInformationArray = [profile retain]; [self setShouldCascadeWindows:NO]; } return self; } -+ (void)promptWithHost:(SUHost *)host delegate:(id)d ++ (void)promptWithHost:(SUHost *)aHost systemProfile:(NSArray *)profile delegate:(id)d { // If this is a background application we need to focus it in order to bring the prompt // to the user's attention. Otherwise the prompt would be hidden behind other applications and // the user would not know why the application was paused. - if ([host isBackgroundApplication]) { [NSApp activateIgnoringOtherApps:YES]; } + if ([aHost isBackgroundApplication]) { [NSApp activateIgnoringOtherApps:YES]; } - id prompt = [[[self class] alloc] initWithHost:host delegate:d]; + id prompt = [[[self class] alloc] initWithHost:aHost systemProfile:profile delegate:d]; [NSApp runModalForWindow:[prompt window]]; } @@ -55,6 +56,7 @@ - (void)dealloc { [host release]; + [systemProfileInformationArray release]; [super dealloc]; } @@ -68,11 +70,6 @@ return [NSString stringWithFormat:SULocalizedString(@"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu.", nil), [host name]]; } -- (NSArray *)systemProfileInformationArray -{ - return [host systemProfile]; -} - - (IBAction)toggleMoreInfo:(id)sender { [self willChangeValueForKey:@"isShowingMoreInfo"]; diff --git a/SUUpdater.h b/SUUpdater.h index cdf3d066..b3241a32 100644 --- a/SUUpdater.h +++ b/SUUpdater.h @@ -56,8 +56,7 @@ @end @interface NSObject (SUUpdaterDelegateInformalProtocol) -// 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" and "value". +// 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. - (NSArray *)feedParametersForUpdater:(SUUpdater *)updater sendingSystemProfile:(BOOL)sendingProfile; // Use this to override the default behavior for Sparkle prompting the user about automatic update checks. diff --git a/SUUpdater.m b/SUUpdater.m index 5a191b6e..bbd82c5d 100644 --- a/SUUpdater.m +++ b/SUUpdater.m @@ -19,6 +19,7 @@ @interface SUUpdater (Private) - initForBundle:(NSBundle *)bundle; - (void)checkForUpdatesWithDriver:(SUUpdateDriver *)updateDriver; +- (BOOL)_sendingSystemProfile; - (BOOL)automaticallyUpdates; - (void)scheduleNextUpdateCheck; - (void)registerAsObserver; @@ -108,7 +109,10 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv if (shouldPrompt) { - [SUUpdatePermissionPrompt promptWithHost:host delegate:self]; + NSArray *profileInfo = [host systemProfile]; + if ([delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)]) + profileInfo = [profileInfo arrayByAddingObjectsFromArray:[delegate feedParametersForUpdater:self sendingSystemProfile:[self _sendingSystemProfile]]]; + [SUUpdatePermissionPrompt promptWithHost:host systemProfile:profileInfo delegate:self]; // We start the update checks and register as observer for changes after the prompt finishes } else @@ -275,12 +279,17 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv return [NSURL URLWithString:[appcastString stringByTrimmingCharactersInSet:quoteSet]]; } +- (BOOL)_sendingSystemProfile +{ + return ([host boolForUserDefaultsKey:SUSendProfileInfoKey] == YES); +} + - (NSURL *)parameterizedFeedURL { NSURL *baseFeedURL = [self feedURL]; // Determine all the parameters we're attaching to the base feed URL. - BOOL sendingSystemProfile = ([host boolForUserDefaultsKey:SUSendProfileInfoKey] == YES); + BOOL sendingSystemProfile = [self _sendingSystemProfile]; // 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]; diff --git a/en.lproj/SUUpdatePermissionPrompt.nib/info.nib b/en.lproj/SUUpdatePermissionPrompt.nib/info.nib index 87e931ee..b1cd28ed 100644 --- a/en.lproj/SUUpdatePermissionPrompt.nib/info.nib +++ b/en.lproj/SUUpdatePermissionPrompt.nib/info.nib @@ -3,7 +3,7 @@ IBFramework Version - 667 + 670 IBLastKnownRelativeProjectPath ../Sparkle.xcodeproj IBOldestOS @@ -11,10 +11,10 @@ IBOpenObjects 6 - 39 + 41 IBSystem Version - 9D34 + 10A96 targetFramework IBCocoaFramework diff --git a/en.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib b/en.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib index 7d3fefb9..e8dc5b88 100644 Binary files a/en.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib and b/en.lproj/SUUpdatePermissionPrompt.nib/keyedobjects.nib differ