mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-03 18:26:20 +00:00
Added ipinfo/region
This commit is contained in:
parent
74e671fa37
commit
58e883869b
2 changed files with 4 additions and 1 deletions
|
@ -397,7 +397,8 @@ public class FragmentDialogOpenLink extends FragmentDialogBase {
|
|||
@Override
|
||||
protected void onExecuted(Bundle args, Pair<InetAddress, IPInfo> data) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String value : new String[]{data.second.org, data.second.city, data.second.country})
|
||||
IPInfo ipinfo = data.second;
|
||||
for (String value : new String[]{ipinfo.org, ipinfo.city, ipinfo.region, ipinfo.country})
|
||||
if (!TextUtils.isEmpty(value)) {
|
||||
if (sb.length() != 0)
|
||||
sb.append("; ");
|
||||
|
|
|
@ -43,6 +43,7 @@ import javax.net.ssl.HttpsURLConnection;
|
|||
public class IPInfo {
|
||||
public String org;
|
||||
public String city;
|
||||
public String region;
|
||||
public String country;
|
||||
|
||||
private static final Map<InetAddress, IPInfo> addressOrganization = new HashMap<>();
|
||||
|
@ -105,6 +106,7 @@ public class IPInfo {
|
|||
JSONObject jroot = new JSONObject(response);
|
||||
info.org = jroot.optString("org");
|
||||
info.city = jroot.optString("city");
|
||||
info.region = jroot.optString("region");
|
||||
info.country = jroot.optString("country");
|
||||
} finally {
|
||||
connection.disconnect();
|
||||
|
|
Loading…
Reference in a new issue