Show organization is an extra privacy feature

pull/155/head
M66B 6 years ago
parent 0ce7db63aa
commit 541f97832d

@ -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

@ -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);
final TextView tvOwner = view.findViewById(R.id.tvOwner);
Group grpOwner = view.findViewById(R.id.grpOwner);
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);
etLink.setText(_uri.toString());
tvInsecure.setVisibility("http".equals(_uri.getScheme()) ? View.VISIBLE : View.GONE);
grpOwner.setVisibility(paranoid ? View.VISIBLE : View.GONE);
new SimpleTask<String>() {
@Override
protected void onPreExecute(Bundle args) {
cbOrganization.setText("…");
}
if (paranoid) {
Bundle args = new Bundle();
args.putParcelable("uri", _uri);
@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));
}
new SimpleTask<String>() {
@Override
protected void onPreExecute(Bundle args) {
tvOwner.setText("…");
}
@Override
protected void onExecuted(Bundle args, String organization) {
cbOrganization.setText(organization == null ? "?" : organization);
}
@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 onException(Bundle args, Throwable ex) {
cbOrganization.setText(ex.getMessage());
}
}.execute(context, owner, args, "link:domain");
} else
cbOrganization.setText(R.string.title_show_organization);
}
});
@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");
}
etLink.setText(_uri.toString());
cbOrganization.setChecked(prefs.getBoolean("show_organization", true));
tvInsecure.setVisibility("http".equals(_uri.getScheme()) ? View.VISIBLE : View.GONE);
new DialogBuilderLifecycle(context, owner)
.setView(view)

@ -28,24 +28,42 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOpenLink" />
<CheckBox
android:id="@+id/cbOrganization"
<TextView
android:id="@+id/tvInsecure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/title_show_organization"
android:layout_marginTop="12dp"
android:text="@string/title_insecure_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" />
<TextView
android:id="@+id/tvInsecure"
android:id="@+id/tvOwnerTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_insecure_link"
android:labelFor="@+id/etLink"
android:text="@string/title_ip_owner"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?attr/colorWarning"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbOrganization" />
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>

@ -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>

Loading…
Cancel
Save