Skip to content

Commit

Permalink
[rules] Set component to its default state when unblocked
Browse files Browse the repository at this point in the history
  • Loading branch information
MuntashirAkon committed Dec 3, 2020
1 parent 95ee13b commit 77e18a3
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,14 +269,22 @@ public void updateRulesForComponent(String componentName, RulesStorageManager.Ty
synchronized (blockerLocker) {
waitForBlockerOrExit();
blocker.setMutable();
if (blocker.hasComponent(componentName)) { // Remove from the list
blocker.removeComponent(componentName);
} else { // Add to the list
if (blocker.hasComponent(componentName)) {
// Component is in the list
if (blocker.isComponentBlocked(componentName)) {
// Remove from the list
blocker.removeComponent(componentName);
} else {
// The component isn't being blocked, simply remove it
blocker.removeEntry(componentName);
}
} else {
// Add to the list
blocker.addComponent(componentName, type);
}
// Apply rules if global blocking enable or already applied
if ((Boolean) AppPref.get(AppPref.PrefKey.PREF_GLOBAL_BLOCKING_ENABLED_BOOL)
|| (ruleApplicationStatus != null && ruleApplicationStatus.getValue() == RULE_APPLIED)) {
|| (ruleApplicationStatus != null && RULE_APPLIED == ruleApplicationStatus.getValue())) {
blocker.applyRules(true);
}
// Set new status
Expand Down
Loading

0 comments on commit 77e18a3

Please sign in to comment.