diff --git a/Application/Dopamine/UI/DOUIManager.h b/Application/Dopamine/UI/DOUIManager.h index 0ee67e8e9..cd6771a67 100644 --- a/Application/Dopamine/UI/DOUIManager.h +++ b/Application/Dopamine/UI/DOUIManager.h @@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN - (NSArray *)getLatestReleases; - (NSString*)getLaunchedReleaseTag; - (NSString*)getLatestReleaseTag; -- (NSArray *)getUpdatesInRange: (NSString *)start end: (NSString *)end; +- (NSArray *)getUpdatesInRange:(NSString *)start end:(NSString *)end; - (bool)launchedReleaseNeedsManualUpdate; - (NSArray*)availablePackageManagers; - (NSArray*)enabledPackageManagerKeys; diff --git a/Application/Dopamine/UI/DOUIManager.m b/Application/Dopamine/UI/DOUIManager.m index 7c70189c4..dd3d11f8b 100644 --- a/Application/Dopamine/UI/DOUIManager.m +++ b/Application/Dopamine/UI/DOUIManager.m @@ -33,11 +33,7 @@ - (id)init - (BOOL)isUpdateAvailable { - NSArray *releases = [self getLatestReleases]; - if (releases.count == 0) - return NO; - - NSString *latestVersion = releases[0][@"tag_name"]; + NSString *latestVersion = [self getLatestReleaseTag]; NSString *currentVersion = [self getLaunchedReleaseTag]; return [self numericalRepresentationForVersion:latestVersion] > [self numericalRepresentationForVersion:currentVersion]; } @@ -55,7 +51,7 @@ - (long long)numericalRepresentationForVersion:(NSString*)version { return numericalRepresentation; } -- (NSArray *)getUpdatesInRange: (NSString *)start end: (NSString *)end +- (NSArray *)getUpdatesInRange:(NSString *)start end:(NSString *)end { NSArray *releases = [self getLatestReleases]; if (releases.count == 0) @@ -66,6 +62,11 @@ - (NSArray *)getUpdatesInRange: (NSString *)start end: (NSString *)end NSMutableArray *updates = [NSMutableArray new]; for (NSDictionary *release in releases) { NSString *version = release[@"tag_name"]; + NSNumber *prerelease = release[@"prerelease"]; + if ([prerelease boolValue]) { + // Skip prereleases + continue; + } long long numericalVersion = [self numericalRepresentationForVersion:version]; if (numericalVersion > startVersion && numericalVersion <= endVersion) { [updates addObject:release]; @@ -121,9 +122,14 @@ - (bool)launchedReleaseNeedsManualUpdate - (NSString*)getLatestReleaseTag { NSArray *releases = [self getLatestReleases]; - if (releases.count == 0) - return nil; - return releases[0][@"tag_name"]; + for (NSDictionary *release in releases) { + NSNumber *prerelease = release[@"prerelease"]; + if ([prerelease boolValue]) { + continue; + } + return release[@"tag_name"]; + } + return nil; } - (NSString*)getLaunchedReleaseTag