Skip to content

Commit

Permalink
feat: Show Quick Reply In Bot Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
omg-xtao committed Mar 10, 2024
1 parent 6adf50d commit 7965ae4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2527,7 +2527,9 @@ public boolean onFragmentCreate() {
hasQuickReplies = false;
if (currentUser != null && chatMode == 0 && !currentUser.bot) {
QuickRepliesController.getInstance(currentAccount).load();
// hasQuickReplies = QuickRepliesController.getInstance(currentAccount).hasReplies();
if (NaConfig.INSTANCE.getShowQuickReplyInBotCommands().Bool()) {
hasQuickReplies = QuickRepliesController.getInstance(currentAccount).hasReplies();
}
}
} else if (encId != 0) {
currentEncryptedChat = getMessagesController().getEncryptedChat(encId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10268,13 +10268,13 @@ private boolean checkBotButton() {
if (botButton == null) {
return false;
}
boolean canShowBotsMenu = hasBotCommands && dialog_id > 0;
boolean canShowBotsMenu = botMenuButtonType != BotMenuButtonType.NO_BUTTON && dialog_id > 0;
// if (canShowBotsMenu && ) {
// TLRPC.Chat chat = accountInstance.getMessagesController().getChat(-(int) dialog_id);
// canShowBotsMenu = chat == null || !chat.megagroup;
// }

if (hasBotCommands || botReplyMarkup != null) {
if (hasBotCommands || hasQuickReplies || botReplyMarkup != null) {
if (botReplyMarkup != null) {
if (isPopupShowing() && currentPopupContentType == 1) {
botButtonDrawable.setIcon(R.drawable.input_keyboard, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ public class NekoChatSettingsActivity extends BaseNekoXSettingsActivity implemen
private final AbstractConfigCell doNotUnarchiveBySwipeRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDoNotUnarchiveBySwipe()));
private final AbstractConfigCell disableMarkdownRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDisableMarkdown()));
private final AbstractConfigCell disableClickCommandToSendRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getDisableClickCommandToSend(), LocaleController.getString(R.string.DisableClickCommandToSendHint)));
private final AbstractConfigCell showQuickReplyInBotCommandsRow = cellGroup.appendCell(new ConfigCellTextCheck(NaConfig.INSTANCE.getShowQuickReplyInBotCommands()));
private final AbstractConfigCell dividerInteractions = cellGroup.appendCell(new ConfigCellDivider());

// Sticker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,12 @@ object NaConfig {
ConfigItem.configTypeBool,
false
)
val showQuickReplyInBotCommands =
addConfig(
"ShowQuickReplyInBotCommands",
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 @@ -125,4 +125,5 @@
<string name="DisableDialogsFloatingButton">禁用主页浮动按钮</string>
<string name="DisableFlagSecure">Disable Flag Secure</string>
<string name="CenterActionBarTitle">标题居中</string>
<string name="ShowQuickReplyInBotCommands">在输入框中显示快速回复按钮</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 @@ -125,4 +125,5 @@
<string name="DisableDialogsFloatingButton">Disable Dialogs Floating Button</string>
<string name="DisableFlagSecure">Disable Flag Secure</string>
<string name="CenterActionBarTitle">Center title in action bar</string>
<string name="ShowQuickReplyInBotCommands">Show Quick Reply In Bot Commands</string>
</resources>

0 comments on commit 7965ae4

Please sign in to comment.