From 58edbe46fdf3336fc0319526acf517df3166c8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 4 Nov 2020 11:03:13 +0000 Subject: [PATCH] Don't alert "Proxy unavailable" for non-current account. --- TMessagesProj/jni/TgNetWrapper.cpp | 4 ++-- .../src/main/java/org/telegram/tgnet/ConnectionsManager.java | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/TMessagesProj/jni/TgNetWrapper.cpp b/TMessagesProj/jni/TgNetWrapper.cpp index 5f9215579..737dfe9c4 100644 --- a/TMessagesProj/jni/TgNetWrapper.cpp +++ b/TMessagesProj/jni/TgNetWrapper.cpp @@ -349,7 +349,7 @@ class Delegate : public ConnectiosManagerDelegate { } 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) { @@ -600,7 +600,7 @@ extern "C" int registerNativeTgNetFunctions(JavaVM *vm, JNIEnv *env) { if (jclass_ConnectionsManager_onRequestNewServerIpAndPort == 0) { 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) { return JNI_FALSE; } diff --git a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java index b4ae2da0c..df2e20c63 100644 --- a/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java +++ b/TMessagesProj/src/main/java/org/telegram/tgnet/ConnectionsManager.java @@ -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(() -> { NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.needShowAlert, 3); });