mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
Compute current date only once for all app cast items
This commit is contained in:
1 parent
6c846d0fad
commit
e8ebf23504
1 file changed
+5
-3
Vendored
+5
-3
@@ -117,8 +117,10 @@
|
||||
// This method is used by unit tests
|
||||
+ (SUAppcast *)filterSupportedAppcast:(SUAppcast *)appcast phasedUpdateGroup:(NSNumber * _Nullable)phasedUpdateGroup
|
||||
{
|
||||
NSDate *currentDate = [NSDate date];
|
||||
|
||||
return [appcast copyByFilteringItems:^(SUAppcastItem *item) {
|
||||
return (BOOL)([[self class] itemOperatingSystemIsOK:item] && [[self class] itemIsReadyForPhasedRollout:item phasedUpdateGroup:phasedUpdateGroup]);
|
||||
return (BOOL)([[self class] itemOperatingSystemIsOK:item] && [[self class] itemIsReadyForPhasedRollout:item phasedUpdateGroup:phasedUpdateGroup currentDate:currentDate]);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -202,7 +204,7 @@
|
||||
return [[self versionComparator] compareVersion:[ui versionString] toVersion:skippedVersion] != NSOrderedDescending;
|
||||
}
|
||||
|
||||
+ (BOOL)itemIsReadyForPhasedRollout:(SUAppcastItem *)ui phasedUpdateGroup:(NSNumber * _Nullable)phasedUpdateGroup
|
||||
+ (BOOL)itemIsReadyForPhasedRollout:(SUAppcastItem *)ui phasedUpdateGroup:(NSNumber * _Nullable)phasedUpdateGroup currentDate:(NSDate *)currentDate
|
||||
{
|
||||
if (phasedUpdateGroup == nil || [ui isCriticalUpdate]) {
|
||||
return YES;
|
||||
@@ -218,7 +220,7 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSTimeInterval timeSinceRelease = [[NSDate date] timeIntervalSinceDate:itemReleaseDate];
|
||||
NSTimeInterval timeSinceRelease = [currentDate timeIntervalSinceDate:itemReleaseDate];
|
||||
|
||||
NSTimeInterval phasedRolloutInterval = [phasedRolloutIntervalObject doubleValue];
|
||||
NSTimeInterval timeToWaitForGroup = phasedRolloutInterval * phasedUpdateGroup.unsignedIntegerValue;
|
||||
|
||||
Reference in new issue
Block a user