mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
Previously phased rollouts did not work if the user/developer set updates to be automatically downloaded in 1.x
65 lines
1.7 KiB
Objective-C
65 lines
1.7 KiB
Objective-C
//
|
|
// SUScheduledUpdateDriver.m
|
|
// Sparkle
|
|
//
|
|
// Created by Andy Matuschak on 5/6/08.
|
|
// Copyright 2008 Andy Matuschak. All rights reserved.
|
|
//
|
|
|
|
#import "SUScheduledUpdateDriver.h"
|
|
#import "SUUpdaterPrivate.h"
|
|
#import "SUUpdaterDelegate.h"
|
|
|
|
#import "SUAppcastItem.h"
|
|
|
|
@implementation SUScheduledUpdateDriver
|
|
|
|
- (instancetype)initWithUpdater:(id<SUUpdaterPrivate>)anUpdater
|
|
{
|
|
if ((self = [super initWithUpdater:anUpdater])) {
|
|
self.showErrors = NO;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (BOOL)usesPhasedRollout
|
|
{
|
|
return YES;
|
|
}
|
|
|
|
- (void)didFindValidUpdate
|
|
{
|
|
self.showErrors = YES; // We only start showing errors after we present the UI for the first time.
|
|
[super didFindValidUpdate];
|
|
}
|
|
|
|
- (void)didNotFindUpdate
|
|
{
|
|
id<SUUpdaterPrivate> updater = self.updater;
|
|
id<SUUpdaterDelegate> updaterDelegate = [updater delegate];
|
|
|
|
if ([updaterDelegate respondsToSelector:@selector(updaterDidNotFindUpdate:)]) {
|
|
[updaterDelegate updaterDidNotFindUpdate:self.updater];
|
|
}
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:self.updater];
|
|
|
|
[self abortUpdate]; // Don't tell the user that no update was found; this was a scheduled update.
|
|
}
|
|
|
|
- (BOOL)shouldDisableKeyboardShortcutForInstallButton {
|
|
return YES;
|
|
}
|
|
|
|
- (BOOL)shouldShowUpdateAlertForItem:(SUAppcastItem *)item {
|
|
id<SUUpdaterPrivate> updater = self.updater;
|
|
id<SUUpdaterDelegate> updaterDelegate = [updater delegate];
|
|
|
|
if ([updaterDelegate respondsToSelector:@selector(updaterShouldShowUpdateAlertForScheduledUpdate:forItem:)]) {
|
|
return [updaterDelegate updaterShouldShowUpdateAlertForScheduledUpdate:self.updater forItem:item];
|
|
}
|
|
|
|
return [super shouldShowUpdateAlertForItem:item];
|
|
}
|
|
|
|
@end
|