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 {
|
||||
|
||||
OkHttpClient eagerClient = client.newBuilder()
|
||||
.readTimeout(30, TimeUnit.SECONDS)
|
||||
.readTimeout(Util.getNetworkTimeoutMs(context), TimeUnit.MILLISECONDS)
|
||||
.build();
|
||||
|
||||
Map<String, String> parameters = new HashMap<>();
|
||||
|
|
|
@ -72,6 +72,9 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.security.MessageDigest;
|
||||
import java.security.SecureRandom;
|
||||
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.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -122,6 +125,11 @@ public final class Util {
|
|||
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) {
|
||||
SharedPreferences prefs = getPreferences(context);
|
||||
return prefs.getBoolean(Constants.PREFERENCES_KEY_SCREEN_LIT_ON_DOWNLOAD, false);
|
||||
|
|
Loading…
Reference in New Issue