Allow check for updates even though download not possible

This commit is contained in:
Marcus Ososbase committed 2017-06-22 17:28:28 -04:00
1 parent ece2b2e642
commit f5d3cb4500
3 files changed
+18 -14

No files matched your search

+15 -1
View File
@@ -212,7 +212,21 @@
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification
object:self.updater
userInfo:@{ SUUpdaterAppcastItemNotificationKey: self.updateItem }];
[self downloadUpdate];
if (![updater automaticallyDownloadsUpdates])
{
// TB: App is in a non writable directory
NSError *error =
[NSError errorWithDomain:SUSparkleErrorDomain code:SUHostDirectoryNotWritable
userInfo:@{NSLocalizedDescriptionKey: SULocalizedString(@"Host directory is not writable", nil)}];
[self abortUpdateWithError:error];
}
else
{
[self downloadUpdate];
}
}
- (void)didNotFindUpdate
+1 -13
View File
@@ -284,22 +284,10 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
- (void)checkForUpdatesInBackground
{
// Do not use reachability for a preflight check. This can be deceptive and a bad idea. Apple does not recommend doing it.
BOOL canAutomaticallyDownloadUpdates = [self automaticallyDownloadsUpdates];
if (!canAutomaticallyDownloadUpdates)
{
// TB: App is in a non writable directory
if ([self.delegate respondsToSelector:@selector(updater:didAbortWithError:)]) {
NSError *error =
[NSError errorWithDomain:SUSparkleErrorDomain code:SUHostDirectoryNotWritable
userInfo:@{NSLocalizedDescriptionKey: SULocalizedString(@"Host directory is not writable", nil)}];
[self.delegate updater:self didAbortWithError:error];
}
return;
}
SUUpdateDriver *theUpdateDriver;
if (canAutomaticallyDownloadUpdates || [self.delegate suppressSparkleUI])
if ([self.delegate suppressSparkleUI])
{
theUpdateDriver = [[SUAutomaticUpdateDriver alloc] initWithUpdater:self];
}
+2
View File
@@ -20,4 +20,6 @@
@property (strong, readonly) NSBundle *sparkleBundle;
@property BOOL automaticallyDownloadsUpdates;
@end