1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-03-03 18:26:20 +00:00

Fixed unblock all defaults

This commit is contained in:
M66B 2025-01-09 20:55:30 +01:00
parent edcacf1bce
commit 7f0b0b9d80

View file

@ -24,6 +24,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;
@ -36,6 +37,9 @@ import androidx.preference.PreferenceManager;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class FragmentDialogUnblockAll extends FragmentDialogBase {
@ -83,10 +87,14 @@ public class FragmentDialogUnblockAll extends FragmentDialogBase {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = prefs.edit();
for (String pref : new String[]{"check_blocklist", "auto_block_sender"})
if (prefs.getBoolean(pref, false)) {
editor.putBoolean(pref, false);
EntityLog.log(context, "Disabled option=" + pref);
List<Pair<String, Boolean>> settings = Collections.unmodifiableList(Arrays.asList(
new Pair<>("check_blocklist", false),
new Pair<>("auto_block_sender", true)
));
for (Pair<String, Boolean> setting : settings)
if (prefs.getBoolean(setting.first, setting.second)) {
editor.putBoolean(setting.first, false);
EntityLog.log(context, "Disabled option=" + setting.first);
}
editor.apply();