Skip to content

Commit

Permalink
Add StoryManager.
Browse files Browse the repository at this point in the history
  • Loading branch information
levlam committed May 1, 2023
1 parent 030e440 commit b0ab122
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ set(TDLIB_SOURCE
td/telegram/StickersManager.cpp
td/telegram/StickerType.cpp
td/telegram/StorageManager.cpp
td/telegram/StoryManager.cpp
td/telegram/SuggestedAction.cpp
td/telegram/Support.cpp
td/telegram/Td.cpp
Expand Down Expand Up @@ -755,6 +756,7 @@ set(TDLIB_SOURCE
td/telegram/StickersManager.h
td/telegram/StickerType.h
td/telegram/StorageManager.h
td/telegram/StoryManager.h
td/telegram/SuggestedAction.h
td/telegram/Support.h
td/telegram/Td.h
Expand Down
1 change: 1 addition & 0 deletions SplitSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ function ($matches) use ($needed_std_headers) {
'secret_chats_manager[_(-]|SecretChatsManager' => 'SecretChatsManager',
'sponsored_message_manager[_(-][^.]|SponsoredMessageManager' => 'SponsoredMessageManager',
'stickers_manager[_(-][^.]|StickersManager' => 'StickersManager',
'story_manager[_(-][^.]|StoryManager' => 'StoryManager',
'[>](td_db[(][)]|get_td_db_impl[(])|TdDb[^A-Za-z]' => 'TdDb',
'theme_manager[_(-][^.]|ThemeManager' => "ThemeManager",
'TopDialogCategory|get_top_dialog_category' => 'TopDialogCategory',
Expand Down
18 changes: 18 additions & 0 deletions td/telegram/StoryManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Copyright Aliaksei Levin ([email protected]), Arseny Smirnov ([email protected]) 2014-2023
//
// 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/StoryManager.h"

namespace td {

StoryManager::StoryManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
}

void StoryManager::tear_down() {
parent_.reset();
}

} // namespace td
28 changes: 28 additions & 0 deletions td/telegram/StoryManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// Copyright Aliaksei Levin ([email protected]), Arseny Smirnov ([email protected]) 2014-2023
//
// 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 StoryManager final : public Actor {
public:
StoryManager(Td *td, ActorShared<> parent);

private:
void tear_down() final;

Td *td_;
ActorShared<> parent_;
};

} // namespace td
7 changes: 7 additions & 0 deletions td/telegram/Td.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
#include "td/telegram/StickersManager.h"
#include "td/telegram/StickerType.h"
#include "td/telegram/StorageManager.h"
#include "td/telegram/StoryManager.h"
#include "td/telegram/SuggestedAction.h"
#include "td/telegram/Support.h"
#include "td/telegram/td_api.hpp"
Expand Down Expand Up @@ -3226,6 +3227,8 @@ void Td::dec_actor_refcnt() {
LOG(DEBUG) << "SponsoredMessageManager was cleared" << timer;
stickers_manager_.reset();
LOG(DEBUG) << "StickersManager was cleared" << timer;
story_manager_.reset();
LOG(DEBUG) << "StoryManager was cleared" << timer;
theme_manager_.reset();
LOG(DEBUG) << "ThemeManager was cleared" << timer;
top_dialog_manager_.reset();
Expand Down Expand Up @@ -3426,6 +3429,8 @@ void Td::clear() {
LOG(DEBUG) << "SponsoredMessageManager actor was cleared" << timer;
stickers_manager_actor_.reset();
LOG(DEBUG) << "StickersManager actor was cleared" << timer;
story_manager_actor_.reset();
LOG(DEBUG) << "StoryManager actor was cleared" << timer;
theme_manager_actor_.reset();
LOG(DEBUG) << "ThemeManager actor was cleared" << timer;
top_dialog_manager_actor_.reset();
Expand Down Expand Up @@ -3915,6 +3920,8 @@ void Td::init_managers() {
stickers_manager_ = make_unique<StickersManager>(this, create_reference());
stickers_manager_actor_ = register_actor("StickersManager", stickers_manager_.get());
G()->set_stickers_manager(stickers_manager_actor_.get());
story_manager_ = make_unique<StoryManager>(this, create_reference());
story_manager_actor_ = register_actor("StoryManager", story_manager_.get());
theme_manager_ = make_unique<ThemeManager>(this, create_reference());
theme_manager_actor_ = register_actor("ThemeManager", theme_manager_.get());
G()->set_theme_manager(theme_manager_actor_.get());
Expand Down
3 changes: 3 additions & 0 deletions td/telegram/Td.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class SponsoredMessageManager;
class StateManager;
class StickersManager;
class StorageManager;
class StoryManager;
class ThemeManager;
class TopDialogManager;
class TranslationManager;
Expand Down Expand Up @@ -192,6 +193,8 @@ class Td final : public Actor {
ActorOwn<SponsoredMessageManager> sponsored_message_manager_actor_;
unique_ptr<StickersManager> stickers_manager_;
ActorOwn<StickersManager> stickers_manager_actor_;
unique_ptr<StoryManager> story_manager_;
ActorOwn<StoryManager> story_manager_actor_;
unique_ptr<ThemeManager> theme_manager_;
ActorOwn<ThemeManager> theme_manager_actor_;
unique_ptr<TopDialogManager> top_dialog_manager_;
Expand Down

0 comments on commit b0ab122

Please sign in to comment.