mirror of https://github.com/M66B/NetGuard.git
Reset apply/notify on uninstall, refactoring
This commit is contained in:
parent
b7d5568dcf
commit
ff815ef7fa
|
@ -622,10 +622,10 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
|
|||
private void updateRule(Rule rule, boolean root, List<Rule> listAll) {
|
||||
SharedPreferences wifi = context.getSharedPreferences("wifi", Context.MODE_PRIVATE);
|
||||
SharedPreferences other = context.getSharedPreferences("other", Context.MODE_PRIVATE);
|
||||
SharedPreferences apply = context.getSharedPreferences("apply", Context.MODE_PRIVATE);
|
||||
SharedPreferences screen_wifi = context.getSharedPreferences("screen_wifi", Context.MODE_PRIVATE);
|
||||
SharedPreferences screen_other = context.getSharedPreferences("screen_other", Context.MODE_PRIVATE);
|
||||
SharedPreferences roaming = context.getSharedPreferences("roaming", Context.MODE_PRIVATE);
|
||||
SharedPreferences apply = context.getSharedPreferences("apply", Context.MODE_PRIVATE);
|
||||
SharedPreferences notify = context.getSharedPreferences("notify", Context.MODE_PRIVATE);
|
||||
|
||||
if (rule.wifi_blocked == rule.wifi_default)
|
||||
|
@ -638,6 +638,11 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
|
|||
else
|
||||
other.edit().putBoolean(rule.info.packageName, rule.other_blocked).apply();
|
||||
|
||||
if (rule.apply)
|
||||
apply.edit().remove(rule.info.packageName).apply();
|
||||
else
|
||||
apply.edit().putBoolean(rule.info.packageName, rule.apply).apply();
|
||||
|
||||
if (rule.screen_wifi == rule.screen_wifi_default)
|
||||
screen_wifi.edit().remove(rule.info.packageName).apply();
|
||||
else
|
||||
|
@ -653,11 +658,6 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
|
|||
else
|
||||
roaming.edit().putBoolean(rule.info.packageName, rule.roaming).apply();
|
||||
|
||||
if (rule.apply)
|
||||
apply.edit().remove(rule.info.packageName).apply();
|
||||
else
|
||||
apply.edit().putBoolean(rule.info.packageName, rule.apply).apply();
|
||||
|
||||
if (rule.notify)
|
||||
notify.edit().remove(rule.info.packageName).apply();
|
||||
else
|
||||
|
@ -672,10 +672,10 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
|
|||
if (related.info.packageName.equals(pkg)) {
|
||||
related.wifi_blocked = rule.wifi_blocked;
|
||||
related.other_blocked = rule.other_blocked;
|
||||
related.apply = rule.apply;
|
||||
related.screen_wifi = rule.screen_wifi;
|
||||
related.screen_other = rule.screen_other;
|
||||
related.roaming = rule.roaming;
|
||||
related.apply = rule.apply;
|
||||
related.notify = rule.notify;
|
||||
listModified.add(related);
|
||||
}
|
||||
|
|
|
@ -62,9 +62,11 @@ public class Receiver extends BroadcastReceiver {
|
|||
Log.i(TAG, "Deleting settings package=" + packageName);
|
||||
context.getSharedPreferences("wifi", Context.MODE_PRIVATE).edit().remove(packageName).apply();
|
||||
context.getSharedPreferences("other", Context.MODE_PRIVATE).edit().remove(packageName).apply();
|
||||
context.getSharedPreferences("apply", Context.MODE_PRIVATE).edit().remove(packageName).apply();
|
||||
context.getSharedPreferences("screen_wifi", Context.MODE_PRIVATE).edit().remove(packageName).apply();
|
||||
context.getSharedPreferences("screen_other", Context.MODE_PRIVATE).edit().remove(packageName).apply();
|
||||
context.getSharedPreferences("roaming", Context.MODE_PRIVATE).edit().remove(packageName).apply();
|
||||
context.getSharedPreferences("notify", Context.MODE_PRIVATE).edit().remove(packageName).apply();
|
||||
|
||||
int uid = intent.getIntExtra(Intent.EXTRA_UID, 0);
|
||||
if (uid > 0) {
|
||||
|
|
Loading…
Reference in New Issue