Add empty AttachMenuManager.

This commit is contained in:
levlam 2022-03-25 14:17:09 +03:00
parent 461b740987
commit 7da29e17d6
6 changed files with 75 additions and 0 deletions

View File

@ -278,6 +278,7 @@ set(TDLIB_SOURCE
td/telegram/Account.cpp
td/telegram/AnimationsManager.cpp
td/telegram/AttachMenuManager.cpp
td/telegram/AudiosManager.cpp
td/telegram/AuthManager.cpp
td/telegram/AutoDownloadSettings.cpp
@ -465,6 +466,7 @@ set(TDLIB_SOURCE
td/telegram/Account.h
td/telegram/AffectedHistory.h
td/telegram/AnimationsManager.h
td/telegram/AttachMenuManager.h
td/telegram/AudiosManager.h
td/telegram/AuthManager.h
td/telegram/AutoDownloadSettings.h

View File

@ -277,6 +277,7 @@ function split_file($file, $chunks, $undo) {
if (!preg_match('/Td::~?Td/', $new_content)) { // destructor Td::~Td needs to see definitions of all forward-declared classes
$td_methods = array(
'animations_manager[_(-][^.]|AnimationsManager[^;>]' => "AnimationsManager",
'attach_menu_manager[_(-][^.]|AttachMenuManager[^;>]' => "AttachMenuManager",
'audios_manager[_(-][^.]|AudiosManager' => "AudiosManager",
'auth_manager[_(-][^.]|AuthManager' => 'AuthManager',
'background_manager[_(-][^.]|BackgroundManager' => "BackgroundManager",

View File

@ -0,0 +1,27 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/telegram/AttachMenuManager.h"
#include "td/telegram/AuthManager.h"
#include "td/telegram/Td.h"
namespace td {
AttachMenuManager::AttachMenuManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
void AttachMenuManager::tear_down() {
parent_.reset();
}
void AttachMenuManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
if (td_->auth_manager_->is_bot()) {
return;
}
}
} // namespace td

View File

@ -0,0 +1,33 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2022
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#pragma once
#include "td/telegram/td_api.h"
#include "td/actor/actor.h"
#include "td/utils/common.h"
namespace td {
class Td;
class AttachMenuManager final : public Actor {
public:
AttachMenuManager(Td *td, ActorShared<> parent);
void get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const;
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -8,6 +8,7 @@
#include "td/telegram/Account.h"
#include "td/telegram/AnimationsManager.h"
#include "td/telegram/AttachMenuManager.h"
#include "td/telegram/AudiosManager.h"
#include "td/telegram/AuthManager.h"
#include "td/telegram/AutoDownloadSettings.h"
@ -3320,6 +3321,8 @@ void Td::dec_actor_refcnt() {
Timer timer;
animations_manager_.reset();
LOG(DEBUG) << "AnimationsManager was cleared" << timer;
attach_menu_manager_.reset();
LOG(DEBUG) << "AttachMenuManager was cleared" << timer;
audios_manager_.reset();
LOG(DEBUG) << "AudiosManager was cleared" << timer;
auth_manager_.reset();
@ -3514,6 +3517,8 @@ void Td::clear() {
// clear actors which are unique pointers
animations_manager_actor_.reset();
LOG(DEBUG) << "AnimationsManager actor was cleared" << timer;
attach_menu_manager_actor_.reset();
LOG(DEBUG) << "AttachMenuManager actor was cleared" << timer;
auth_manager_actor_.reset();
LOG(DEBUG) << "AuthManager actor was cleared" << timer;
background_manager_actor_.reset();
@ -3983,6 +3988,8 @@ void Td::init_managers() {
animations_manager_ = make_unique<AnimationsManager>(this, create_reference());
animations_manager_actor_ = register_actor("AnimationsManager", animations_manager_.get());
G()->set_animations_manager(animations_manager_actor_.get());
attach_menu_manager_ = make_unique<AttachMenuManager>(this, create_reference());
attach_menu_manager_actor_ = register_actor("AttachMenuManager", attach_menu_manager_.get());
background_manager_ = make_unique<BackgroundManager>(this, create_reference());
background_manager_actor_ = register_actor("BackgroundManager", background_manager_.get());
G()->set_background_manager(background_manager_actor_.get());
@ -4417,6 +4424,8 @@ void Td::on_request(uint64 id, const td_api::getCurrentState &request) {
animations_manager_->get_current_state(updates);
attach_menu_manager_->get_current_state(updates);
stickers_manager_->get_current_state(updates);
messages_manager_->get_current_state(updates);

View File

@ -38,6 +38,7 @@
namespace td {
class AnimationsManager;
class AttachMenuManager;
class AudiosManager;
class AuthManager;
class BackgroundManager;
@ -138,6 +139,8 @@ class Td final : public Actor {
unique_ptr<AnimationsManager> animations_manager_;
ActorOwn<AnimationsManager> animations_manager_actor_;
unique_ptr<AttachMenuManager> attach_menu_manager_;
ActorOwn<AttachMenuManager> attach_menu_manager_actor_;
unique_ptr<AuthManager> auth_manager_;
ActorOwn<AuthManager> auth_manager_actor_;
unique_ptr<BackgroundManager> background_manager_;