mirror of
https://github.com/gsantner/dandelion
synced 2024-11-24 13:22:08 +01:00
Let ImageDownloadTask and ProfileFetchTask use NetCipher and remove unused imports
This commit is contained in:
parent
53e65eb756
commit
595a0d7794
3 changed files with 10 additions and 11 deletions
|
@ -28,12 +28,6 @@ import android.util.Log;
|
|||
|
||||
import com.github.dfa.diaspora_android.App;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.StatusLine;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
|
@ -80,7 +74,7 @@ public class GetPodsService extends Service {
|
|||
//HttpClient client = new DefaultHttpClient();
|
||||
List<String> list = null;
|
||||
try {
|
||||
HttpsURLConnection connection = NetCipher.getHttpsURLConnection("http://podupti.me/api.php?key=4r45tg&format=json");
|
||||
HttpsURLConnection connection = NetCipher.getHttpsURLConnection("https://podupti.me/api.php?key=4r45tg&format=json");
|
||||
int statusCode = connection.getResponseCode();
|
||||
if (statusCode == 200) {
|
||||
InputStream content = connection.getInputStream();
|
||||
|
@ -91,7 +85,6 @@ public class GetPodsService extends Service {
|
|||
builder.append(line);
|
||||
}
|
||||
} else {
|
||||
//TODO Notify User about failure
|
||||
Log.e(TAG, "Failed to download list of pods");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
|
|
@ -13,6 +13,8 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import info.guardianproject.netcipher.NetCipher;
|
||||
|
||||
/**
|
||||
* Created by Gregor Santner (gsantner) on 24.03.16.
|
||||
*/
|
||||
|
@ -36,7 +38,8 @@ public class ImageDownloadTask extends AsyncTask<String, Void, Bitmap> {
|
|||
Bitmap bitmap = null;
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
InputStream in = new java.net.URL(url).openStream();
|
||||
//InputStream in = new java.net.URL(url).openStream();
|
||||
InputStream in = NetCipher.getHttpsURLConnection(url).getInputStream();
|
||||
bitmap = BitmapFactory.decodeStream(in);
|
||||
|
||||
// Save to file if not null
|
||||
|
|
|
@ -11,9 +11,12 @@ import com.github.dfa.diaspora_android.data.PodUserProfile;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
import info.guardianproject.netcipher.NetCipher;
|
||||
|
||||
/**
|
||||
* Created by Gregor Santner (gsantner) on 30.03.16.
|
||||
*/
|
||||
|
@ -39,7 +42,7 @@ public class ProfileFetchTask extends AsyncTask<Void, Void, Void> {
|
|||
|
||||
try {
|
||||
URL url = new URL("https://" + app.getSettings().getPodDomain() + "/stream");
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
HttpsURLConnection conn = NetCipher.getHttpsURLConnection(url);
|
||||
conn.setReadTimeout(10000);
|
||||
conn.setConnectTimeout(15000);
|
||||
conn.setRequestMethod("GET");
|
||||
|
|
Loading…
Reference in a new issue