Skip to content

Commit

Permalink
Store last made choice for rule filter visibility across sessions (#3304
Browse files Browse the repository at this point in the history
)
  • Loading branch information
dmoagx committed Jun 14, 2019
1 parent 664a46c commit 1a29647
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Source/SPConstants.h
Expand Up @@ -392,6 +392,7 @@ extern NSString *SPResetAutoIncrementAfterDeletionOfAllRows;
extern NSString *SPFavoriteColorList;
extern NSString *SPDisplayBinaryDataAsHex;
extern NSString *SPMonospacedFontSize;
extern NSString *SPRuleFilterEditorLastVisibilityChoice;

// Hidden Prefs
extern NSString *SPPrintWarningRowLimit;
Expand Down
1 change: 1 addition & 0 deletions Source/SPConstants.m
Expand Up @@ -177,6 +177,7 @@
NSString *SPFavoriteColorList = @"FavoriteColorList";
NSString *SPDisplayBinaryDataAsHex = @"DisplayBinaryDataAsHex";
NSString *SPMonospacedFontSize = @"MonospacedFontSize";
NSString *SPRuleFilterEditorLastVisibilityChoice = @"RuleFilterEditorLastVisibilityChoice";

// Hidden Prefs
NSString *SPPrintWarningRowLimit = @"PrintWarningRowLimit";
Expand Down
5 changes: 3 additions & 2 deletions Source/SPTableContent.m
Expand Up @@ -175,14 +175,14 @@ - (id)init
tableRowsSelectable = YES;
isFirstChangeInView = YES;

showFilterRuleEditor = NO;

isFiltered = NO;
isLimited = NO;
isInterruptedLoad = NO;

prefs = [NSUserDefaults standardUserDefaults];

showFilterRuleEditor = [prefs boolForKey:SPRuleFilterEditorLastVisibilityChoice];

usedQuery = [[NSString alloc] initWithString:@""];

tableLoadTimer = nil;
Expand Down Expand Up @@ -1350,6 +1350,7 @@ - (void)filterTableTask
- (IBAction)toggleRuleEditorVisible:(id)sender
{
BOOL shouldShow = !showFilterRuleEditor;
[prefs setBool:shouldShow forKey:SPRuleFilterEditorLastVisibilityChoice];
[self setRuleEditorVisible:shouldShow animate:YES];
// if this was the active filter before, it no longer can be the active filter when it is hidden
if(activeFilter == SPTableContentFilterSourceRuleFilter && !shouldShow) {
Expand Down

0 comments on commit 1a29647

Please sign in to comment.