| 95 | } // namespace |
| 96 | |
| 97 | Session::Session( |
| 98 | not_null<Account*> account, |
| 99 | const MTPUser &user, |
| 100 | std::unique_ptr<SessionSettings> settings) |
| 101 | : _userId(user.c_user().vid()) |
| 102 | , _account(account) |
| 103 | , _settings(std::move(settings)) |
| 104 | , _changes(std::make_unique<Data::Changes>(this)) |
| 105 | , _api(std::make_unique<ApiWrap>(this)) |
| 106 | , _updates(std::make_unique<Api::Updates>(this)) |
| 107 | , _sendProgressManager(std::make_unique<Api::SendProgressManager>(this)) |
| 108 | , _downloader(std::make_unique<Storage::DownloadManagerMtproto>(_api.get())) |
| 109 | , _uploader(std::make_unique<Storage::Uploader>(_api.get())) |
| 110 | , _storage(std::make_unique<Storage::Facade>()) |
| 111 | , _data(std::make_unique<Data::Session>(this)) |
| 112 | , _user(_data->processUser(user)) |
| 113 | , _emojiStickersPack(std::make_unique<Stickers::EmojiPack>(this)) |
| 114 | , _diceStickersPacks(std::make_unique<Stickers::DicePacks>(this)) |
| 115 | , _giftBoxStickersPacks(std::make_unique<Stickers::GiftBoxPack>(this)) |
| 116 | , _sendAsPeers(std::make_unique<SendAsPeers>(this)) |
| 117 | , _attachWebView(std::make_unique<InlineBots::AttachWebView>(this)) |
| 118 | , _recentPeers(std::make_unique<Data::RecentPeers>(this)) |
| 119 | , _recentSharedGifts(std::make_unique<Data::RecentSharedMediaGifts>(this)) |
| 120 | , _giftAuctions(std::make_unique<Data::GiftAuctions>(this)) |
| 121 | , _scheduledMessages(std::make_unique<Data::ScheduledMessages>(this)) |
| 122 | , _sponsoredMessages(std::make_unique<Data::SponsoredMessages>(this)) |
| 123 | , _topPeers(std::make_unique<Data::TopPeers>(this, Data::TopPeerType::Chat)) |
| 124 | , _topBotApps( |
| 125 | std::make_unique<Data::TopPeers>(this, Data::TopPeerType::BotApp)) |
| 126 | , _topGuestChatBots(std::make_unique<Data::TopPeers>( |
| 127 | this, |
| 128 | Data::TopPeerType::BotGuestChat)) |
| 129 | , _recentInlineBots(std::make_unique<Data::RecentInlineBots>(this)) |
| 130 | , _factchecks(std::make_unique<Data::Factchecks>(this)) |
| 131 | , _locationPickers(std::make_unique<Data::LocationPickers>()) |
| 132 | , _credits(std::make_unique<Data::Credits>(this)) |
| 133 | , _promoSuggestions(std::make_unique<Data::PromoSuggestions>(this, [=] { |
| 134 | using State = Data::SetupEmailState; |
| 135 | if (_promoSuggestions->setupEmailState() == State::Setup |
| 136 | || _promoSuggestions->setupEmailState() == State::SetupNoSkip) { |
| 137 | if (_settings->setupEmailState() == State::Setup |
| 138 | || _settings->setupEmailState() == State::SetupNoSkip) { |
| 139 | crl::on_main([=] { |
| 140 | // base::call_delayed(5000, [=] { |
| 141 | Core::App().lockBySetupEmail(); |
| 142 | }); |
| 143 | const auto unlockLifetime = std::make_shared<rpl::lifetime>(); |
| 144 | _promoSuggestions->setupEmailStateValue( |
| 145 | ) | rpl::filter([](Data::SetupEmailState s) { |
| 146 | return s == Data::SetupEmailState::None; |
| 147 | }) | rpl::take(1) | rpl::on_next(crl::guard(this, [=] { |
| 148 | Core::App().unlockSetupEmail(); |
| 149 | _settings->setSetupEmailState(State::None); |
| 150 | saveSettingsDelayed(200); |
| 151 | unlockLifetime->destroy(); |
| 152 | }), *unlockLifetime); |
| 153 | } else { |
| 154 | _settings->setSetupEmailState( |
nothing calls this directly
no test coverage detected