Call initProxy() manually

This commit is contained in:
yushijinhun
2018-07-20 15:59:05 +08:00
parent c38848ea0e
commit 357fef8672
2 changed files with 3 additions and 7 deletions

View File

@@ -36,7 +36,7 @@ public final class ProxyManager {
private ProxyManager() { private ProxyManager() {
} }
private static final ObjectBinding<Proxy> proxyProperty = Bindings.createObjectBinding( private static ObjectBinding<Proxy> proxyProperty = Bindings.createObjectBinding(
() -> { () -> {
String host = CONFIG.getProxyHost(); String host = CONFIG.getProxyHost();
Integer port = Lang.toIntOrNull(CONFIG.getProxyPort()); Integer port = Lang.toIntOrNull(CONFIG.getProxyPort());
@@ -59,11 +59,7 @@ public final class ProxyManager {
return proxyProperty; return proxyProperty;
} }
static { static void init() {
initProxy();
}
private static void initProxy() {
proxyProperty.addListener(observable -> updateSystemProxy()); proxyProperty.addListener(observable -> updateSystemProxy());
updateSystemProxy(); updateSystemProxy();

View File

@@ -66,7 +66,7 @@ public class Settings {
firstLaunch = CONFIG.isFirstLaunch(); firstLaunch = CONFIG.isFirstLaunch();
CONFIG.setFirstLaunch(false); CONFIG.setFirstLaunch(false);
ProxyManager.getProxy(); // init ProxyManager ProxyManager.init();
for (Iterator<Map<Object, Object>> iterator = CONFIG.getAccounts().iterator(); iterator.hasNext();) { for (Iterator<Map<Object, Object>> iterator = CONFIG.getAccounts().iterator(); iterator.hasNext();) {
Map<Object, Object> settings = iterator.next(); Map<Object, Object> settings = iterator.next();