Skip to content

Instantly share code, notes, and snippets.

@pilky
Created November 23, 2011 12:58
Show Gist options
  • Save pilky/1388608 to your computer and use it in GitHub Desktop.
Save pilky/1388608 to your computer and use it in GitHub Desktop.
- (void)sendDetails {
if ([self _shouldShowPrompt]) {
[permissionPromptController showWindow:self];
} else {
[submitter submitDetails];
}
}
- (BOOL)_shouldShowPrompt {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
//Do we have a URL set?
if (![[NSBundle mainBundle] objectForInfoDictionaryKey:TWSProfileURL])
return NO;
//If sparkle exists, has it done its setup yet?
if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"SUFeedURL"]) {
if (![defaults boolForKey:@"SUHasLaunchedBefore"])
return NO;
}
//Have we launched before
if (![defaults boolForKey:TWSHasLaunchedBefore]) {
[defaults setBool:YES forKey:TWSHasLaunchedBefore];
return NO;
}
//Have we already asked the question?
if ([defaults objectForKey:TWSSendSystemProfile])
return NO;
return YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment