From 69fd5333d7c248458127a097b4638e5118f911f1 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 8 Apr 2024 02:45:54 +0300 Subject: [PATCH] Hide all business bot manage bars when changing business bot. --- td/telegram/BusinessManager.cpp | 1 + td/telegram/MessagesManager.cpp | 10 ++++++++++ td/telegram/MessagesManager.h | 2 ++ 3 files changed, 13 insertions(+) diff --git a/td/telegram/BusinessManager.cpp b/td/telegram/BusinessManager.cpp index 027e53dd1..c8891be73 100644 --- a/td/telegram/BusinessManager.cpp +++ b/td/telegram/BusinessManager.cpp @@ -102,6 +102,7 @@ class UpdateConnectedBotQuery final : public Td::ResultHandler { auto ptr = result_ptr.move_as_ok(); LOG(INFO) << "Receive result for UpdateConnectedBotQuery: " << to_string(ptr); + td_->messages_manager_->hide_all_business_bot_manager_bars(); td_->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_)); } diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index f13e01c43..6ec12bc73 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -7859,6 +7859,16 @@ void MessagesManager::remove_dialog_action_bar(DialogId dialog_id, Promise toggle_dialog_report_spam_state_on_server(dialog_id, false, 0, std::move(promise)); } +void MessagesManager::hide_all_business_bot_manager_bars() { + dialogs_.foreach([&](const DialogId &dialog_id, unique_ptr &dialog) { + Dialog *d = dialog.get(); + if (d->business_bot_manage_bar != nullptr) { + d->business_bot_manage_bar = nullptr; + send_update_chat_business_bot_manage_bar(d); + } + }); +} + void MessagesManager::repair_dialog_active_group_call_id(DialogId dialog_id) { if (td_->dialog_manager_->have_input_peer(dialog_id, AccessRights::Read)) { LOG(INFO) << "Repair active voice chat ID in " << dialog_id; diff --git a/td/telegram/MessagesManager.h b/td/telegram/MessagesManager.h index 8ed376bd5..f83778aab 100644 --- a/td/telegram/MessagesManager.h +++ b/td/telegram/MessagesManager.h @@ -850,6 +850,8 @@ class MessagesManager final : public Actor { void reget_dialog_action_bar(DialogId dialog_id, const char *source, bool is_repair = true); + void hide_all_business_bot_manager_bars(); + void on_get_peer_settings(DialogId dialog_id, tl_object_ptr &&peer_settings, bool ignore_privacy_exception = false);