Add PromoDataManager.

This commit is contained in:
levlam 2024-08-01 13:57:39 +03:00
parent 2adad66847
commit d63ef82e5d
7 changed files with 71 additions and 4 deletions

View File

@ -519,6 +519,7 @@ set(TDLIB_SOURCE_PART2
td/telegram/Premium.cpp
td/telegram/PremiumGiftOption.cpp
td/telegram/PrivacyManager.cpp
td/telegram/PromoDataManager.cpp
td/telegram/QueryCombiner.cpp
td/telegram/QueryMerger.cpp
td/telegram/QuickReplyManager.cpp
@ -848,6 +849,7 @@ set(TDLIB_SOURCE_PART2
td/telegram/Premium.h
td/telegram/PremiumGiftOption.h
td/telegram/PrivacyManager.h
td/telegram/PromoDataManager.h
td/telegram/PtsManager.h
td/telegram/PublicDialogType.h
td/telegram/QueryCombiner.h

View File

@ -392,6 +392,7 @@ function split_file($file, $chunks, $undo) {
'PhotoSizeSource' => 'PhotoSizeSource',
'poll_manager[_(-](?![.]get[(][)])|PollManager' => 'PollManager',
'privacy_manager[_(-](?![.]get[(][)])|PrivacyManager' => 'PrivacyManager',
'promo_data_manager[_(-](?![.]get[(][)])|PromoDataManager' => 'PromoDataManager',
'PublicDialogType|get_public_dialog_type' => 'PublicDialogType',
'quick_reply_manager[_(-](?![.]get[(][)])|QuickReplyManager' => 'QuickReplyManager',
'ReactionListType|[a-z_]*_reaction_list_type' => 'ReactionListType',

View File

@ -66,6 +66,7 @@ class NotificationSettingsManager;
class OptionManager;
class PasswordManager;
class PeopleNearbyManager;
class PromoDataManager;
class QuickReplyManager;
class ReactionManager;
class SavedMessagesManager;
@ -425,6 +426,13 @@ class Global final : public ActorContext {
people_nearby_manager_ = people_nearby_manager;
}
ActorId<PromoDataManager> promo_data_manager() const {
return promo_data_manager_;
}
void set_promo_data_manager(ActorId<PromoDataManager> promo_data_manager) {
promo_data_manager_ = promo_data_manager;
}
ActorId<QuickReplyManager> quick_reply_manager() const {
return quick_reply_manager_;
}
@ -691,6 +699,7 @@ class Global final : public ActorContext {
ActorId<NotificationSettingsManager> notification_settings_manager_;
ActorId<PasswordManager> password_manager_;
ActorId<PeopleNearbyManager> people_nearby_manager_;
ActorId<PromoDataManager> promo_data_manager_;
ActorId<QuickReplyManager> quick_reply_manager_;
ActorId<ReactionManager> reaction_manager_;
ActorId<SavedMessagesManager> saved_messages_manager_;

View File

@ -0,0 +1,18 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// 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/PromoDataManager.h"
namespace td {
PromoDataManager::PromoDataManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}
void PromoDataManager::tear_down() {
parent_.reset();
}
} // namespace td

View File

@ -0,0 +1,28 @@
//
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// 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/actor/actor.h"
#include "td/utils/common.h"
namespace td {
class Td;
class PromoDataManager final : public Actor {
public:
PromoDataManager(Td *td, ActorShared<> parent);
private:
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -123,6 +123,7 @@
#include "td/telegram/PollManager.h"
#include "td/telegram/Premium.h"
#include "td/telegram/PrivacyManager.h"
#include "td/telegram/PromoDataManager.h"
#include "td/telegram/PublicDialogType.h"
#include "td/telegram/QuickReplyManager.h"
#include "td/telegram/ReactionManager.h"
@ -2808,6 +2809,7 @@ void Td::dec_actor_refcnt() {
reset_manager(phone_number_manager_, "PhoneNumberManager");
reset_manager(poll_manager_, "PollManager");
reset_manager(privacy_manager_, "PrivacyManager");
reset_manager(promo_data_manager_, "PromoDataManager");
reset_manager(quick_reply_manager_, "QuickReplyManager");
reset_manager(reaction_manager_, "ReactionManager");
reset_manager(saved_messages_manager_, "SavedMessagesManager");
@ -2986,6 +2988,7 @@ void Td::clear() {
reset_actor(ActorOwn<Actor>(std::move(phone_number_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(poll_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(privacy_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(promo_data_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(quick_reply_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(reaction_manager_actor_)));
reset_actor(ActorOwn<Actor>(std::move(saved_messages_manager_actor_)));
@ -3530,6 +3533,9 @@ void Td::init_managers() {
poll_manager_actor_ = register_actor("PollManager", poll_manager_.get());
privacy_manager_ = make_unique<PrivacyManager>(this, create_reference());
privacy_manager_actor_ = register_actor("PrivacyManager", privacy_manager_.get());
promo_data_manager_ = make_unique<PromoDataManager>(this, create_reference());
promo_data_manager_actor_ = register_actor("PromoDataManager", promo_data_manager_.get());
G()->set_promo_data_manager(promo_data_manager_actor_.get());
quick_reply_manager_ = make_unique<QuickReplyManager>(this, create_reference());
quick_reply_manager_actor_ = register_actor("QuickReplyManager", quick_reply_manager_.get());
G()->set_quick_reply_manager(quick_reply_manager_actor_.get());

View File

@ -81,6 +81,7 @@ class PeopleNearbyManager;
class PhoneNumberManager;
class PollManager;
class PrivacyManager;
class PromoDataManager;
class QuickReplyManager;
class ReactionManager;
class SavedMessagesManager;
@ -228,14 +229,16 @@ class Td final : public Actor {
ActorOwn<NotificationManager> notification_manager_actor_;
unique_ptr<NotificationSettingsManager> notification_settings_manager_;
ActorOwn<NotificationSettingsManager> notification_settings_manager_actor_;
unique_ptr<PollManager> poll_manager_;
ActorOwn<PollManager> poll_manager_actor_;
unique_ptr<PrivacyManager> privacy_manager_;
ActorOwn<PrivacyManager> privacy_manager_actor_;
unique_ptr<PeopleNearbyManager> people_nearby_manager_;
ActorOwn<PeopleNearbyManager> people_nearby_manager_actor_;
unique_ptr<PhoneNumberManager> phone_number_manager_;
ActorOwn<PhoneNumberManager> phone_number_manager_actor_;
unique_ptr<PollManager> poll_manager_;
ActorOwn<PollManager> poll_manager_actor_;
unique_ptr<PrivacyManager> privacy_manager_;
ActorOwn<PrivacyManager> privacy_manager_actor_;
unique_ptr<PromoDataManager> promo_data_manager_;
ActorOwn<PromoDataManager> promo_data_manager_actor_;
unique_ptr<QuickReplyManager> quick_reply_manager_;
ActorOwn<QuickReplyManager> quick_reply_manager_actor_;
unique_ptr<ReactionManager> reaction_manager_;