Common not junk domain names

pull/194/merge
M66B 3 years ago
parent 6556420b3f
commit 605d576ecc

@ -51,6 +51,8 @@ import androidx.preference.PreferenceManager;
import org.json.JSONObject; import org.json.JSONObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -58,6 +60,14 @@ import javax.mail.Address;
import javax.mail.internet.InternetAddress; import javax.mail.internet.InternetAddress;
public class FragmentDialogJunk extends FragmentDialogBase { public class FragmentDialogJunk extends FragmentDialogBase {
private static final List<String> COMMON_DOMAINS = Collections.unmodifiableList(Arrays.asList(
"amazon\\.com",
"facebook\\.com",
"google\\.com",
"microsoft\\.com",
"twitter\\.com"
));
@NonNull @NonNull
@Override @Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) { public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
@ -330,9 +340,15 @@ public class FragmentDialogJunk extends FragmentDialogBase {
domains.add(domain); domains.add(domain);
for (String d : EmailProvider.getDomainNames(context)) List<String> regex = new ArrayList<>();
if (domain.matches(d)) regex.addAll(COMMON_DOMAINS);
regex.addAll(EmailProvider.getDomainNames(context));
for (String r : regex)
if (domain.matches(r)) {
common = true; common = true;
break;
}
} }
// Initialize // Initialize

Loading…
Cancel
Save