Refactoring

pull/214/head
M66B 7 months ago
parent 42af314c79
commit e533c07a1f

@ -29,12 +29,14 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@ -127,15 +129,13 @@ public class DisconnectBlacklist {
if (status != HttpsURLConnection.HTTP_OK)
throw new FileNotFoundException("Error " + status + ": " + connection.getResponseMessage());
String response = Helper.readStream(connection.getInputStream());
Helper.writeText(file, response);
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
Helper.copy(connection.getInputStream(), os);
}
} finally {
connection.disconnect();
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
prefs.edit().putLong("disconnect_last", new Date().getTime()).apply();
init(file);
}

@ -485,6 +485,7 @@ public class FragmentOptionsPrivacy extends FragmentBase implements SharedPrefer
@Override
protected void onExecuted(Bundle args, Void data) {
prefs.edit().putLong("disconnect_last", new Date().getTime()).apply();
setOptions();
}

Loading…
Cancel
Save