Add empty NotificationSettingsManager.

This commit is contained in:
levlam 2022-04-05 00:40:22 +03:00
parent a1125be8eb
commit 7e69ef731d
6 changed files with 71 additions and 0 deletions

View File

@ -390,6 +390,7 @@ set(TDLIB_SOURCE
td/telegram/NewPasswordState.cpp
td/telegram/NotificationManager.cpp
td/telegram/NotificationSettings.cpp
td/telegram/NotificationSettingsManager.cpp
td/telegram/NotificationType.cpp
td/telegram/OptionManager.cpp
td/telegram/Payments.cpp
@ -615,6 +616,7 @@ set(TDLIB_SOURCE
td/telegram/NotificationId.h
td/telegram/NotificationManager.h
td/telegram/NotificationSettings.h
td/telegram/NotificationSettingsManager.h
td/telegram/NotificationType.h
td/telegram/OptionManager.h
td/telegram/PasswordManager.h

View File

@ -298,6 +298,7 @@ function split_file($file, $chunks, $undo) {
'MessageCopyOptions' => 'MessageCopyOptions',
'messages_manager[_(-][^.]|MessagesManager' => 'MessagesManager',
'notification_manager[_(-][^.]|NotificationManager|notifications[)]' => 'NotificationManager',
'notification_settings_manager[_(-][^.]|NotificationSettingsManager' => 'NotificationSettingsManager',
'option_manager[_(-][^.]|OptionManager' => "OptionManager",
'phone_number_manager[_(-][^.]|PhoneNumberManager' => "PhoneNumberManager",
'poll_manager[_(-][^.]|PollManager' => "PollManager",

View File

@ -0,0 +1,21 @@
//
// 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/NotificationSettingsManager.h"
namespace td {
NotificationSettingsManager::NotificationSettingsManager(Td *td, ActorShared<> parent)
: td_(td), parent_(std::move(parent)) {
}
NotificationSettingsManager::~NotificationSettingsManager() = default;
void NotificationSettingsManager::tear_down() {
parent_.reset();
}
} // namespace td

View File

@ -0,0 +1,36 @@
//
// 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/actor/actor.h"
#include "td/utils/common.h"
namespace td {
class Td;
class NotificationSettingsManager final : public Actor {
public:
NotificationSettingsManager(Td *td, ActorShared<> parent);
NotificationSettingsManager(const NotificationSettingsManager &) = delete;
NotificationSettingsManager &operator=(const NotificationSettingsManager &) = delete;
NotificationSettingsManager(NotificationSettingsManager &&) = delete;
NotificationSettingsManager &operator=(NotificationSettingsManager &&) = delete;
~NotificationSettingsManager() final;
private:
struct SponsoredMessage;
struct DialogSponsoredMessages;
void tear_down() final;
Td *td_;
ActorShared<> parent_;
};
} // namespace td

View File

@ -85,6 +85,7 @@
#include "td/telegram/NotificationId.h"
#include "td/telegram/NotificationManager.h"
#include "td/telegram/NotificationSettings.h"
#include "td/telegram/NotificationSettingsManager.h"
#include "td/telegram/OptionManager.h"
#include "td/telegram/PasswordManager.h"
#include "td/telegram/Payments.h"
@ -3358,6 +3359,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "MessagesManager was cleared" << timer;
notification_manager_.reset();
LOG(DEBUG) << "NotificationManager was cleared" << timer;
notification_settings_manager_.reset();
LOG(DEBUG) << "NotificationSettingsManager was cleared" << timer;
option_manager_.reset();
LOG(DEBUG) << "OptionManager was cleared" << timer;
poll_manager_.reset();
@ -3548,6 +3551,8 @@ void Td::clear() {
LOG(DEBUG) << "MessagesManager actor was cleared" << timer;
notification_manager_actor_.reset();
LOG(DEBUG) << "NotificationManager actor was cleared" << timer;
notification_settings_manager_actor_.reset();
LOG(DEBUG) << "NotificationSettingsManager actor was cleared" << timer;
option_manager_actor_.reset();
LOG(DEBUG) << "OptionManager actor was cleared" << timer;
poll_manager_actor_.reset();
@ -4021,6 +4026,9 @@ void Td::init_managers() {
notification_manager_ = make_unique<NotificationManager>(this, create_reference());
notification_manager_actor_ = register_actor("NotificationManager", notification_manager_.get());
G()->set_notification_manager(notification_manager_actor_.get());
notification_settings_manager_ = make_unique<NotificationSettingsManager>(this, create_reference());
notification_settings_manager_actor_ =
register_actor("NotificationSettingsManager", notification_settings_manager_.get());
poll_manager_ = make_unique<PollManager>(this, create_reference());
poll_manager_actor_ = register_actor("PollManager", poll_manager_.get());
sponsored_message_manager_ = make_unique<SponsoredMessageManager>(this, create_reference());

View File

@ -61,6 +61,7 @@ class LinkManager;
class MessagesManager;
class NetStatsManager;
class NotificationManager;
class NotificationSettingsManager;
class OptionManager;
class PasswordManager;
class PhoneNumberManager;
@ -167,6 +168,8 @@ class Td final : public Actor {
ActorOwn<MessagesManager> messages_manager_actor_;
unique_ptr<NotificationManager> notification_manager_;
ActorOwn<NotificationManager> notification_manager_actor_;
unique_ptr<NotificationSettingsManager> notification_settings_manager_;
ActorOwn<NotificationSettingsManager> notification_settings_manager_actor_;
unique_ptr<OptionManager> option_manager_;
ActorOwn<OptionManager> option_manager_actor_;
unique_ptr<PollManager> poll_manager_;