mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0fe3db7c25 |
No files matched your search
@@ -71,7 +71,7 @@ jobs:
|
||||
run: |
|
||||
git config user.name Sparkle-Bot
|
||||
git config user.email sparkle.project.bot@gmail.com
|
||||
git tag "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
git tag "${{ github.event.inputs.marketingVersion }}"
|
||||
|
||||
- name: "Build release distribution"
|
||||
run: make release
|
||||
@@ -90,8 +90,8 @@ jobs:
|
||||
with:
|
||||
draft: true
|
||||
prerelease: ${{ env.PRERELEASE_VERSION }}
|
||||
name: "Sparkle ${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
tag_name: "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
name: "Sparkle ${{ github.event.inputs.marketingVersion }}"
|
||||
tag_name: ${{ github.event.inputs.marketingVersion }}
|
||||
fail_on_unmatched_files: true
|
||||
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
body_path: latest-changes.txt
|
||||
|
||||
@@ -52,9 +52,6 @@ If you are migrating from earlier alpha versions of Sparkle 2, please re-familia
|
||||
* Fix to prevent Sparkle manipulating the host app's high level WebView defaults from #1961 (affecting only macOS versions before 10.11 in 1.x branch) (Daniel Jalkut)
|
||||
* Add safer handling of applying binary delta files from #1990 (Zorg)
|
||||
* Don't use current date unless necessary when scheduling next update to be more resilient against rapid polling from #1991 (Zorg)
|
||||
* Prevent potential rapid update checks from sleep/wake events using a minimum monotonic delay from #2000 (Zorg)
|
||||
* Whitelist about:srcdoc as a safe web URL from #1938, #2007 (Louis Pontoise, Zorg)
|
||||
* Backport not hiding update window on deactivation from #2008 (Zorg)
|
||||
|
||||
# 1.27.0
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ SPARKLE_VERSION_PATCH = 0
|
||||
|
||||
// This should be in SemVer format or empty, ie. "-beta.1"
|
||||
// These variables must have a space after the '=' too
|
||||
SPARKLE_VERSION_SUFFIX = -beta.5
|
||||
CURRENT_PROJECT_VERSION = 2005
|
||||
SPARKLE_VERSION_SUFFIX = -beta.4
|
||||
CURRENT_PROJECT_VERSION = 2004
|
||||
|
||||
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
import PackageDescription
|
||||
|
||||
// Version is technically not required here, SPM doesn't check
|
||||
let version = "2.0.0-beta.5"
|
||||
let version = "2.0.0-beta.4"
|
||||
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
|
||||
let tag = "2.0.0-beta.5"
|
||||
let checksum = "a53a83db87a5e705d58227f6d9088c76425ddb00e0a9eded87ae845ce5903529"
|
||||
let tag = "2.0.0-beta.4"
|
||||
let checksum = "4f863dc048e8c4170e0c3fdbdb9a9b03af605adbd778aa11799db3f34068202d"
|
||||
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
|
||||
|
||||
let package = Package(
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Sparkle"
|
||||
s.version = "2.0.0-beta.5"
|
||||
s.version = "2.0.0-beta.4"
|
||||
s.summary = "A software update framework for macOS"
|
||||
s.description = "Sparkle is an easy-to-use software update framework for macOS."
|
||||
s.homepage = "https://sparkle-project.org"
|
||||
|
||||
Vendored
+1
-3
@@ -279,14 +279,12 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
|
||||
/**
|
||||
Appropriately schedules or cancels the update checking timer according to the preferences for time interval and automatic checks.
|
||||
|
||||
If you change the `updateCheckInterval` or `automaticallyChecksForUpdates` properties, the update cycle will be reset automatically after a short delay.
|
||||
The update cycle is also started automatically after the updater is started. In these cases, this method should not be called directly.
|
||||
|
||||
This call does not change the date of the next check, but only the internal timer.
|
||||
*/
|
||||
- (void)resetUpdateCycle;
|
||||
|
||||
|
||||
/**
|
||||
The system profile information that is sent when checking for updates.
|
||||
*/
|
||||
|
||||
Vendored
+20
-71
@@ -62,7 +62,6 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@property (nonatomic) BOOL showingPermissionRequest;
|
||||
|
||||
@property (nonatomic, copy) NSDate *updateLastCheckedDate;
|
||||
@property (nonatomic) NSTimeInterval lastMonotonicUpdateCheckTime;
|
||||
|
||||
@property (nonatomic) BOOL loggedATSWarning;
|
||||
@property (nonatomic) BOOL loggedNoSecureKeyWarning;
|
||||
@@ -88,7 +87,6 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@synthesize canCheckForUpdates = _canCheckForUpdates;
|
||||
@synthesize showingPermissionRequest = _showingPermissionRequest;
|
||||
@synthesize updateLastCheckedDate = _updateLastCheckedDate;
|
||||
@synthesize lastMonotonicUpdateCheckTime = _lastMonotonicUpdateCheckTime;
|
||||
@synthesize loggedATSWarning = _loggedATSWarning;
|
||||
@synthesize loggedNoSecureKeyWarning = _loggedNoSecureKeyWarning;
|
||||
|
||||
@@ -260,6 +258,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
}
|
||||
|
||||
BOOL test;
|
||||
BOOL updatingMainBundle = [self.host.bundle isEqualTo:mainBundle];
|
||||
|
||||
if (feedURL != nil) {
|
||||
@@ -404,7 +403,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
// We start the update checks and register as observer for changes after the prompt finishes
|
||||
} else {
|
||||
// We check if the user's said they want updates, or they haven't said anything, and the default is set to checking.
|
||||
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentDate:YES];
|
||||
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,27 +423,17 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
return [self updateLastCheckedDate];
|
||||
}
|
||||
|
||||
- (NSTimeInterval)currentMonotonicTimeInterval
|
||||
{
|
||||
// This is monotonic system time while the system is not asleep
|
||||
return [[NSProcessInfo processInfo] systemUptime];
|
||||
}
|
||||
|
||||
- (void)updateLastUpdateCheckDate
|
||||
{
|
||||
[self willChangeValueForKey:NSStringFromSelector(@selector((lastUpdateCheckDate)))];
|
||||
|
||||
// We use an intermediate property for last update check date due to https://github.com/sparkle-project/Sparkle/pull/1135
|
||||
[self setUpdateLastCheckedDate:[NSDate date]];
|
||||
[self.host setObject:[self updateLastCheckedDate] forUserDefaultsKey:SULastCheckTimeKey];
|
||||
|
||||
self.lastMonotonicUpdateCheckTime = [self currentMonotonicTimeInterval];
|
||||
|
||||
[self didChangeValueForKey:NSStringFromSelector(@selector((lastUpdateCheckDate)))];
|
||||
}
|
||||
|
||||
// Note this method is never called when sessionInProgress is YES
|
||||
- (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately usingCurrentDate:(BOOL)usingCurrentDate
|
||||
- (void)scheduleNextUpdateCheckFiringImmediately:(BOOL)firingImmediately usingCurrentTime:(BOOL)usingCurrentTime
|
||||
{
|
||||
[self.updaterTimer invalidate];
|
||||
|
||||
@@ -491,74 +480,34 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
// This callback is asynchronous, so the timer may be set. Invalidate to make sure it isn't.
|
||||
[self.updaterTimer invalidate];
|
||||
|
||||
NSTimeInterval dateIntervalSinceCheck;
|
||||
NSTimeInterval minimumMonotonicEnforcedDelay;
|
||||
if (usingCurrentDate) {
|
||||
NSTimeInterval intervalSinceCheck;
|
||||
if (usingCurrentTime) {
|
||||
// How long has it been since last we checked for an update?
|
||||
NSDate *lastCheckDate = [self lastUpdateCheckDate];
|
||||
if (!lastCheckDate) { lastCheckDate = [NSDate distantPast]; }
|
||||
NSTimeInterval wallTimeInterval = [[NSDate date] timeIntervalSinceDate:lastCheckDate];
|
||||
if (wallTimeInterval < 0) {
|
||||
intervalSinceCheck = [[NSDate date] timeIntervalSinceDate:lastCheckDate];
|
||||
if (intervalSinceCheck < 0) {
|
||||
// Last update check date is in the future and bogus, so reset it to current date
|
||||
[self updateLastUpdateCheckDate];
|
||||
|
||||
// And assume a full update interval is needed
|
||||
dateIntervalSinceCheck = 0;
|
||||
minimumMonotonicEnforcedDelay = SUMinimumMonotonicUpdateCheckInterval;
|
||||
} else {
|
||||
// Check the monotonic clock for an enforced minimum delay
|
||||
NSTimeInterval lastMonotonicUpdateCheckTime = self.lastMonotonicUpdateCheckTime;
|
||||
if (lastMonotonicUpdateCheckTime <= 0) {
|
||||
// When the updater is first started, the last monotonic time may not have been updated yet.
|
||||
// In this case there is no enforced minimum delay.
|
||||
minimumMonotonicEnforcedDelay = 0;
|
||||
} else {
|
||||
// Compute an enforced minimum delay based on elapsed monotonic time
|
||||
// The elapsed monotonic time is more stable than wall time interval and does not include the
|
||||
// amount of time while the system is asleep
|
||||
NSTimeInterval currentMonotonicTime = [self currentMonotonicTimeInterval];
|
||||
NSTimeInterval elapsedMonotonicTime = (currentMonotonicTime - lastMonotonicUpdateCheckTime);
|
||||
|
||||
if (elapsedMonotonicTime < SUMinimumMonotonicUpdateCheckInterval) {
|
||||
minimumMonotonicEnforcedDelay = (SUMinimumMonotonicUpdateCheckInterval - elapsedMonotonicTime);
|
||||
} else {
|
||||
minimumMonotonicEnforcedDelay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
dateIntervalSinceCheck = wallTimeInterval;
|
||||
intervalSinceCheck = 0;
|
||||
}
|
||||
} else {
|
||||
// Without using the current date, we assume a full update interval is needed
|
||||
dateIntervalSinceCheck = 0;
|
||||
minimumMonotonicEnforcedDelay = SUMinimumMonotonicUpdateCheckInterval;
|
||||
}
|
||||
|
||||
if (updateCheckInterval < SUMinimumUpdateCheckInterval) {
|
||||
updateCheckInterval = SUMinimumUpdateCheckInterval;
|
||||
intervalSinceCheck = 0;
|
||||
}
|
||||
|
||||
// Now we want to figure out how long until we check again.
|
||||
NSTimeInterval wallDelayUntilCheck;
|
||||
if (dateIntervalSinceCheck < updateCheckInterval) {
|
||||
// It hasn't been long enough.
|
||||
wallDelayUntilCheck = (updateCheckInterval - dateIntervalSinceCheck);
|
||||
if (updateCheckInterval < SUMinimumUpdateCheckInterval)
|
||||
updateCheckInterval = SUMinimumUpdateCheckInterval;
|
||||
if (intervalSinceCheck < updateCheckInterval) {
|
||||
NSTimeInterval delayUntilCheck = (updateCheckInterval - intervalSinceCheck); // It hasn't been long enough.
|
||||
if ([self.delegate respondsToSelector:@selector(updater:willScheduleUpdateCheckAfterDelay:)]) {
|
||||
[self.delegate updater:self willScheduleUpdateCheckAfterDelay:delayUntilCheck];
|
||||
}
|
||||
[self.updaterTimer startAndFireAfterDelay:delayUntilCheck];
|
||||
} else {
|
||||
wallDelayUntilCheck = 0;
|
||||
}
|
||||
|
||||
// Now compute delay with enforced minimum delay requirement
|
||||
// The minimum delay (based on monotonic clock) is an extra layer of defense to prevent too frequent update checks
|
||||
// in case the wall clock is not working properly (eg from too many system wake events, system date changes, NTP..)
|
||||
NSTimeInterval finalDelayUntilCheck = MAX(wallDelayUntilCheck, minimumMonotonicEnforcedDelay);
|
||||
if (finalDelayUntilCheck <= 0) {
|
||||
// We're overdue! Run one now.
|
||||
[self checkForUpdatesInBackground];
|
||||
} else {
|
||||
if ([self.delegate respondsToSelector:@selector(updater:willScheduleUpdateCheckAfterDelay:)]) {
|
||||
[self.delegate updater:self willScheduleUpdateCheckAfterDelay:finalDelayUntilCheck];
|
||||
}
|
||||
[self.updaterTimer startTimerWithWallTimeDelay:wallDelayUntilCheck monotonicTimeDelay:minimumMonotonicEnforcedDelay];
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -740,7 +689,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
// Ensure the delegate doesn't start a new session when being notified of the previous one ending
|
||||
if (!strongSelf.sessionInProgress) {
|
||||
if (shouldScheduleNextUpdateCheck) {
|
||||
[strongSelf scheduleNextUpdateCheckFiringImmediately:NO usingCurrentDate:NO];
|
||||
[strongSelf scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:NO];
|
||||
} else {
|
||||
SULog(SULogLevelDefault, @"Disabling scheduled updates..");
|
||||
}
|
||||
@@ -791,7 +740,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
// Ensure the delegate doesn't start a new session when being notified of the previous one ending
|
||||
if (!strongSelf.sessionInProgress) {
|
||||
[strongSelf scheduleNextUpdateCheckFiringImmediately:shouldShowUpdateImmediately usingCurrentDate:NO];
|
||||
[strongSelf scheduleNextUpdateCheckFiringImmediately:shouldShowUpdateImmediately usingCurrentTime:NO];
|
||||
}
|
||||
}
|
||||
}];
|
||||
@@ -836,7 +785,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
if (!self.sessionInProgress) {
|
||||
[self cancelNextUpdateCycle];
|
||||
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentDate:YES];
|
||||
[self scheduleNextUpdateCheckFiringImmediately:NO usingCurrentTime:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -366,7 +366,7 @@ SU_EXPORT extern NSString *const SUSystemProfilerPreferredLanguageKey;
|
||||
|
||||
Automatic update checks need to be enabled for this to trigger.
|
||||
|
||||
@param delay The delay in seconds until the next scheduled update will occur. This is an approximation and may vary due to system state.
|
||||
@param delay The delay in seconds until the next scheduled update will occur.
|
||||
|
||||
@param updater The updater instance.
|
||||
*/
|
||||
|
||||
Vendored
+1
-1
@@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (instancetype)initWithDelegate:(id<SPUUpdaterTimerDelegate>)delegate;
|
||||
|
||||
- (void)startTimerWithWallTimeDelay:(NSTimeInterval)wallDelayUntilCheck monotonicTimeDelay:(NSTimeInterval)minimumEnforcedDelay;
|
||||
- (void)startAndFireAfterDelay:(NSTimeInterval)delay;
|
||||
|
||||
- (void)invalidate;
|
||||
|
||||
|
||||
Vendored
+17
-67
@@ -15,16 +15,14 @@
|
||||
@interface SPUUpdaterTimer ()
|
||||
|
||||
@property (nonatomic, readonly, weak) id<SPUUpdaterTimerDelegate> delegate;
|
||||
@property (nonatomic) dispatch_source_t wallTimeSource;
|
||||
@property (nonatomic) dispatch_source_t monotonicTimeSource;
|
||||
@property (nonatomic) dispatch_source_t source;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SPUUpdaterTimer
|
||||
|
||||
@synthesize delegate = _delegate;
|
||||
@synthesize wallTimeSource = _wallTimeSource;
|
||||
@synthesize monotonicTimeSource = _monotonicTimeSource;
|
||||
@synthesize source = _source;
|
||||
|
||||
- (instancetype)initWithDelegate:(id<SPUUpdaterTimerDelegate>)delegate
|
||||
{
|
||||
@@ -35,76 +33,28 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)startTimerWithWallTimeDelay:(NSTimeInterval)wallTimeDelay monotonicTimeDelay:(NSTimeInterval)monotonicTimeDelay
|
||||
- (void)startAndFireAfterDelay:(NSTimeInterval)delay
|
||||
{
|
||||
self.source = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
|
||||
|
||||
// We use the wall time instead of cpu time for our dispatch timer
|
||||
// So eg if the computer sleeps we want to include that time spent in our timer
|
||||
dispatch_time_t timeToFire = dispatch_walltime(NULL, (int64_t)(delay * NSEC_PER_SEC));
|
||||
dispatch_source_set_timer(self.source, timeToFire, DISPATCH_TIME_FOREVER, SULeewayUpdateCheckInterval * NSEC_PER_SEC);
|
||||
|
||||
__weak __typeof__(self) weakSelf = self;
|
||||
// When timersFired reaches 2, both wall/monotonic timers have been fired, and the delegate is ready to receive the notification
|
||||
__block uint8_t timersFired = 0;
|
||||
dispatch_source_set_event_handler(self.source, ^{
|
||||
[weakSelf.delegate updaterTimerDidFire];
|
||||
});
|
||||
|
||||
if (wallTimeDelay <= 0) {
|
||||
timersFired++;
|
||||
self.wallTimeSource = nil;
|
||||
} else {
|
||||
// We use the wall time instead of cpu time for a large date interval
|
||||
// So eg if the computer sleeps we want to include that time spent in our timer
|
||||
self.wallTimeSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
|
||||
|
||||
dispatch_time_t wallTime = dispatch_walltime(NULL, (int64_t)(wallTimeDelay * NSEC_PER_SEC));
|
||||
dispatch_source_set_timer(self.wallTimeSource, wallTime, DISPATCH_TIME_FOREVER, SULeewayWallUpdateCheckInterval * NSEC_PER_SEC);
|
||||
|
||||
dispatch_source_set_event_handler(self.wallTimeSource, ^{
|
||||
timersFired++;
|
||||
if (timersFired > 1) {
|
||||
[weakSelf.delegate updaterTimerDidFire];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (monotonicTimeDelay <= 0) {
|
||||
timersFired++;
|
||||
self.monotonicTimeSource = nil;
|
||||
} else {
|
||||
// We also use monotonic time to enforce a minimum delay interval
|
||||
// This ensures we don't fire the wall clock based timer too frequently if the real clock changes
|
||||
self.monotonicTimeSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
|
||||
|
||||
dispatch_time_t monotonicTime = dispatch_time(DISPATCH_TIME_NOW , (int64_t)(monotonicTimeDelay * NSEC_PER_SEC));
|
||||
dispatch_source_set_timer(self.monotonicTimeSource, monotonicTime, DISPATCH_TIME_FOREVER, SULeewayMonotonicUpdateCheckInterval * NSEC_PER_SEC);
|
||||
|
||||
dispatch_source_set_event_handler(self.monotonicTimeSource, ^{
|
||||
timersFired++;
|
||||
if (timersFired > 1) {
|
||||
[weakSelf.delegate updaterTimerDidFire];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Have both timers already ran? (this should be unlikely)
|
||||
if (timersFired > 1) {
|
||||
[self.delegate updaterTimerDidFire];
|
||||
} else {
|
||||
// Resume available timers
|
||||
|
||||
if (self.wallTimeSource != nil) {
|
||||
dispatch_resume(self.wallTimeSource);
|
||||
}
|
||||
|
||||
if (self.monotonicTimeSource != nil) {
|
||||
dispatch_resume(self.monotonicTimeSource);
|
||||
}
|
||||
}
|
||||
dispatch_resume(self.source);
|
||||
}
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
if (self.wallTimeSource != nil) {
|
||||
dispatch_source_cancel(self.wallTimeSource);
|
||||
self.wallTimeSource = nil;
|
||||
}
|
||||
|
||||
if (self.monotonicTimeSource != nil) {
|
||||
dispatch_source_cancel(self.monotonicTimeSource);
|
||||
self.monotonicTimeSource = nil;
|
||||
if (self.source != nil) {
|
||||
dispatch_source_cancel(self.source);
|
||||
self.source = nil;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-3
@@ -19,9 +19,7 @@
|
||||
extern const NSTimeInterval SUDefaultUpdatePermissionPromptInterval;
|
||||
extern const NSTimeInterval SUMinimumUpdateCheckInterval;
|
||||
extern const NSTimeInterval SUDefaultUpdateCheckInterval;
|
||||
extern const NSTimeInterval SUMinimumMonotonicUpdateCheckInterval;
|
||||
extern const uint64_t SULeewayWallUpdateCheckInterval;
|
||||
extern const uint64_t SULeewayMonotonicUpdateCheckInterval;
|
||||
extern const uint64_t SULeewayUpdateCheckInterval;
|
||||
extern const NSTimeInterval SUImpatientUpdateCheckInterval;
|
||||
|
||||
extern NSString *const SUBundleIdentifier;
|
||||
|
||||
Vendored
+1
-4
@@ -18,11 +18,8 @@
|
||||
// Define some minimum intervals to avoid DoS-like checking attacks
|
||||
const NSTimeInterval SUMinimumUpdateCheckInterval = DEBUG ? 60 : (60 * 60);
|
||||
const NSTimeInterval SUDefaultUpdateCheckInterval = DEBUG ? 60 : (60 * 60 * 24);
|
||||
const NSTimeInterval SUMinimumMonotonicUpdateCheckInterval = DEBUG ? 30 : (60 * 5);
|
||||
|
||||
// The amount of time the system can defer our update check (for improved performance)
|
||||
const uint64_t SULeewayWallUpdateCheckInterval = DEBUG ? 1 : 60;
|
||||
const uint64_t SULeewayMonotonicUpdateCheckInterval = DEBUG ? 1 : 5;
|
||||
const uint64_t SULeewayUpdateCheckInterval = DEBUG ? 1 : 15;
|
||||
|
||||
// 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
|
||||
|
||||
@@ -26,10 +26,6 @@ class SUTestApplicationTest: XCTestCase
|
||||
func testRegularUpdate()
|
||||
{
|
||||
let app = XCUIApplication()
|
||||
app.launchArguments = [
|
||||
"-AppleLanguages",
|
||||
"(en)"
|
||||
]
|
||||
app.launch()
|
||||
|
||||
XCTAssertFalse(app.dialogs["alert"].staticTexts["Update succeeded!"].exists, "Update is already installed; please do a clean build")
|
||||
|
||||
@@ -49,7 +49,7 @@ func extractVersion(parent: XMLNode) -> String? {
|
||||
return nil
|
||||
}
|
||||
|
||||
func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set<String>?, maxNewVersionsInFeed: Int, fullReleaseNotesLink: String?, link: String?, newChannel: String?, majorVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) {
|
||||
func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set<String>?, maxNewVersionsInFeed: Int, link: String?, newChannel: String?, majorVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) {
|
||||
let appBaseName = updates[0].appPath.deletingPathExtension().lastPathComponent
|
||||
|
||||
let sparkleNS = "http://www.andymatuschak.org/xml-namespaces/sparkle"
|
||||
@@ -168,12 +168,6 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set
|
||||
item.addChild(linkElement)
|
||||
}
|
||||
|
||||
if let fullReleaseNotesLink = fullReleaseNotesLink,
|
||||
let fullReleaseNotesElement = XMLElement.element(withName: SUAppcastElementFullReleaseNotesLink, uri: sparkleNS) as? XMLElement {
|
||||
fullReleaseNotesElement.setChildren([text(fullReleaseNotesLink)])
|
||||
item.addChild(fullReleaseNotesElement)
|
||||
}
|
||||
|
||||
// Set new channel name
|
||||
if let newChannelName = newChannel,
|
||||
let channelNameElement = XMLElement.element(withName: SUAppcastElementChannel, uri: sparkleNS) as? XMLElement {
|
||||
|
||||
@@ -72,9 +72,6 @@ struct GenerateAppcast: ParsableCommand {
|
||||
@Option(name: .customLong("release-notes-url-prefix"), help: ArgumentHelp("A URL that will be used as prefix for constructing URLs for release notes.", valueName: "url"), transform: { URL(string: $0) })
|
||||
var releaseNotesURLPrefix : URL?
|
||||
|
||||
@Option(name: .customLong("full-release-notes-url"), help: ArgumentHelp("A URL that will be used for the full release notes.", valueName: "url"))
|
||||
var fullReleaseNotesURL: String?
|
||||
|
||||
@Option(name: .long, help: ArgumentHelp("A URL to the application's website which Sparkle may use for directing users to if they cannot download a new update from within the application. This will be used for new generated update items. By default, no product link is used.", valueName: "link"))
|
||||
var link: String?
|
||||
|
||||
@@ -223,7 +220,7 @@ struct GenerateAppcast: ParsableCommand {
|
||||
relativeTo: archivesSourceDir)
|
||||
|
||||
// Write the appcast
|
||||
let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, fullReleaseNotesLink: fullReleaseNotesURL, link: link, newChannel: channel, majorVersion: majorVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions)
|
||||
let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, link: link, newChannel: channel, majorVersion: majorVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions)
|
||||
|
||||
// Inform the user, pluralizing "update" if necessary
|
||||
let pluralizeUpdates = { $0 == 1 ? "update" : "updates" }
|
||||
|
||||
Reference in new issue
Block a user