1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-12-15 05:11:08 +01:00

Merge pull request #1197 from TeamNewPipe/remove-ip-range

Remove IP range
This commit is contained in:
Christian Schabesberger 2018-03-21 20:59:41 +01:00 committed by GitHub
commit 3bfb593b21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,12 +77,10 @@ public class ErrorActivity extends AppCompatActivity {
public static final String ERROR_EMAIL_ADDRESS = "crashreport@newpipe.schabi.org";
public static final String ERROR_EMAIL_SUBJECT = "Exception in NewPipe " + BuildConfig.VERSION_NAME;
Thread globIpRangeThread;
private String[] errorList;
private ErrorInfo errorInfo;
private Class returnActivity;
private String currentTimeStamp;
private String globIpRange;
// views
private TextView errorView;
private EditText userCommentBox;
@ -224,9 +222,6 @@ public class ErrorActivity extends AppCompatActivity {
});
reportButton.setEnabled(false);
globIpRangeThread = new Thread(new IpRangeRequester());
globIpRangeThread.start();
// normal bugreport
buildInfo(errorInfo);
if (errorInfo.message != 0) {
@ -342,8 +337,7 @@ public class ErrorActivity extends AppCompatActivity {
.put("package", getPackageName())
.put("version", BuildConfig.VERSION_NAME)
.put("os", getOsString())
.put("time", currentTimeStamp)
.put("ip_range", globIpRange);
.put("time", currentTimeStamp);
JSONArray exceptionArray = new JSONArray();
if (errorList != null) {
@ -454,41 +448,4 @@ public class ErrorActivity extends AppCompatActivity {
dest.writeInt(this.message);
}
}
private class IpRangeRequester implements Runnable {
Handler h = new Handler();
public void run() {
String ipRange = "none";
try {
Downloader dl = Downloader.getInstance();
String ip = dl.download("https://ipv4.icanhazip.com");
ipRange = Parser.matchGroup1("([0-9]*\\.[0-9]*\\.)[0-9]*\\.[0-9]*", ip)
+ "0.0";
} catch (Throwable e) {
Log.w(TAG, "Error while error: could not get iprange", e);
} finally {
h.post(new IpRangeReturnRunnable(ipRange));
}
}
}
private class IpRangeReturnRunnable implements Runnable {
String ipRange;
public IpRangeReturnRunnable(String ipRange) {
this.ipRange = ipRange;
}
public void run() {
globIpRange = ipRange;
if (infoView != null) {
String text = infoView.getText().toString();
text += "\n" + globIpRange;
infoView.setText(text);
reportButton.setEnabled(true);
}
}
}
}