Declare informationOnlyUpdate as a property of SUAppcastItem.

Declaring a property makes it obvious where changes to the logic about whether an update is "information only" should be made, and leaves the code at the calling point more readable. Instead of inferring that an appast item is information only by the simple omission of a fileURL, require that it also have a infoURL.
This commit is contained in:
Daniel Jalkut committed 2015-07-27 15:13:07 -04:00
1 parent 70dcb05319
commit d75856cfee
3 files changed
+7 -1

No files matched your search

+1
View File
@@ -32,6 +32,7 @@ SU_EXPORT @interface SUAppcastItem : NSObject
@property (getter=isDeltaUpdate, readonly) BOOL deltaUpdate;
@property (getter=isCriticalUpdate, readonly) BOOL criticalUpdate;
@property (getter=isInformationOnlyUpdate, readonly) BOOL informationOnlyUpdate;
// Returns the dictionary provided in initWithDictionary; this might be useful later for extensions.
@property (readonly, copy) NSDictionary *propertiesDictionary;
+5
View File
@@ -55,6 +55,11 @@
return [self.propertiesDictionary[SUAppcastElementTags] containsObject:SUAppcastElementCriticalUpdate];
}
- (BOOL)isInformationOnlyUpdate
{
return (([self infoURL] != nil) && ([self fileURL] == nil));
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
return [self initWithDictionary:dict failureReason:nil];
+1 -1
View File
@@ -186,7 +186,7 @@
[self.window setLevel:NSFloatingWindowLevel]; // This means the window will float over all other apps, if our app is switched out ?!
}
if ([self.updateItem fileURL] == nil) {
if (self.updateItem.isInformationOnlyUpdate) {
[self.installButton setTitle:SULocalizedString(@"Learn More...", @"Alternate title for 'Install Update' button when there's no download in RSS feed.")];
[self.installButton setAction:@selector(openInfoURL:)];
}