mirror of
https://framagit.org/tom79/fedilab-tube
synced 2025-02-09 00:28:45 +01:00
Fix issue #170
This commit is contained in:
parent
2344fe0942
commit
6d4772da75
@ -43,6 +43,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import app.fedilab.fedilabtube.BuildConfig;
|
||||
import app.fedilab.fedilabtube.MainActivity;
|
||||
@ -85,6 +86,7 @@ import app.fedilab.fedilabtube.viewmodel.PlaylistsVM;
|
||||
import app.fedilab.fedilabtube.viewmodel.TimelineVM;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.MultipartBody;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.Call;
|
||||
@ -103,6 +105,13 @@ public class RetrofitPeertubeAPI {
|
||||
private String token;
|
||||
private Set<String> selection;
|
||||
|
||||
|
||||
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.connectTimeout(60, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
|
||||
public RetrofitPeertubeAPI(Context context) {
|
||||
_context = context;
|
||||
instance = HelperInstance.getLiveInstance(context);
|
||||
@ -199,6 +208,7 @@ public class RetrofitPeertubeAPI {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(finalUrl)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
if (token == null) {
|
||||
@ -215,6 +225,7 @@ public class RetrofitPeertubeAPI {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
return retrofit.create(PeertubeService.class);
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import android.os.Looper;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import app.fedilab.fedilabtube.MainActivity;
|
||||
import app.fedilab.fedilabtube.R;
|
||||
@ -36,6 +37,7 @@ import app.fedilab.fedilabtube.client.entities.Token;
|
||||
import app.fedilab.fedilabtube.helper.Helper;
|
||||
import app.fedilab.fedilabtube.sqlite.MastodonAccountDAO;
|
||||
import app.fedilab.fedilabtube.sqlite.Sqlite;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Response;
|
||||
import retrofit2.Retrofit;
|
||||
@ -49,6 +51,12 @@ public class RetrofitMastodonAPI {
|
||||
private String instance;
|
||||
private String token;
|
||||
|
||||
|
||||
final OkHttpClient okHttpClient = new OkHttpClient.Builder()
|
||||
.readTimeout(60, TimeUnit.SECONDS)
|
||||
.connectTimeout(60, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
public Status search(String url) throws Error {
|
||||
MastodonService mastodonService2 = init2();
|
||||
Call<Results> statusCall = mastodonService2.searchMessage(getToken(), url);
|
||||
@ -147,6 +155,7 @@ public class RetrofitMastodonAPI {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl("https://" + instance)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
if (token == null) {
|
||||
@ -159,6 +168,7 @@ public class RetrofitMastodonAPI {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(finalUrl)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
if (token == null) {
|
||||
@ -171,6 +181,7 @@ public class RetrofitMastodonAPI {
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(finalUrl2)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(okHttpClient)
|
||||
.build();
|
||||
SharedPreferences sharedpreferences = _context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
if (token == null) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user