Add documentation to SPUSkippedUpdate

This commit is contained in:
Zorg committed 2021-05-09 20:48:32 -07:00
1 parent 0ee12d881d
commit a79f6b2a85
2 files changed
+9

No files matched your search

+6
View File
@@ -12,6 +12,12 @@ NS_ASSUME_NONNULL_BEGIN
@class SUHost, SUAppcastItem;
/*
A skipped update tracks the version and minimum autoupdate version the user skipped.
Each minimum autoupdate version is tracked as a separate release / train.
The intent is that a user choosing to skip a future major update chooses to skip that train's updates,
but a user choosing to skip a minor update only chooses to skip updates equal or preceding that update.
*/
@interface SPUSkippedUpdate : NSObject
- (instancetype)initWithVersion:(NSString *)version minimumAutoupdateVersion:(nullable NSString *)minimumAutoupdateVersion;
+3
View File
@@ -42,6 +42,7 @@
[components addObject:minimumAutoupdateVersion];
}
// We encode the version and minimum autoupdate version in a human readable form with our own separator
return [components componentsJoinedByString:SKIPPED_UPDATE_TAG_SEPARATOR];
}
@@ -68,10 +69,12 @@
{
id skippedVersions = [host objectForUserDefaultsKey:SUSkippedVersionKey];
if ([(NSObject *)skippedVersions isKindOfClass:[NSString class]]) {
// Handle legacy skipped version format with just a single skipped version
SPUSkippedUpdate *skippedUpdate = [SPUSkippedUpdate decodeSkippedUpdateFromString:skippedVersions];
return (skippedUpdate != nil) ? @[skippedUpdate] : @[];
} else if ([(NSObject *)skippedVersions isKindOfClass:[NSArray class]]) {
// Handle array of skipped updates
NSMutableArray *skippedUpdates = [NSMutableArray array];
for (id skippedUpdateObject in skippedVersions) {
SPUSkippedUpdate *skippedUpdate = [SPUSkippedUpdate decodeSkippedUpdateFromString:skippedUpdateObject];