mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 07:01:05 +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 java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
|
@ -58,6 +60,14 @@ import javax.mail.Address;
|
|||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
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
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
|
@ -330,9 +340,15 @@ public class FragmentDialogJunk extends FragmentDialogBase {
|
|||
|
||||
domains.add(domain);
|
||||
|
||||
for (String d : EmailProvider.getDomainNames(context))
|
||||
if (domain.matches(d))
|
||||
List<String> regex = new ArrayList<>();
|
||||
regex.addAll(COMMON_DOMAINS);
|
||||
regex.addAll(EmailProvider.getDomainNames(context));
|
||||
|
||||
for (String r : regex)
|
||||
if (domain.matches(r)) {
|
||||
common = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize
|
||||
|
|
Loading…
Reference in a new issue