Show organization is an extra privacy feature

This commit is contained in:
M66B 2019-04-26 08:08:18 +02:00
parent 0ce7db63aa
commit 541f97832d
4 changed files with 63 additions and 49 deletions

1
FAQ.md
View File

@ -1458,6 +1458,7 @@ FairEmail will try to select the best identity based on the *to* address of the
The advanced option *extra privacy features* enables:
* Looking up the owner of the IP address of a link
* Detection and removal of [tracking images](#user-content-faq82)
* Removal of [Urchin Tracking Module (UTM) parameters](https://en.wikipedia.org/wiki/UTM_parameters) from links

View File

@ -1847,48 +1847,43 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
View view = LayoutInflater.from(context).inflate(R.layout.dialog_link, null);
final EditText etLink = view.findViewById(R.id.etLink);
final CheckBox cbOrganization = view.findViewById(R.id.cbOrganization);
TextView tvInsecure = view.findViewById(R.id.tvInsecure);
cbOrganization.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
prefs.edit().putBoolean("show_organization", isChecked).apply();
if (isChecked) {
Bundle args = new Bundle();
args.putParcelable("uri", _uri);
new SimpleTask<String>() {
@Override
protected void onPreExecute(Bundle args) {
cbOrganization.setText("");
}
@Override
protected String onExecute(Context context, Bundle args) throws Throwable {
Uri uri = args.getParcelable("uri");
String host = uri.getHost();
return (TextUtils.isEmpty(host) ? null : Helper.getOrganization(host));
}
@Override
protected void onExecuted(Bundle args, String organization) {
cbOrganization.setText(organization == null ? "?" : organization);
}
@Override
protected void onException(Bundle args, Throwable ex) {
cbOrganization.setText(ex.getMessage());
}
}.execute(context, owner, args, "link:domain");
} else
cbOrganization.setText(R.string.title_show_organization);
}
});
final TextView tvOwner = view.findViewById(R.id.tvOwner);
Group grpOwner = view.findViewById(R.id.grpOwner);
etLink.setText(_uri.toString());
cbOrganization.setChecked(prefs.getBoolean("show_organization", true));
tvInsecure.setVisibility("http".equals(_uri.getScheme()) ? View.VISIBLE : View.GONE);
grpOwner.setVisibility(paranoid ? View.VISIBLE : View.GONE);
if (paranoid) {
Bundle args = new Bundle();
args.putParcelable("uri", _uri);
new SimpleTask<String>() {
@Override
protected void onPreExecute(Bundle args) {
tvOwner.setText("");
}
@Override
protected String onExecute(Context context, Bundle args) throws Throwable {
Uri uri = args.getParcelable("uri");
String host = uri.getHost();
return (TextUtils.isEmpty(host) ? null : Helper.getOrganization(host));
}
@Override
protected void onExecuted(Bundle args, String organization) {
tvOwner.setText(organization == null ? "?" : organization);
}
@Override
protected void onException(Bundle args, Throwable ex) {
tvOwner.setText(ex.getMessage());
}
}.execute(context, owner, args, "link:domain");
}
new DialogBuilderLifecycle(context, owner)
.setView(view)

View File

@ -28,15 +28,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOpenLink" />
<CheckBox
android:id="@+id/cbOrganization"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/title_show_organization"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etLink" />
<TextView
android:id="@+id/tvInsecure"
android:layout_width="wrap_content"
@ -47,5 +38,32 @@
android:textColor="?attr/colorWarning"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbOrganization" />
app:layout_constraintTop_toBottomOf="@id/etLink" />
<TextView
android:id="@+id/tvOwnerTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:labelFor="@+id/etLink"
android:text="@string/title_ip_owner"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvInsecure" />
<TextView
android:id="@+id/tvOwner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:labelFor="@+id/etLink"
android:text="Cloudflare"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOwnerTitle" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpOwner"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvOwnerTitle,tvOwner" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -593,7 +593,7 @@
<string name="title_hint_ignore_contact">Long press a contact to never consider it as a favorite</string>
<string name="title_open_link">Open link</string>
<string name="title_show_organization">Show organization</string>
<string name="title_ip_owner">Owner IP address</string>
<string name="title_insecure_link">This link is insecure</string>
<string name="title_select_app">Select app</string>
<string name="title_updated">There is an update to version %1$s available</string>