From 6288685cadf497d95bfb1dbb2b78c491da289933 Mon Sep 17 00:00:00 2001 From: Sebastian Roth Date: Thu, 28 Jul 2011 00:22:01 +0200 Subject: [PATCH] Added function to disable the More button. --- Classes/ShareKit/Core/SHK.h | 3 +++ Classes/ShareKit/Core/SHK.m | 10 ++++++++++ Classes/ShareKit/SHKConfig.h | 2 +- Classes/ShareKit/UI/SHKActionSheet.m | 6 ++++-- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Classes/ShareKit/Core/SHK.h b/Classes/ShareKit/Core/SHK.h index 73a9aba1..ec45a740 100644 --- a/Classes/ShareKit/Core/SHK.h +++ b/Classes/ShareKit/Core/SHK.h @@ -90,6 +90,9 @@ + (NSDictionary *)getUserExclusions; + (void)setUserExclusions:(NSDictionary *)exclusions; +// Handling of the more button. ++ (BOOL)isMoreButtonDisabled; ++ (void)setIsMoreButtonDisabled:(BOOL)yesNo; #pragma mark - #pragma mark Credentials diff --git a/Classes/ShareKit/Core/SHK.m b/Classes/ShareKit/Core/SHK.m index 7521b2a8..8b55819b 100644 --- a/Classes/ShareKit/Core/SHK.m +++ b/Classes/ShareKit/Core/SHK.m @@ -357,6 +357,16 @@ + (void)setUserExclusions:(NSDictionary *)exclusions return [[NSUserDefaults standardUserDefaults] setObject:exclusions forKey:[NSString stringWithFormat:@"%@Exclusions", SHK_FAVS_PREFIX_KEY]]; } +#pragma mark - + ++ (BOOL)isMoreButtonDisabled { + return [[[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithFormat:@"%MoreButtonDisabled", SHK_FAVS_PREFIX_KEY]] boolValue]; +} + ++ (void)setIsMoreButtonDisabled:(BOOL)yesNo { + return [[NSUserDefaults standardUserDefaults] setObject:[NSString stringWithFormat:@"%i", yesNo] + forKey:[NSString stringWithFormat:@"%MoreButtonDisabled", SHK_FAVS_PREFIX_KEY]]; +} #pragma mark - diff --git a/Classes/ShareKit/SHKConfig.h b/Classes/ShareKit/SHKConfig.h index c2aa3565..ffdcd555 100644 --- a/Classes/ShareKit/SHKConfig.h +++ b/Classes/ShareKit/SHKConfig.h @@ -157,4 +157,4 @@ #define SHK_MAX_FAV_COUNT 3 #define SHK_FAVS_PREFIX_KEY @"SHK_FAVS_" -#define SHK_AUTH_PREFIX @"SHK_AUTH_" \ No newline at end of file +#define SHK_AUTH_PREFIX @"SHK_AUTH_" diff --git a/Classes/ShareKit/UI/SHKActionSheet.m b/Classes/ShareKit/UI/SHKActionSheet.m index ba96ae1a..9df11e11 100644 --- a/Classes/ShareKit/UI/SHKActionSheet.m +++ b/Classes/ShareKit/UI/SHKActionSheet.m @@ -69,7 +69,9 @@ + (SHKActionSheet *)actionSheetForType:(SHKShareType)type } // Add More button - [as addButtonWithTitle:SHKLocalizedString(@"More...")]; + if(![SHK isMoreButtonDisabled]) { + [as addButtonWithTitle:SHKLocalizedString(@"More...")]; + } // Add Cancel button [as addButtonWithTitle:SHKLocalizedString(@"Cancel")]; @@ -94,7 +96,7 @@ - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)anim } // More - else if (buttonIndex == sharers.count) + else if (buttonIndex == sharers.count && !([SHK isMoreButtonDisabled])) { SHKShareMenu *shareMenu = [[SHKCustomShareMenu alloc] initWithStyle:UITableViewStyleGrouped]; shareMenu.item = item;