mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-04 10:39:25 +00:00
Suppress organization if undetermined
This commit is contained in:
parent
70568c0e1c
commit
3dbbff1fb5
2 changed files with 11 additions and 6 deletions
|
@ -112,6 +112,7 @@ import org.jsoup.nodes.Element;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.text.DateFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -2175,14 +2176,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
final EditText etLink = view.findViewById(R.id.etLink);
|
||||
TextView tvInsecure = view.findViewById(R.id.tvInsecure);
|
||||
final TextView tvOwner = view.findViewById(R.id.tvOwner);
|
||||
Group grpOwner = view.findViewById(R.id.grpOwner);
|
||||
final Group grpOwner = view.findViewById(R.id.grpOwner);
|
||||
|
||||
tvTitle.setText(title);
|
||||
tvTitle.setVisibility(TextUtils.isEmpty(title) ? View.GONE : View.VISIBLE);
|
||||
|
||||
etLink.setText(_uri.toString());
|
||||
tvInsecure.setVisibility("http".equals(_uri.getScheme()) ? View.VISIBLE : View.GONE);
|
||||
grpOwner.setVisibility(paranoid ? View.VISIBLE : View.GONE);
|
||||
grpOwner.setVisibility(View.GONE);
|
||||
|
||||
if (paranoid) {
|
||||
Bundle args = new Bundle();
|
||||
|
@ -2192,6 +2193,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
@Override
|
||||
protected void onPreExecute(Bundle args) {
|
||||
tvOwner.setText("…");
|
||||
grpOwner.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2207,12 +2209,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
tvOwner.setText(ex.getMessage());
|
||||
if (ex instanceof UnknownHostException)
|
||||
grpOwner.setVisibility(View.GONE);
|
||||
else
|
||||
tvOwner.setText(ex.getMessage());
|
||||
}
|
||||
}.execute(context, owner, args, "link:domain");
|
||||
}
|
||||
|
||||
|
||||
new DialogBuilderLifecycle(context, owner)
|
||||
.setView(view)
|
||||
.setPositiveButton(R.string.title_yes, new DialogInterface.OnClickListener() {
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.io.IOException;
|
|||
import java.io.InputStreamReader;
|
||||
import java.net.InetAddress;
|
||||
import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -41,13 +42,13 @@ public class IPInfo {
|
|||
MailTo email = MailTo.parse(uri.toString());
|
||||
String to = email.getTo();
|
||||
if (to == null || !to.contains("@"))
|
||||
return null;
|
||||
throw new UnknownHostException();
|
||||
String host = to.substring(to.indexOf('@') + 1);
|
||||
return getOrganization(host);
|
||||
} else {
|
||||
String host = uri.getHost();
|
||||
if (host == null)
|
||||
return null;
|
||||
throw new UnknownHostException();
|
||||
return getOrganization(host);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue