mirror of https://github.com/M66B/FairEmail.git
Check link title against link target
This commit is contained in:
parent
16311dbafb
commit
2b5bcdb13a
|
@ -4118,6 +4118,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_open_link, null);
|
||||
TextView tvTitle = view.findViewById(R.id.tvTitle);
|
||||
final EditText etLink = view.findViewById(R.id.etLink);
|
||||
TextView tvDifferent = view.findViewById(R.id.tvDifferent);
|
||||
final CheckBox cbSecure = view.findViewById(R.id.cbSecure);
|
||||
CheckBox cbSanitize = view.findViewById(R.id.cbSanitize);
|
||||
final Button btnOwner = view.findViewById(R.id.btnOwner);
|
||||
|
@ -4244,6 +4245,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
tvTitle.setVisibility(TextUtils.isEmpty(title) ? View.GONE : View.VISIBLE);
|
||||
etLink.setText(uri.toString());
|
||||
|
||||
Uri uriTitle = Uri.parse(title == null ? "" : title);
|
||||
tvDifferent.setVisibility(uriTitle.getHost() == null || uri.getHost() == null ||
|
||||
uriTitle.getHost().equalsIgnoreCase(uri.getHost())
|
||||
? View.GONE : View.VISIBLE);
|
||||
|
||||
return new AlertDialog.Builder(getContext())
|
||||
.setView(view)
|
||||
.setPositiveButton(R.string.title_yes, new DialogInterface.OnClickListener() {
|
||||
|
|
|
@ -43,6 +43,19 @@
|
|||
<requestFocus />
|
||||
</EditText>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvDifferent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:labelFor="@+id/etLink"
|
||||
android:text="@string/title_different_link"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?attr/colorWarning"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etLink" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbSecure"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -52,7 +65,7 @@
|
|||
android:textColor="?attr/colorWarning"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etLink" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDifferent" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbSanitize"
|
||||
|
|
|
@ -836,6 +836,7 @@
|
|||
<string name="title_hint_contact_actions">Long press for options</string>
|
||||
|
||||
<string name="title_open_link">Open link</string>
|
||||
<string name="title_different_link">The title and the link address are different</string>
|
||||
<string name="title_secure_link">Make connection secure</string>
|
||||
<string name="title_link_secured">Connection is secure</string>
|
||||
<string name="title_sanitize_link">Remove tracking parameters</string>
|
||||
|
|
Loading…
Reference in New Issue