Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling the More-Button #277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Classes/ShareKit/Core/SHK.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions Classes/ShareKit/Core/SHK.m
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
Expand Down
2 changes: 1 addition & 1 deletion Classes/ShareKit/SHKConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@

#define SHK_MAX_FAV_COUNT 3
#define SHK_FAVS_PREFIX_KEY @"SHK_FAVS_"
#define SHK_AUTH_PREFIX @"SHK_AUTH_"
#define SHK_AUTH_PREFIX @"SHK_AUTH_"
6 changes: 4 additions & 2 deletions Classes/ShareKit/UI/SHKActionSheet.m
Original file line number Diff line number Diff line change
Expand Up @@ -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")];
Expand All @@ -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;
Expand Down