mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 15:11:03 +00:00
Common not junk domain names
This commit is contained in:
parent
6556420b3f
commit
605d576ecc
1 changed files with 18 additions and 2 deletions
|
@ -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…
Reference in a new issue