From 48e0febf1a8455b5449f71cb464c0cb74d1efa25 Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 15 Feb 2016 00:18:01 -0500 Subject: [PATCH] Add NSSecureCoding to SUUpdatePermissionPromptResult --- Sparkle/SUUpdatePermissionPromptResult.h | 2 +- Sparkle/SUUpdatePermissionPromptResult.m | 18 ++++++++++++++++++ Sparkle/SUUserUpdaterDriver.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Sparkle/SUUpdatePermissionPromptResult.h b/Sparkle/SUUpdatePermissionPromptResult.h index 2a072590..882b71c1 100644 --- a/Sparkle/SUUpdatePermissionPromptResult.h +++ b/Sparkle/SUUpdatePermissionPromptResult.h @@ -13,7 +13,7 @@ typedef NS_ENUM(NSInteger, SUCheckUpdatesChoice) { SUDoNotAutomaticallyCheck }; -@interface SUUpdatePermissionPromptResult : NSObject +@interface SUUpdatePermissionPromptResult : NSObject + (instancetype)updatePermissionPromptResultWithChoice:(SUCheckUpdatesChoice)choice shouldSendProfile:(BOOL)shouldSendProfile; diff --git a/Sparkle/SUUpdatePermissionPromptResult.m b/Sparkle/SUUpdatePermissionPromptResult.m index 57b122ec..7f03b6b8 100644 --- a/Sparkle/SUUpdatePermissionPromptResult.m +++ b/Sparkle/SUUpdatePermissionPromptResult.m @@ -13,6 +13,24 @@ @synthesize choice = _choice; @synthesize shouldSendProfile = _shouldSendProfile; ++ (BOOL)supportsSecureCoding +{ + return YES; +} + +- (instancetype)initWithCoder:(NSCoder *)decoder +{ + NSInteger choice = [decoder decodeIntegerForKey:@"choice"]; + BOOL shouldSendProfile = [decoder decodeBoolForKey:@"shouldSendProfile"]; + return [[self class] updatePermissionPromptResultWithChoice:choice shouldSendProfile:shouldSendProfile]; +} + +- (void)encodeWithCoder:(NSCoder *)encoder +{ + [encoder encodeInteger:self.choice forKey:@"choice"]; + [encoder encodeBool:self.shouldSendProfile forKey:@"shouldSendProfile"]; +} + - (instancetype)initWithCheckUpdatesChoice:(SUCheckUpdatesChoice)choice shouldSendProfile:(BOOL)shouldSendProfile { self = [super init]; diff --git a/Sparkle/SUUserUpdaterDriver.h b/Sparkle/SUUserUpdaterDriver.h index 3c929d98..c34f7dde 100644 --- a/Sparkle/SUUserUpdaterDriver.h +++ b/Sparkle/SUUserUpdaterDriver.h @@ -17,6 +17,7 @@ - (instancetype)initWithHost:(SUHost *)host; +#warning might need to whitelist class types for systemProfile.. need to test this - (void)requestUpdatePermissionWithSystemProfile:(NSArray *)systemProfile reply:(void (^)(SUUpdatePermissionPromptResult *))reply; - (void)openInfoURLForAppcastItem:(SUAppcastItem *)appcastItem;