mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-02 21:24:34 +00:00
Allow disable confirming email addreesses
This commit is contained in:
parent
7f022c31a0
commit
b6fd01f752
2 changed files with 19 additions and 11 deletions
|
@ -5937,10 +5937,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
String scheme = guri.getScheme();
|
||||
String host = guri.getHost();
|
||||
|
||||
String chost = FragmentDialogOpenLink.getConfirmHost(uri);
|
||||
boolean sanitize_links = prefs.getBoolean("sanitize_links", false);
|
||||
boolean confirm_link =
|
||||
!"https".equalsIgnoreCase(scheme) || TextUtils.isEmpty(host) ||
|
||||
prefs.getBoolean(host + ".confirm_link", true);
|
||||
boolean confirm_link = (chost != null && prefs.getBoolean(chost + ".confirm_link", true));
|
||||
if (always_confirm || sanitize_links || (confirm_links && confirm_link)) {
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable("uri", uri);
|
||||
|
|
|
@ -334,7 +334,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
cbNotAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
prefs.edit().putBoolean(uri.getHost() + ".confirm_link", !isChecked).apply();
|
||||
prefs.edit().putBoolean(getConfirmHost(uri) + ".confirm_link", !isChecked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -581,13 +581,9 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
|
||||
cbSanitize.setChecked(sanitize_links);
|
||||
|
||||
cbNotAgain.setText(context.getString(R.string.title_no_ask_for_again, uri.getHost()));
|
||||
cbNotAgain.setVisibility(
|
||||
!always_confirm &&
|
||||
!sanitize_links &&
|
||||
UriHelper.isSecure(uri) &&
|
||||
!TextUtils.isEmpty(uri.getHost())
|
||||
? View.VISIBLE : View.GONE);
|
||||
String chost = getConfirmHost(uri);
|
||||
cbNotAgain.setText(context.getString(R.string.title_no_ask_for_again, chost));
|
||||
cbNotAgain.setVisibility(!always_confirm && chost != null ? View.VISIBLE : View.GONE);
|
||||
|
||||
setMore(false);
|
||||
|
||||
|
@ -862,6 +858,19 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
}
|
||||
}
|
||||
|
||||
public static String getConfirmHost(Uri uri) {
|
||||
String scheme = uri.getScheme();
|
||||
if ("https".equals(scheme)) {
|
||||
String host = uri.getHost();
|
||||
return (TextUtils.isEmpty(host) ? null : host);
|
||||
} else if ("mailto".equals(scheme)) {
|
||||
MailTo mailto = MailTo.parse(uri);
|
||||
String to = mailto.getTo();
|
||||
return (TextUtils.isEmpty(to) ? null : to);
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class AdapterPackage extends ArrayAdapter<Package> {
|
||||
private final Context context;
|
||||
private final List<Package> pkgs;
|
||||
|
|
Loading…
Reference in a new issue