feat: Hide Premium Only Channel

This commit is contained in:
xtaodada 2022-10-13 14:03:41 +08:00
parent 94f9137a6f
commit cec3bdcf15
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
5 changed files with 12 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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));

View File

@ -322,6 +322,12 @@ object NaConfig {
ConfigItem.configTypeString,
""
)
val hidePremiumOnlyChannel =
addConfig(
"HidePremiumOnlyChannel",
ConfigItem.configTypeBool,
false
)
private fun addConfig(
k: String,

View File

@ -66,4 +66,5 @@
<string name="CustomPoor">自定义长按快捷回复词</string>
<string name="CustomPoorHint">默认破烂</string>
<string name="CustomEditedMessage">自定义已编辑消息提示词</string>
<string name="HidePremiumOnlyChannel">隐藏大会员皮套</string>
</resources>

View File

@ -67,4 +67,5 @@
<string name="CustomPoor">Custom long click reply word</string>
<string name="CustomPoorHint">Default pool</string>
<string name="CustomEditedMessage">Custom Edited Message word</string>
<string name="HidePremiumOnlyChannel">Hide Premium Only Channel</string>
</resources>