Skip to content

Commit

Permalink
feat: Disable Bot Open Button
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Dec 21, 2024
1 parent 1cd59a4 commit 66ea7e3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public void setOpenBotButton(boolean show) {
private boolean allowBotOpenButton;
private Utilities.Callback<TLRPC.User> onOpenButtonClick;
public DialogCell allowBotOpenButton(boolean allow, Utilities.Callback<TLRPC.User> onOpenClick) {
allowBotOpenButton = allow;
allowBotOpenButton = allow && !NaConfig.INSTANCE.getDisableBotOpenButton().Bool();
onOpenButtonClick = onOpenClick;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@

import java.util.Locale;

import xyz.nextalone.nagram.NaConfig;
import xyz.nextalone.nagram.helper.MessageHelper;

public class ProfileSearchCell extends BaseCell implements NotificationCenter.NotificationCenterDelegate, Theme.Colorable {
Expand Down Expand Up @@ -152,7 +153,7 @@ public ProfileSearchCell(Context context, Theme.ResourcesProvider resourcesProvi
private boolean allowBotOpenButton;
private Utilities.Callback<TLRPC.User> onOpenButtonClick;
public ProfileSearchCell allowBotOpenButton(boolean allow, Utilities.Callback<TLRPC.User> onOpenClick) {
allowBotOpenButton = allow;
allowBotOpenButton = allow && !NaConfig.INSTANCE.getDisableBotOpenButton().Bool();
onOpenButtonClick = onOpenClick;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public class NekoChatSettingsActivity extends BaseNekoXSettingsActivity implemen
private final AbstractConfigCell showQuickReplyInBotCommandsRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getShowQuickReplyInBotCommands()));
private final AbstractConfigCell disablePreviewVideoSoundShortcutRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDisablePreviewVideoSoundShortcut(), LocaleController.getString(R.string.DisablePreviewVideoSoundShortcutNotice)));
private final AbstractConfigCell showTimeHintRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getShowTimeHint()));
private final AbstractConfigCell disableBotOpenButtonRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDisableBotOpenButton()));
private final AbstractConfigCell dividerInteractions = cellGroup.appendCell(new ConfigCellDivider());

// Sticker
Expand Down Expand Up @@ -354,6 +355,8 @@ public void onItemClick(int id) {
MediaController.getInstance().recreateProximityWakeLock();
} else if (key.equals(NekoConfig.showSeconds.getKey())) {
tooltip.showWithAction(0, UndoView.ACTION_NEED_RESATRT, null, null);
} else if (key.equals(NaConfig.INSTANCE.getDisableBotOpenButton().getKey())) {
tooltip.showWithAction(0, UndoView.ACTION_NEED_RESATRT, null, null);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,12 @@ object NaConfig {
ConfigItem.configTypeInt,
0
)
val disableBotOpenButton =
addConfig(
"DisableBotOpenButton",
ConfigItem.configTypeBool,
false
)

private fun addConfig(
k: String,
Expand Down
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values-zh-rCN/strings_na.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,5 @@
<string name="SendWithPangu">使用 Pangu 发送</string>
<string name="SendWithoutPangu">不使用 Pangu 发送</string>
<string name="DefaultHlsVideoQuality">默认 Hls 视频质量</string>
<string name="DisableBotOpenButton">禁用 Bot 的打开小程序按钮</string>
</resources>
1 change: 1 addition & 0 deletions TMessagesProj/src/main/res/values/strings_na.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,5 @@
<string name="SendWithPangu">Send with Pangu</string>
<string name="SendWithoutPangu">Send without Pangu</string>
<string name="DefaultHlsVideoQuality">Default Hls Video Quality</string>
<string name="DisableBotOpenButton">Disable Bot Open Button</string>
</resources>

0 comments on commit 66ea7e3

Please sign in to comment.