diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle index b4e63ff1f..996e79d7d 100644 --- a/TMessagesProj/build.gradle +++ b/TMessagesProj/build.gradle @@ -35,6 +35,7 @@ dependencies { def appCenterSdkVersion = '2.5.1' implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}" implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}" + implementation "com.microsoft.appcenter:appcenter-push:${appCenterSdkVersion}" } android { diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java index 60a9bd31e..c4c4bc12a 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java @@ -2733,7 +2733,7 @@ public class AndroidUtilities { lineView.setBackgroundColor(Theme.getColor(Theme.key_divider)); linearLayout.addView(lineView, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1)); } - for (int a = 0; a < 5; a++) { + for (int a = 0; a < 6; a++) { String text = null; String detail = null; if (a == 0) { @@ -2751,6 +2751,9 @@ public class AndroidUtilities { } else if (a == 4) { text = password; detail = LocaleController.getString("UseProxyPassword", R.string.UseProxyPassword); + } else if (a == 5) { + text = LocaleController.getString("Checking", R.string.Checking); + detail = LocaleController.getString("Checking", R.string.Checking); } if (TextUtils.isEmpty(text)) { continue; @@ -2760,8 +2763,18 @@ public class AndroidUtilities { cell.getTextView().setTextColor(Theme.getColor(Theme.key_dialogTextBlack)); cell.getValueTextView().setTextColor(Theme.getColor(Theme.key_dialogTextGray3)); linearLayout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); - if (a == 2) { - break; + if (a == 5) { + ConnectionsManager.getInstance(UserConfig.selectedAccount).checkProxy(address, Utilities.parseInt(port), user, password, secret, time -> AndroidUtilities.runOnUIThread(() -> { + String colorKey; + if (time != -1) { + cell.setTextAndValue(LocaleController.getString("Available", R.string.Available), LocaleController.formatString("Ping", R.string.Ping, time), true); + colorKey = Theme.key_windowBackgroundWhiteGreenText; + } else { + cell.setTextAndValue(LocaleController.getString("Unavailable", R.string.Unavailable), LocaleController.getString("Unavailable", R.string.Unavailable), true); + colorKey = Theme.key_windowBackgroundWhiteRedText4; + } + cell.getValueTextView().setTextColor(Theme.getColor(colorKey)); + })); } } diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java b/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java index d0ffef712..2e19f22c2 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/ApplicationLoader.java @@ -32,6 +32,7 @@ import com.google.firebase.iid.FirebaseInstanceId; import com.microsoft.appcenter.AppCenter; import com.microsoft.appcenter.analytics.Analytics; import com.microsoft.appcenter.crashes.Crashes; +import com.microsoft.appcenter.push.Push; import org.telegram.tgnet.ConnectionsManager; import org.telegram.tgnet.TLRPC; @@ -178,7 +179,7 @@ public class ApplicationLoader extends Application { super.onCreate(); AppCenter.start(this, "033a70ca-ea8d-4c2f-8c2c-b37f1b47f766", - Analytics.class, Crashes.class); + Analytics.class, Crashes.class, Push.class); if (applicationContext == null) { applicationContext = getApplicationContext(); }