1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-12-12 11:19:29 +01:00

hide proxy sponsor channel

This commit is contained in:
NekoInverter 2020-01-11 11:03:24 +08:00 committed by Riko Sakurauchi
parent f51c4031d6
commit 83fd50b770
No known key found for this signature in database
GPG Key ID: 25AC0345B92902AF
8 changed files with 34 additions and 3 deletions

View File

@ -54,6 +54,7 @@ import java.util.concurrent.CountDownLatch;
import androidx.core.app.NotificationManagerCompat;
import tw.nekomimi.nekogram.FilterPopup;
import tw.nekomimi.nekogram.NekoConfig;
public class MessagesController extends BaseController implements NotificationCenter.NotificationCenterDelegate {
@ -3659,7 +3660,7 @@ public class MessagesController extends BaseController implements NotificationCe
removeCurrent = 1;
}
lastCheckProxyId++;
if (enabled && !TextUtils.isEmpty(proxyAddress) && !TextUtils.isEmpty(proxySecret)) {
if (!NekoConfig.hideProxySponsorChannel && enabled && !TextUtils.isEmpty(proxyAddress) && !TextUtils.isEmpty(proxySecret)) {
checkingProxyInfo = true;
int checkProxyId = lastCheckProxyId;
TLRPC.TL_help_getProxyData req = new TLRPC.TL_help_getProxyData();

View File

@ -20,6 +20,7 @@ public class NekoConfig {
public static int mapPreviewProvider = 0;
public static boolean transparentStatusBar = true;
public static boolean residentNotification = false;
public static boolean hideProxySponsorChannel = false;
public static boolean showAddToSavedMessages = true;
public static boolean showReport = false;
@ -54,6 +55,7 @@ public class NekoConfig {
editor.putInt("mapPreviewProvider", mapPreviewProvider);
editor.putBoolean("transparentStatusBar", transparentStatusBar);
editor.putBoolean("residentNotification", residentNotification);
editor.putBoolean("hideProxySponsorChannel", hideProxySponsorChannel);
editor.putBoolean("showAddToSavedMessages", showAddToSavedMessages);
editor.putBoolean("showReport", showReport);
editor.putBoolean("showPrPr", showPrPr);
@ -88,6 +90,7 @@ public class NekoConfig {
mapPreviewProvider = preferences.getInt("mapPreviewProvider", 0);
transparentStatusBar = preferences.getBoolean("transparentStatusBar", true);
residentNotification = preferences.getBoolean("residentNotification", false);
hideProxySponsorChannel = preferences.getBoolean("hideProxySponsorChannel", false);
showAddToSavedMessages = preferences.getBoolean("showAddToSavedMessages", true);
showReport = preferences.getBoolean("showReport", false);
showPrPr = preferences.getBoolean("showPrPr", true);
@ -230,6 +233,14 @@ public class NekoConfig {
}
}
public static void toggleHideProxySponsorChannel() {
hideProxySponsorChannel = !hideProxySponsorChannel;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("hideProxySponsorChannel", hideProxySponsorChannel);
editor.commit();
}
public static void toggleXmas() {
xmas = !xmas;
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("nekoconfig", Activity.MODE_PRIVATE);

View File

@ -80,6 +80,7 @@ public class NekoSettingsActivity extends BaseFragment {
private int hidePhoneRow;
private int nameOrderRow;
private int transparentStatusBarRow;
private int hideProxySponsorChannelRow;
private int forceTabletRow;
private int xmasRow;
private int newYearRow;
@ -200,6 +201,16 @@ public class NekoSettingsActivity extends BaseFragment {
((TextCheckCell) view).setChecked(NekoConfig.transparentStatusBar);
}
AndroidUtilities.runOnUIThread(() -> NotificationCenter.getGlobalInstance().postNotificationName(NotificationCenter.didSetNewTheme, false));
} else if (position == hideProxySponsorChannelRow) {
NekoConfig.toggleHideProxySponsorChannel();
if (view instanceof TextCheckCell) {
((TextCheckCell) view).setChecked(NekoConfig.hideProxySponsorChannel);
}
for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
if (UserConfig.getInstance(a).isClientActivated()) {
MessagesController.getInstance(a).checkProxyInfo(true);
}
}
} else if (position == useSystemEmojiRow) {
SharedConfig.useSystemEmoji = !SharedConfig.useSystemEmoji;
SharedPreferences.Editor editor = MessagesController.getGlobalMainSettings().edit();
@ -318,6 +329,7 @@ public class NekoSettingsActivity extends BaseFragment {
inappCameraRow = rowCount++;
useSystemEmojiRow = rowCount++;
ignoreBlockedRow = rowCount++;
hideProxySponsorChannelRow = rowCount++;
mapPreviewRow = rowCount++;
chat2Row = rowCount++;
messageMenuRow = rowCount++;
@ -456,6 +468,8 @@ public class NekoSettingsActivity extends BaseFragment {
textCell.setTextAndCheck(LocaleController.getString("DebugMenuEnableCamera", R.string.DebugMenuEnableCamera), SharedConfig.inappCamera, true);
} else if (position == transparentStatusBarRow) {
textCell.setTextAndCheck(LocaleController.getString("TransparentStatusBar", R.string.TransparentStatusBar), NekoConfig.transparentStatusBar, true);
} else if (position == hideProxySponsorChannelRow) {
textCell.setTextAndCheck(LocaleController.getString("HideProxySponsorChannel", R.string.HideProxySponsorChannel), NekoConfig.hideProxySponsorChannel, true);
} else if (position == useSystemEmojiRow) {
textCell.setTextAndCheck(LocaleController.getString("EmojiUseDefault", R.string.EmojiUseDefault), SharedConfig.useSystemEmoji, true);
} else if (position == typefaceRow) {
@ -507,7 +521,7 @@ public class NekoSettingsActivity extends BaseFragment {
position == showPrPrRow || position == showAddToSavedMessagesRow ||
position == nameOrderRow || position == forceTabletRow || position == mapPreviewRow ||
position == xmasRow || position == newYearRow || position == newYearEveRow || position == fireworksRow ||
position == transparentStatusBarRow;
position == transparentStatusBarRow || position == hideProxySponsorChannelRow;
}
@Override
@ -555,7 +569,7 @@ public class NekoSettingsActivity extends BaseFragment {
} else if (position == ipv6Row || position == hidePhoneRow || position == inappCameraRow ||
position == showAddToSavedMessagesRow || position == showPrPrRow || position == showReportRow ||
position == showAdminActionsRow || position == showChangePermissionsRow || position == showDeleteDownloadedFileRow ||
position == transparentStatusBarRow ||
position == transparentStatusBarRow || position == hideProxySponsorChannelRow ||
position == ignoreBlockedRow || position == useSystemEmojiRow || position == typefaceRow ||
position == forceTabletRow || position == xmasRow || position == newYearRow || position == newYearEveRow ||
position == fireworksRow) {

View File

@ -49,4 +49,5 @@
<string name="TestBackend">Test Backend</string>
<string name="TestBackendOn">Questo account si connetterà al server di test.</string>
<string name="TestBackendOff">Questo account si connetterà al server principale.</string>
<string name="HideProxySponsorChannel">Nascondi canale sponsor proxy</string>
</resources>

View File

@ -49,4 +49,5 @@
<string name="TestBackend">異世界</string>
<string name="TestBackendOn">このアカウントは、テストバックエンドに接続します。</string>
<string name="TestBackendOff">このアカウントは、本番バックエンドに接続します。</string>
<string name="HideProxySponsorChannel">Proxy sponsor channel を非表示</string>
</resources>

View File

@ -49,4 +49,5 @@
<string name="TestBackend">异世界</string>
<string name="TestBackendOn">此账户将连接至测试后端服务器。</string>
<string name="TestBackendOff">此账户将连接至生产后端服务器。</string>
<string name="HideProxySponsorChannel">隐藏代理赞助商频道</string>
</resources>

View File

@ -49,4 +49,5 @@
<string name="TestBackend">異世界</string>
<string name="TestBackendOn">此賬戶將連接至測試後端伺服器。</string>
<string name="TestBackendOff">此賬戶將連接至生產後端伺服器。</string>
<string name="HideProxySponsorChannel">隱藏代理贊助商頻道</string>
</resources>

View File

@ -54,4 +54,5 @@
<string name="TestBackend">Test Backend</string>
<string name="TestBackendOn">This account will connect to the test backend.</string>
<string name="TestBackendOff">This account will connect to the production backend.</string>
<string name="HideProxySponsorChannel">Hide proxy sponsor channel</string>
</resources>