mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-27 05:04:27 +00:00
Revert back to asking for updater permission on 2nd launch
I don't think I have a great justification anymore for waiting more than 'x' hours. This may just be an artifact when I was initially architecting Sparkle so that the entire framework could be stuffed into an XPC service.
This commit is contained in:
1 parent
0b32116f65
commit
a34102a140
3 files changed
+7
-22
No files matched your search
Vendored
+5
-17
@@ -247,8 +247,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
- (void)startUpdateCycle
|
||||
{
|
||||
BOOL shouldPrompt = NO;
|
||||
NSDate *firstLaunchDate = [self.host objectForUserDefaultsKey:SUTimeIntervalAtFirstLaunchKey];
|
||||
NSDate *currentDate = [NSDate date];
|
||||
BOOL hasLaunchedBefore = [self.host boolForUserDefaultsKey:SUHasLaunchedBeforeKey];
|
||||
|
||||
// If the user has been asked about automatic checks, don't bother prompting
|
||||
// When the user answers to the permission prompt, this will be set to either @YES or @NO instead of nil
|
||||
@@ -265,23 +264,12 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
// Has the user been asked already? And don't ask if the host has a default value set in its Info.plist.
|
||||
else if ([self.host objectForKey:SUEnableAutomaticChecksKey] == nil) {
|
||||
// Now, we don't want to ask the user for permission to do a weird thing right when they install the app
|
||||
// We wait until another launch after a few hours have passed, unless explicitly overridden via SUPromptUserOnFirstLaunchKey.
|
||||
|
||||
if ([self.host objectForKey:SUPromptUserOnFirstLaunchKey] != nil) {
|
||||
shouldPrompt = YES;
|
||||
} else if (firstLaunchDate != nil) {
|
||||
NSTimeInterval intervalSinceFirstLaunch = [currentDate timeIntervalSinceDate:firstLaunchDate];
|
||||
// We want to prompt if more than (or equal to) 'SUDefaultUpdatePermissionPromptInterval' seconds have passed since the first launch
|
||||
// If the first launch time is after (or equal to) our current date, then something may have gone wrong in the system - prompt to be on the safe side
|
||||
if (intervalSinceFirstLaunch >= SUDefaultUpdatePermissionPromptInterval || intervalSinceFirstLaunch <= 0) {
|
||||
shouldPrompt = YES;
|
||||
}
|
||||
}
|
||||
// We wait until the second launch of the updater for this host bundle, unless explicitly overridden via SUPromptUserOnFirstLaunchKey.
|
||||
shouldPrompt = [self.host objectForKey:SUPromptUserOnFirstLaunchKey] || hasLaunchedBefore;
|
||||
}
|
||||
|
||||
if (firstLaunchDate == nil) {
|
||||
[self.host setObject:currentDate forUserDefaultsKey:SUTimeIntervalAtFirstLaunchKey];
|
||||
if (!hasLaunchedBefore) {
|
||||
[self.host setBool:YES forUserDefaultsKey:SUHasLaunchedBeforeKey];
|
||||
}
|
||||
|
||||
if (shouldPrompt) {
|
||||
|
||||
Vendored
+1
-1
@@ -34,6 +34,7 @@ extern NSString *const SUTechnicalErrorInformationKey;
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
extern NSString *const SUFeedURLKey;
|
||||
extern NSString *const SUHasLaunchedBeforeKey;
|
||||
extern NSString *const SUShowReleaseNotesKey;
|
||||
extern NSString *const SUSkippedVersionKey;
|
||||
extern NSString *const SUScheduledCheckIntervalKey;
|
||||
@@ -48,7 +49,6 @@ extern NSString *const SUEnableSystemProfilingKey;
|
||||
extern NSString *const SUSendProfileInfoKey;
|
||||
extern NSString *const SULastProfileSubmitDateKey;
|
||||
extern NSString *const SUPromptUserOnFirstLaunchKey;
|
||||
extern NSString *const SUTimeIntervalAtFirstLaunchKey;
|
||||
extern NSString *const SUKeepDownloadOnFailedInstallKey;
|
||||
extern NSString *const SUDefaultsDomainKey;
|
||||
extern NSString *const SUEnableJavaScriptKey;
|
||||
|
||||
Vendored
+1
-4
@@ -21,9 +21,6 @@
|
||||
const NSTimeInterval SUMinimumUpdateCheckInterval = DEBUG ? 60 : (60 * 60);
|
||||
const NSTimeInterval SUDefaultUpdateCheckInterval = DEBUG ? 60 : (60 * 60 * 24);
|
||||
|
||||
// Define the amount of time between Sparkle being started for the first time and before we can prompt the user for permission about checking for updates automatically
|
||||
const NSTimeInterval SUDefaultUpdatePermissionPromptInterval = DEBUG ? (60 * 3) : (60 * 60 * 3);
|
||||
|
||||
// If the update has already been automatically downloaded, we normally don't want to bug the user about the update
|
||||
// However if the user has gone a very long time without quitting an application, we will bug them
|
||||
// This is the time interval for a "week"; it doesn't matter that this measure is imprecise.
|
||||
@@ -34,6 +31,7 @@ NSString *const SUBundleIdentifier = @SPARKLE_BUNDLE_IDENTIFIER;
|
||||
NSString *const SUTechnicalErrorInformationKey = @"SUTechnicalErrorInformation";
|
||||
|
||||
NSString *const SUFeedURLKey = @"SUFeedURL";
|
||||
NSString *const SUHasLaunchedBeforeKey = @"SUHasLaunchedBefore";
|
||||
NSString *const SUShowReleaseNotesKey = @"SUShowReleaseNotes";
|
||||
NSString *const SUSkippedVersionKey = @"SUSkippedVersion";
|
||||
NSString *const SUScheduledCheckIntervalKey = @"SUScheduledCheckInterval";
|
||||
@@ -48,7 +46,6 @@ NSString *const SUEnableAutomaticChecksKey = @"SUEnableAutomaticChecks";
|
||||
NSString *const SUSendProfileInfoKey = @"SUSendProfileInfo";
|
||||
NSString *const SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate";
|
||||
NSString *const SUPromptUserOnFirstLaunchKey = @"SUPromptUserOnFirstLaunch";
|
||||
NSString *const SUTimeIntervalAtFirstLaunchKey = @"SUTimeIntervalAtTheFirstLaunch";
|
||||
NSString *const SUEnableJavaScriptKey = @"SUEnableJavaScript";
|
||||
NSString *const SUFixedHTMLDisplaySizeKey = @"SUFixedHTMLDisplaySize";
|
||||
NSString *const SUKeepDownloadOnFailedInstallKey = @"SUKeepDownloadOnFailedInstall";
|
||||
|
||||
Reference in new issue
Block a user