From a79f6b2a851edf0a21d13232e387d59c4dbcea80 Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 9 May 2021 20:48:32 -0700 Subject: [PATCH] Add documentation to SPUSkippedUpdate --- Sparkle/SPUSkippedUpdate.h | 6 ++++++ Sparkle/SPUSkippedUpdate.m | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Sparkle/SPUSkippedUpdate.h b/Sparkle/SPUSkippedUpdate.h index d1124ebd..0e647301 100644 --- a/Sparkle/SPUSkippedUpdate.h +++ b/Sparkle/SPUSkippedUpdate.h @@ -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; diff --git a/Sparkle/SPUSkippedUpdate.m b/Sparkle/SPUSkippedUpdate.m index 5548fd7b..1c732c96 100644 --- a/Sparkle/SPUSkippedUpdate.m +++ b/Sparkle/SPUSkippedUpdate.m @@ -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];