Fix proxy usage before login

This commit is contained in:
世界 2021-04-11 03:12:18 +08:00
parent 1ecfe3a9b0
commit a9a6b72a42
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
1 changed files with 11 additions and 1 deletions

View File

@ -49,7 +49,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import cn.hutool.core.util.StrUtil;
import kotlin.Unit;
import tw.nekomimi.nekogram.NekoConfig;
import tw.nekomimi.nekogram.parts.ProxySwitcher;
import tw.nekomimi.nekogram.utils.DnsFactory;
@ -695,6 +694,17 @@ public class ConnectionsManager extends BaseController {
accountInstance.getMessagesController().checkPromoInfo(true);
}
}
if (SharedConfig.loginingAccount != -1) {
if (enabled && !TextUtils.isEmpty(address)) {
native_setProxySettings(SharedConfig.loginingAccount, address, port, username, password, secret);
} else {
native_setProxySettings(SharedConfig.loginingAccount, "", 1080, "", "", "");
}
AccountInstance accountInstance = AccountInstance.getInstance(SharedConfig.loginingAccount);
if (accountInstance.getUserConfig().isClientActivated()) {
accountInstance.getMessagesController().checkPromoInfo(true);
}
}
}
public static native void native_switchBackend(int currentAccount);