1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-12-14 13:31:15 +01:00

Don't alert "Proxy unavailable" for non-current account.

This commit is contained in:
世界 2020-11-04 11:03:13 +00:00
parent ef4de3310d
commit 58edbe46fd
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
2 changed files with 5 additions and 3 deletions

View File

@ -349,7 +349,7 @@ class Delegate : public ConnectiosManagerDelegate {
} }
void onProxyError(int32_t instanceNum) { void onProxyError(int32_t instanceNum) {
jniEnv[instanceNum]->CallStaticVoidMethod(jclass_ConnectionsManager, jclass_ConnectionsManager_onProxyError); jniEnv[instanceNum]->CallStaticVoidMethod(jclass_ConnectionsManager, jclass_ConnectionsManager_onProxyError, instanceNum);
} }
void getHostByName(std::string domain, int32_t instanceNum, ConnectionSocket *socket) { void getHostByName(std::string domain, int32_t instanceNum, ConnectionSocket *socket) {
@ -600,7 +600,7 @@ extern "C" int registerNativeTgNetFunctions(JavaVM *vm, JNIEnv *env) {
if (jclass_ConnectionsManager_onRequestNewServerIpAndPort == 0) { if (jclass_ConnectionsManager_onRequestNewServerIpAndPort == 0) {
return JNI_FALSE; return JNI_FALSE;
} }
jclass_ConnectionsManager_onProxyError = env->GetStaticMethodID(jclass_ConnectionsManager, "onProxyError", "()V"); jclass_ConnectionsManager_onProxyError = env->GetStaticMethodID(jclass_ConnectionsManager, "onProxyError", "(I)V");
if (jclass_ConnectionsManager_onProxyError == 0) { if (jclass_ConnectionsManager_onProxyError == 0) {
return JNI_FALSE; return JNI_FALSE;
} }

View File

@ -565,7 +565,9 @@ public class ConnectionsManager extends BaseController {
}); });
} }
public static void onProxyError() { public static void onProxyError(int instanceNum) {
if (UserConfig.selectedAccount != instanceNum) return;
AndroidUtilities.runOnUIThread(() -> { AndroidUtilities.runOnUIThread(() -> {
NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needShowAlert, 3); NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needShowAlert, 3);
}); });