mirror of
https://github.com/Docile-Alligator/Infinity-For-Reddit.git
synced 2025-10-29 19:44:40 +00:00
Fix app crashes when proxy is set to direct.
This commit is contained in:
parent
848787297e
commit
587bb95413
@ -59,12 +59,14 @@ abstract class NetworkModule {
|
||||
|
||||
if (proxyEnabled) {
|
||||
Proxy.Type proxyType = Proxy.Type.valueOf(mProxySharedPreferences.getString(SharedPreferencesUtils.PROXY_TYPE, "HTTP"));
|
||||
String proxyHost = mProxySharedPreferences.getString(SharedPreferencesUtils.PROXY_HOSTNAME, "127.0.0.1");
|
||||
int proxyPort = Integer.parseInt(mProxySharedPreferences.getString(SharedPreferencesUtils.PROXY_PORT, "1080"));
|
||||
if (proxyType != Proxy.Type.DIRECT) {
|
||||
String proxyHost = mProxySharedPreferences.getString(SharedPreferencesUtils.PROXY_HOSTNAME, "127.0.0.1");
|
||||
int proxyPort = Integer.parseInt(mProxySharedPreferences.getString(SharedPreferencesUtils.PROXY_PORT, "1080"));
|
||||
|
||||
InetSocketAddress proxyAddr = new InetSocketAddress(proxyHost, proxyPort);
|
||||
Proxy proxy = new Proxy(proxyType, proxyAddr);
|
||||
builder.proxy(proxy);
|
||||
InetSocketAddress proxyAddr = new InetSocketAddress(proxyHost, proxyPort);
|
||||
Proxy proxy = new Proxy(proxyType, proxyAddr);
|
||||
builder.proxy(proxy);
|
||||
}
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
|
||||
@ -32,12 +32,14 @@ public class ProxyEnabledGlideModule extends AppGlideModule {
|
||||
boolean proxyEnabled = mProxySharedPreferences.getBoolean(SharedPreferencesUtils.PROXY_ENABLED, false);
|
||||
if (proxyEnabled) {
|
||||
Proxy.Type proxyType = Proxy.Type.valueOf(mProxySharedPreferences.getString(SharedPreferencesUtils.PROXY_TYPE, "HTTP"));
|
||||
String proxyHost = mProxySharedPreferences.getString(SharedPreferencesUtils.PROXY_HOSTNAME, "127.0.0.1");
|
||||
int proxyPort = Integer.parseInt(mProxySharedPreferences.getString(SharedPreferencesUtils.PROXY_PORT, "1080"));
|
||||
if (proxyType != Proxy.Type.DIRECT) {
|
||||
String proxyHost = mProxySharedPreferences.getString(SharedPreferencesUtils.PROXY_HOSTNAME, "127.0.0.1");
|
||||
int proxyPort = Integer.parseInt(mProxySharedPreferences.getString(SharedPreferencesUtils.PROXY_PORT, "1080"));
|
||||
|
||||
InetSocketAddress proxyAddr = new InetSocketAddress(proxyHost, proxyPort);
|
||||
Proxy proxy = new Proxy(proxyType, proxyAddr);
|
||||
builder.proxy(proxy);
|
||||
InetSocketAddress proxyAddr = new InetSocketAddress(proxyHost, proxyPort);
|
||||
Proxy proxy = new Proxy(proxyType, proxyAddr);
|
||||
builder.proxy(proxy);
|
||||
}
|
||||
}
|
||||
|
||||
OkHttpUrlLoader.Factory factory = new OkHttpUrlLoader.Factory(builder.build());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user