Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes #44: maximumSystemVersion key

  • Loading branch information...
commit 9662452c09a2d87eb6e1154cab5fd6629e9ed7f6 1 parent 1c258cb
Stefan Hoffmann authored
Showing with 26 additions and 2 deletions.
  1. +2 −0  SUAppcastItem.h
  2. +9 −0 SUAppcastItem.m
  3. +15 −2 SUBasicUpdateDriver.m
View
2  SUAppcastItem.h
@@ -20,6 +20,7 @@
NSString *DSASignature;
NSString *minimumSystemVersion;
+ NSString *maximumSystemVersion;
NSURL *fileURL;
NSString *versionString;
@@ -45,6 +46,7 @@
- (NSURL *)fileURL;
- (NSString *)DSASignature;
- (NSString *)minimumSystemVersion;
+- (NSString *)maximumSystemVersion;
- (NSDictionary *)deltaUpdates;
- (BOOL)isDeltaUpdate;
View
9 SUAppcastItem.m
@@ -106,6 +106,14 @@ - (void)setMinimumSystemVersion:(NSString *)systemVersionString
minimumSystemVersion = [systemVersionString copy];
}
+- (NSString *)maximumSystemVersion { return [[maximumSystemVersion retain] autorelease]; }
+- (void)setMaximumSystemVersion:(NSString *)systemVersionString
+{
+ if (maximumSystemVersion == systemVersionString) return;
+ [maximumSystemVersion release];
+ maximumSystemVersion = [systemVersionString copy];
+}
+
- (NSURL *)infoURL { return [[infoURL retain] autorelease]; } // UK 2007-08-31 (whole method)
@@ -210,6 +218,7 @@ - (BOOL)isDeltaUpdate
[self setVersionString: newVersion];
[self setMinimumSystemVersion: [dict objectForKey:@"sparkle:minimumSystemVersion"]];
+ [self setMaximumSystemVersion: [dict objectForKey:@"sparkle:maximumSystemVersion"]];
NSString *shortVersionString = [enclosure objectForKey:@"sparkle:shortVersionString"];
if (nil == shortVersionString)
View
17 SUBasicUpdateDriver.m
@@ -65,8 +65,21 @@ - (BOOL)isItemNewer:(SUAppcastItem *)ui
- (BOOL)hostSupportsItem:(SUAppcastItem *)ui
{
- if ([ui minimumSystemVersion] == nil || [[ui minimumSystemVersion] isEqualToString:@""]) { return YES; }
- return [[SUStandardVersionComparator defaultComparator] compareVersion:[ui minimumSystemVersion] toVersion:[SUHost systemVersionString]] != NSOrderedDescending;
+ if (([ui minimumSystemVersion] == nil || [[ui minimumSystemVersion] isEqualToString:@""]) &&
+ ([ui maximumSystemVersion] == nil || [[ui maximumSystemVersion] isEqualToString:@""])) { return YES; }
+
+ BOOL minimumVersionOK = TRUE;
+ BOOL maximumVersionOK = TRUE;
+
+ // Check minimum and maximum System Version
+ if ([ui minimumSystemVersion] != nil && ![[ui minimumSystemVersion] isEqualToString:@""]) {
+ minimumVersionOK = [[SUStandardVersionComparator defaultComparator] compareVersion:[ui minimumSystemVersion] toVersion:[SUHost systemVersionString]] != NSOrderedDescending;
+ }
+ if ([ui maximumSystemVersion] != nil && ![[ui maximumSystemVersion] isEqualToString:@""]) {
+ maximumVersionOK = [[SUStandardVersionComparator defaultComparator] compareVersion:[ui maximumSystemVersion] toVersion:[SUHost systemVersionString]] != NSOrderedAscending;
+ }
+
+ return minimumVersionOK && maximumVersionOK;
}
- (BOOL)itemContainsSkippedVersion:(SUAppcastItem *)ui
Please sign in to comment.
Something went wrong with that request. Please try again.