Skip to content

Commit

Permalink
Check all permissions together if logging is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
renyuneyun committed Feb 20, 2018
1 parent 179fc32 commit 1978f56
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.List;

import ryey.easer.R;
import ryey.easer.SettingsHelper;
import ryey.easer.commons.plugindef.PluginDef;
import ryey.easer.plugins.PluginRegistry;

Expand Down Expand Up @@ -62,14 +63,18 @@ public void onResume() {
}

boolean hasAllRequiredPermissions() {
final boolean logging = SettingsHelper.logging(getContext());
boolean satisfied = true;
for (Object obj_plugin : PluginRegistry.getInstance().all().getEnabledPlugins(getContext())) {
PluginDef plugin = (PluginDef) obj_plugin;
if (!plugin.checkPermissions(getContext())) {
Logger.d("Permission for plugin <%s> not satisfied", plugin.id());
return false;
if (!logging)
return false;
satisfied = false;
}
}
return true;
return satisfied;
}

void requestAllPermissions() {
Expand Down

0 comments on commit 1978f56

Please sign in to comment.