mirror of https://github.com/M66B/FairEmail.git
Added whitelisting link domains
This commit is contained in:
parent
1f6db48f41
commit
1212e936eb
|
@ -3763,7 +3763,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
return false;
|
||||
|
||||
boolean confirm_links = prefs.getBoolean("confirm_links", true);
|
||||
if (confirm_links) {
|
||||
boolean confirm_link =
|
||||
!"https".equals(uri.getScheme()) || TextUtils.isEmpty(uri.getHost()) ||
|
||||
prefs.getBoolean(uri.getHost() + ".confirm_link", true);
|
||||
if (confirm_links && confirm_link) {
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable("uri", uri);
|
||||
args.putString("title", title);
|
||||
|
@ -5302,6 +5305,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
final ContentLoadingProgressBar pbWait = dview.findViewById(R.id.pbWait);
|
||||
final TextView tvHost = dview.findViewById(R.id.tvHost);
|
||||
final TextView tvOwner = dview.findViewById(R.id.tvOwner);
|
||||
final CheckBox cbNotAgain = dview.findViewById(R.id.cbNotAgain);
|
||||
final Group grpDifferent = dview.findViewById(R.id.grpDifferent);
|
||||
final Group grpOwner = dview.findViewById(R.id.grpOwner);
|
||||
|
||||
|
@ -5403,7 +5407,19 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
}
|
||||
});
|
||||
|
||||
cbNotAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
prefs.edit().putBoolean(uri.getHost() + ".confirm_link", !isChecked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
tvOwnerRemark.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
cbNotAgain.setText(getContext().getString(R.string.title_no_ask_for_again, uri.getHost()));
|
||||
cbNotAgain.setVisibility(
|
||||
"https".equals(uri.getScheme()) && !TextUtils.isEmpty(uri.getHost())
|
||||
? View.VISIBLE : View.GONE);
|
||||
pbWait.setVisibility(View.GONE);
|
||||
grpOwner.setVisibility(View.GONE);
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
for (String option : RESET_QUESTIONS)
|
||||
editor.remove(option);
|
||||
for (String key : prefs.getAll().keySet())
|
||||
if (key.endsWith(".show_full") || key.endsWith(".show_images"))
|
||||
if (key.endsWith(".show_full") || key.endsWith(".show_images") || key.endsWith(".confirm_link"))
|
||||
editor.remove(key);
|
||||
editor.apply();
|
||||
ToastEx.makeText(getContext(), R.string.title_setup_done, Toast.LENGTH_LONG).show();
|
||||
|
|
|
@ -169,6 +169,16 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvHost" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbNotAgain"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_no_ask_for_again"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvOwner" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpDifferent"
|
||||
android:layout_width="0dp"
|
||||
|
|
Loading…
Reference in New Issue