From cec3bdcf15f892db50cf6a29149240fdfa9889d2 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Thu, 13 Oct 2022 14:03:41 +0800 Subject: [PATCH] feat: Hide Premium Only Channel --- .../src/main/java/org/telegram/ui/ChatActivity.java | 3 +++ .../nekogram/settings/NekoChatSettingsActivity.java | 1 + .../src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt | 6 ++++++ TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml | 1 + TMessagesProj/src/main/res/values/strings_na.xml | 1 + 5 files changed, 12 insertions(+) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 9e262dd9e..a2945dda2 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -17867,6 +17867,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not } sendAsPeersObj = getMessagesController().getSendAsPeers(dialog_id); if (sendAsPeersObj != null) { + if (NaConfig.INSTANCE.getHidePremiumOnlyChannel().Bool()) { + sendAsPeersObj.peers.removeIf(peer -> peer.premium_required); + } chatActivityEnterView.updateSendAsButton(animatedUpdate); } } diff --git a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoChatSettingsActivity.java b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoChatSettingsActivity.java index 5770ba25a..df7a19825 100644 --- a/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoChatSettingsActivity.java +++ b/TMessagesProj/src/main/java/tw/nekomimi/nekogram/settings/NekoChatSettingsActivity.java @@ -81,6 +81,7 @@ public class NekoChatSettingsActivity extends BaseFragment implements Notificati private final AbstractConfigCell showBottomActionsWhenSelectingRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.showBottomActionsWhenSelecting)); private final AbstractConfigCell labelChannelUserRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.labelChannelUser)); private final AbstractConfigCell hideSendAsChannelRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.hideSendAsChannel)); + private final AbstractConfigCell hidePremiumOnlyChannelRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getHidePremiumOnlyChannel())); private final AbstractConfigCell showSpoilersDirectlyRow = cellGroup.appendCell(new ConfigCellTextCheck(NekoConfig.showSpoilersDirectly)); private final AbstractConfigCell messageMenuRow = cellGroup.appendCell(new ConfigCellSelectBox(LocaleController.getString("MessageMenu"), null, null, this::showMessageMenuAlert)); private final AbstractConfigCell customGreatRow = cellGroup.appendCell(new ConfigCellTextInput(null, NaConfig.INSTANCE.getCustomGreat(), LocaleController.getString(R.string.CustomGreatHint), null,(input) -> input.isEmpty() ? (String) NaConfig.INSTANCE.getCustomGreat().defaultValue : input)); diff --git a/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt b/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt index 6bce546b7..4e0f2e7f3 100644 --- a/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt +++ b/TMessagesProj/src/main/kotlin/xyz/nextalone/nagram/NaConfig.kt @@ -322,6 +322,12 @@ object NaConfig { ConfigItem.configTypeString, "" ) + val hidePremiumOnlyChannel = + addConfig( + "HidePremiumOnlyChannel", + ConfigItem.configTypeBool, + false + ) private fun addConfig( k: String, diff --git a/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml b/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml index 39f9b2247..277d5b2f7 100644 --- a/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml +++ b/TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml @@ -66,4 +66,5 @@ 自定义长按快捷回复词 默认破烂 自定义已编辑消息提示词 + 隐藏大会员皮套 diff --git a/TMessagesProj/src/main/res/values/strings_na.xml b/TMessagesProj/src/main/res/values/strings_na.xml index b585c293f..c15d0d896 100644 --- a/TMessagesProj/src/main/res/values/strings_na.xml +++ b/TMessagesProj/src/main/res/values/strings_na.xml @@ -67,4 +67,5 @@ Custom long click reply word Default pool Custom Edited Message word + Hide Premium Only Channel