Fix: app won't start, if cache is disabled
This commit is contained in:
parent
98aa9bc148
commit
b677fbbc8c
|
@ -123,18 +123,21 @@ public abstract class HttpClient {
|
|||
public void reconfigure() {
|
||||
loadProxySettings();
|
||||
loadCookies();
|
||||
long cacheSize = (long) config.getSettings().thumbCacheSize * 1024 * 1024;
|
||||
File configDir = config.getConfigDir();
|
||||
File cacheDir = new File(configDir, "cache");
|
||||
cache = new Cache(cacheDir, cacheSize);
|
||||
Builder builder = new OkHttpClient.Builder()
|
||||
.cookieJar(cookieJar)
|
||||
.connectionPool(GLOBAL_HTTP_CONN_POOL)
|
||||
.cache(cache)
|
||||
.connectTimeout(config.getSettings().httpTimeout, TimeUnit.MILLISECONDS)
|
||||
.readTimeout(config.getSettings().httpTimeout, TimeUnit.MILLISECONDS)
|
||||
.addNetworkInterceptor(new LoggingInterceptor());
|
||||
|
||||
long cacheSize = (long) config.getSettings().thumbCacheSize * 1024 * 1024;
|
||||
if (cacheSize > 0) {
|
||||
File configDir = config.getConfigDir();
|
||||
File cacheDir = new File(configDir, "cache");
|
||||
cache = new Cache(cacheDir, cacheSize);
|
||||
builder.cache(cache);
|
||||
}
|
||||
|
||||
ProxyType proxyType = config.getSettings().proxyType;
|
||||
if (proxyType == ProxyType.HTTP) {
|
||||
String username = config.getSettings().proxyUser;
|
||||
|
|
Loading…
Reference in New Issue