Use settings from preferences for readTimeout
This commit is contained in:
parent
ec083cd79d
commit
3c17e91ca8
|
@ -592,7 +592,7 @@ public class RESTMusicService implements MusicService {
|
||||||
public Response getDownloadInputStream(Context context, MusicDirectory.Entry song, long offset, int maxBitrate, SilentBackgroundTask task) throws Exception {
|
public Response getDownloadInputStream(Context context, MusicDirectory.Entry song, long offset, int maxBitrate, SilentBackgroundTask task) throws Exception {
|
||||||
|
|
||||||
OkHttpClient eagerClient = client.newBuilder()
|
OkHttpClient eagerClient = client.newBuilder()
|
||||||
.readTimeout(30, TimeUnit.SECONDS)
|
.readTimeout(Util.getNetworkTimeoutMs(context), TimeUnit.MILLISECONDS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Map<String, String> parameters = new HashMap<>();
|
Map<String, String> parameters = new HashMap<>();
|
||||||
|
|
|
@ -72,6 +72,9 @@ import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.time.temporal.TemporalUnit;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -122,6 +125,11 @@ public final class Util {
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int getNetworkTimeoutMs(Context context) {
|
||||||
|
SharedPreferences prefs = getPreferences(context);
|
||||||
|
return prefs.getInt(Constants.PREFERENCES_KEY_NETWORK_TIMEOUT, 30000);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isScreenLitOnDownload(Context context) {
|
public static boolean isScreenLitOnDownload(Context context) {
|
||||||
SharedPreferences prefs = getPreferences(context);
|
SharedPreferences prefs = getPreferences(context);
|
||||||
return prefs.getBoolean(Constants.PREFERENCES_KEY_SCREEN_LIT_ON_DOWNLOAD, false);
|
return prefs.getBoolean(Constants.PREFERENCES_KEY_SCREEN_LIT_ON_DOWNLOAD, false);
|
||||||
|
|
Loading…
Reference in New Issue