mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Remove some activeAccount() calls.
This commit is contained in:
parent
598fb67cdf
commit
ea86433be5
28 changed files with 132 additions and 58 deletions
|
@ -978,8 +978,9 @@ void ProxyBox::addLabel(
|
|||
|
||||
} // namespace
|
||||
|
||||
ProxiesBoxController::ProxiesBoxController()
|
||||
: _saveTimer([] { Local::writeSettings(); }) {
|
||||
ProxiesBoxController::ProxiesBoxController(not_null<Main::Account*> account)
|
||||
: _account(account)
|
||||
, _saveTimer([] { Local::writeSettings(); }) {
|
||||
_list = ranges::view::all(
|
||||
Global::ProxiesList()
|
||||
) | ranges::view::transform([&](const ProxyData &proxy) {
|
||||
|
@ -1058,7 +1059,9 @@ void ProxiesBoxController::refreshChecker(Item &item) {
|
|||
const auto type = (item.data.type == Type::Http)
|
||||
? Variants::Http
|
||||
: Variants::Tcp;
|
||||
const auto mtproto = Core::App().activeAccount().mtp();
|
||||
const auto mtproto = _account->mtp();
|
||||
Assert(mtproto != nullptr);
|
||||
|
||||
const auto dcId = mtproto->mainDcId();
|
||||
|
||||
item.state = ItemState::Checking;
|
||||
|
@ -1142,8 +1145,9 @@ void ProxiesBoxController::setupChecker(int id, const Checker &checker) {
|
|||
pointer->connect(pointer, &Connection::error, failed);
|
||||
}
|
||||
|
||||
object_ptr<Ui::BoxContent> ProxiesBoxController::CreateOwningBox() {
|
||||
auto controller = std::make_unique<ProxiesBoxController>();
|
||||
object_ptr<Ui::BoxContent> ProxiesBoxController::CreateOwningBox(
|
||||
not_null<Main::Account*> account) {
|
||||
auto controller = std::make_unique<ProxiesBoxController>(account);
|
||||
auto box = controller->create();
|
||||
Ui::AttachAsChild(box, std::move(controller));
|
||||
return box;
|
||||
|
|
|
@ -24,18 +24,23 @@ template <typename Enum>
|
|||
class Radioenum;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Main {
|
||||
class Account;
|
||||
} // namespace Main
|
||||
|
||||
class ProxiesBoxController : public base::Subscriber {
|
||||
public:
|
||||
using ProxyData = MTP::ProxyData;
|
||||
using Type = ProxyData::Type;
|
||||
|
||||
ProxiesBoxController();
|
||||
explicit ProxiesBoxController(not_null<Main::Account*> account);
|
||||
|
||||
static void ShowApplyConfirmation(
|
||||
Type type,
|
||||
const QMap<QString, QString> &fields);
|
||||
|
||||
static object_ptr<Ui::BoxContent> CreateOwningBox();
|
||||
static object_ptr<Ui::BoxContent> CreateOwningBox(
|
||||
not_null<Main::Account*> account);
|
||||
object_ptr<Ui::BoxContent> create();
|
||||
|
||||
enum class ItemState {
|
||||
|
@ -104,6 +109,7 @@ private:
|
|||
const ProxyData &proxy);
|
||||
void addNewItem(const ProxyData &proxy);
|
||||
|
||||
const not_null<Main::Account*> _account;
|
||||
int _idCounter = 0;
|
||||
std::vector<Item> _list;
|
||||
rpl::event_stream<ItemView> _views;
|
||||
|
|
|
@ -516,7 +516,7 @@ void EmojiKeywords::langPackRefreshed() {
|
|||
}
|
||||
|
||||
void EmojiKeywords::handleSessionChanges() {
|
||||
Core::App().activeAccount().sessionValue(
|
||||
Core::App().activeAccount().sessionValue( // #TODO multi someSessionValue
|
||||
) | rpl::map([](Main::Session *session) {
|
||||
return session ? &session->api() : nullptr;
|
||||
}) | rpl::start_with_next([=](ApiWrap *api) {
|
||||
|
|
|
@ -113,13 +113,13 @@ Application::Application(not_null<Launcher*> launcher)
|
|||
_shouldLockAt = 0;
|
||||
}, _lifetime);
|
||||
|
||||
activeAccount().sessionChanges(
|
||||
activeAccount().sessionChanges( // #TODO multi activeSessionValue
|
||||
) | rpl::start_with_next([=](Main::Session *session) {
|
||||
if (_mediaView) {
|
||||
hideMediaView();
|
||||
_mediaView->clearData();
|
||||
}
|
||||
if (session && !UpdaterDisabled()) {
|
||||
if (session && !UpdaterDisabled()) { // #TODO multi someSessionValue
|
||||
UpdateChecker().setMtproto(session);
|
||||
}
|
||||
}, _lifetime);
|
||||
|
@ -578,7 +578,7 @@ bool Application::unreadBadgeMuted() const {
|
|||
: false;
|
||||
}
|
||||
|
||||
bool Application::offerLangPackSwitch() const {
|
||||
bool Application::offerLegacyLangPackSwitch() const {
|
||||
// #TODO multi we offer only if we were upgraded from an old authed app.
|
||||
return activeAccount().sessionExists();
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ public:
|
|||
[[nodiscard]] Lang::CloudManager *langCloudManager() {
|
||||
return _langCloudManager.get();
|
||||
}
|
||||
[[nodiscard]] bool offerLangPackSwitch() const;
|
||||
[[nodiscard]] bool offerLegacyLangPackSwitch() const;
|
||||
[[nodiscard]] bool canApplyLangPackWithoutRestart() const;
|
||||
[[nodiscard]] ChatHelpers::EmojiKeywords &emojiKeywords() {
|
||||
return *_emojiKeywords;
|
||||
|
|
|
@ -1590,7 +1590,7 @@ void UpdateApplication() {
|
|||
Window::SectionShow());
|
||||
} else {
|
||||
window->showSpecialLayer(
|
||||
Box<::Settings::LayerWidget>(),
|
||||
Box<::Settings::LayerWidget>(&window->controller()),
|
||||
anim::type::normal);
|
||||
}
|
||||
window->showFromTray();
|
||||
|
|
|
@ -381,6 +381,7 @@ void Widget::updateScrollUpPosition() {
|
|||
void Widget::setupConnectingWidget() {
|
||||
_connecting = std::make_unique<Window::ConnectionState>(
|
||||
this,
|
||||
&session().account(),
|
||||
Window::AdaptiveIsOneColumn());
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "info/info_section_widget.h"
|
||||
|
||||
#include "window/window_connecting_widget.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "main/main_session.h"
|
||||
#include "info/info_content_widget.h"
|
||||
#include "info/info_wrap_widget.h"
|
||||
#include "info/info_layer_widget.h"
|
||||
|
@ -48,6 +50,7 @@ void SectionWidget::init() {
|
|||
|
||||
_connecting = std::make_unique<Window::ConnectionState>(
|
||||
_content.data(),
|
||||
&controller()->session().account(),
|
||||
Window::AdaptiveIsOneColumn());
|
||||
|
||||
_content->contentChanged(
|
||||
|
|
|
@ -56,6 +56,7 @@ Widget::Widget(QWidget *parent, not_null<Main::Account*> account)
|
|||
object_ptr<Ui::RoundButton>(this, nullptr, st::introNextButton))
|
||||
, _connecting(std::make_unique<Window::ConnectionState>(
|
||||
this,
|
||||
account,
|
||||
rpl::single(true))) {
|
||||
appendStep(new StartWidget(this, _account, getData()));
|
||||
fixOrder();
|
||||
|
|
|
@ -158,7 +158,7 @@ Language ParseLanguage(const MTPLangPackLanguage &data) {
|
|||
|
||||
CloudManager::CloudManager(Instance &langpack)
|
||||
: _langpack(langpack) {
|
||||
Core::App().activeAccount().mtpValue(
|
||||
Core::App().activeAccount().mtpValue( // #TODO multi activeAccountValue
|
||||
) | rpl::start_with_next([=](MTP::Instance *instance) {
|
||||
if (instance) {
|
||||
_api.emplace(instance);
|
||||
|
|
|
@ -182,19 +182,17 @@ rpl::producer<> Account::mtpNewSessionCreated() const {
|
|||
return _mtpNewSessionCreated.events();
|
||||
}
|
||||
|
||||
void Account::setMtpMainDcId(MTP::DcId mainDcId) {
|
||||
void Account::setLegacyMtpMainDcId(MTP::DcId mainDcId) {
|
||||
Expects(!_mtp);
|
||||
|
||||
_mtpConfig.mainDcId = mainDcId;
|
||||
}
|
||||
|
||||
void Account::setMtpKey(MTP::DcId dcId, const MTP::AuthKey::Data &keyData) {
|
||||
void Account::setLegacyMtpKey(std::shared_ptr<MTP::AuthKey> key) {
|
||||
Expects(!_mtp);
|
||||
Expects(key != nullptr);
|
||||
|
||||
_mtpConfig.keys.push_back(std::make_shared<MTP::AuthKey>(
|
||||
MTP::AuthKey::Type::ReadFromFile,
|
||||
dcId,
|
||||
keyData));
|
||||
_mtpConfig.keys.push_back(std::move(key));
|
||||
}
|
||||
|
||||
QByteArray Account::serializeMtpAuthorization() const {
|
||||
|
|
|
@ -59,8 +59,8 @@ public:
|
|||
[[nodiscard]] rpl::producer<MTP::Instance*> mtpChanges() const;
|
||||
|
||||
// Set from legacy storage.
|
||||
void setMtpMainDcId(MTP::DcId mainDcId);
|
||||
void setMtpKey(MTP::DcId dcId, const MTP::AuthKey::Data &keyData);
|
||||
void setLegacyMtpMainDcId(MTP::DcId mainDcId);
|
||||
void setLegacyMtpKey(std::shared_ptr<MTP::AuthKey> key);
|
||||
void setSessionUserId(UserId userId);
|
||||
void setSessionFromStorage(
|
||||
std::unique_ptr<Settings> data,
|
||||
|
|
|
@ -529,6 +529,7 @@ void MainWidget::setupConnectingWidget() {
|
|||
using namespace rpl::mappers;
|
||||
_connecting = std::make_unique<Window::ConnectionState>(
|
||||
this,
|
||||
&session().account(),
|
||||
Window::AdaptiveIsOneColumn() | rpl::map(!_1));
|
||||
}
|
||||
|
||||
|
|
|
@ -305,10 +305,12 @@ void MainWindow::showSettings() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (const auto controller = sessionController()) {
|
||||
controller->showSettings();
|
||||
if (const auto session = sessionController()) {
|
||||
session->showSettings();
|
||||
} else {
|
||||
showSpecialLayer(Box<Settings::LayerWidget>(), anim::type::normal);
|
||||
showSpecialLayer(
|
||||
Box<Settings::LayerWidget>(&controller()),
|
||||
anim::type::normal);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ Instance::Instance()
|
|||
});
|
||||
|
||||
// While we have one Media::Player::Instance for all sessions we have to do this.
|
||||
Core::App().activeAccount().sessionValue(
|
||||
Core::App().activeAccount().sessionValue( // #TODO multi activeSessionValue
|
||||
) | rpl::start_with_next([=](Main::Session *session) {
|
||||
if (session) {
|
||||
subscribe(session->calls().currentCallChanged(), [=](Calls::Call *call) {
|
||||
|
|
|
@ -304,6 +304,7 @@ OverlayWidget::OverlayWidget()
|
|||
? Global::VideoVolume()
|
||||
: Global::kDefaultVolume;
|
||||
|
||||
// #TODO multi activeSessionValue change icon on show?
|
||||
setWindowIcon(Window::CreateIcon(&Core::App().activeAccount()));
|
||||
setWindowTitle(qsl("Media viewer"));
|
||||
|
||||
|
@ -320,7 +321,7 @@ OverlayWidget::OverlayWidget()
|
|||
connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(onScreenResized(int)));
|
||||
|
||||
// While we have one mediaview for all sessions we have to do this.
|
||||
Core::App().activeAccount().sessionValue(
|
||||
Core::App().activeAccount().sessionValue( // #TODO multi activeSessionValue
|
||||
) | rpl::start_with_next([=](Main::Session *session) {
|
||||
if (session) {
|
||||
subscribe(session->downloaderTaskFinished(), [=] {
|
||||
|
|
|
@ -39,7 +39,7 @@ void unpause() {
|
|||
} // namespace details
|
||||
|
||||
Instance *MainInstance() {
|
||||
return Core::IsAppLaunched()
|
||||
return Core::IsAppLaunched() // #TODO multi
|
||||
? Core::App().activeAccount().mtp()
|
||||
: nullptr;
|
||||
}
|
||||
|
|
|
@ -854,7 +854,7 @@ void Instance::Private::configLoadDone(const MTPConfig &result) {
|
|||
data.vlang_pack_version().value_or_empty(),
|
||||
data.vbase_lang_pack_version().value_or_empty());
|
||||
|
||||
Core::App().activeAccount().configUpdated();
|
||||
Core::App().activeAccount().configUpdated(); // #TODO multi
|
||||
|
||||
if (const auto prefix = data.vautoupdate_url_prefix()) {
|
||||
Local::writeAutoupdatePrefix(qs(*prefix));
|
||||
|
|
|
@ -48,7 +48,9 @@ bool HasConnectionType() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void SetupConnectionType(not_null<Ui::VerticalLayout*> container) {
|
||||
void SetupConnectionType(
|
||||
not_null<Main::Account*> account,
|
||||
not_null<Ui::VerticalLayout*> container) {
|
||||
if (!HasConnectionType()) {
|
||||
return;
|
||||
}
|
||||
|
@ -74,8 +76,8 @@ void SetupConnectionType(not_null<Ui::VerticalLayout*> container) {
|
|||
Global::RefConnectionTypeChanged()
|
||||
)) | rpl::map(connectionType),
|
||||
st::settingsButton);
|
||||
button->addClickHandler([] {
|
||||
Ui::show(ProxiesBoxController::CreateOwningBox());
|
||||
button->addClickHandler([=] {
|
||||
Ui::show(ProxiesBoxController::CreateOwningBox(account));
|
||||
});
|
||||
#endif // TDESKTOP_DISABLE_NETWORK_PROXY
|
||||
}
|
||||
|
@ -563,7 +565,7 @@ void Advanced::setupContent(not_null<Window::SessionController*> controller) {
|
|||
addDivider();
|
||||
AddSkip(content);
|
||||
AddSubsectionTitle(content, tr::lng_settings_network_proxy());
|
||||
SetupConnectionType(content);
|
||||
SetupConnectionType(&controller->session().account(), content);
|
||||
AddSkip(content);
|
||||
}
|
||||
SetupDataStorage(controller, content);
|
||||
|
|
|
@ -9,10 +9,16 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "settings/settings_common.h"
|
||||
|
||||
namespace Main {
|
||||
class Account;
|
||||
} // namespace Main
|
||||
|
||||
namespace Settings {
|
||||
|
||||
bool HasConnectionType();
|
||||
void SetupConnectionType(not_null<Ui::VerticalLayout*> container);
|
||||
void SetupConnectionType(
|
||||
not_null<Main::Account*> account,
|
||||
not_null<Ui::VerticalLayout*> container);
|
||||
bool HasUpdate();
|
||||
void SetupUpdate(not_null<Ui::VerticalLayout*> container);
|
||||
bool HasTray();
|
||||
|
|
|
@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/scroll_area.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_settings.h"
|
||||
#include "styles/style_layers.h"
|
||||
|
@ -56,14 +57,16 @@ private:
|
|||
|
||||
};
|
||||
|
||||
object_ptr<Ui::RpWidget> CreateIntroSettings(QWidget *parent) {
|
||||
object_ptr<Ui::RpWidget> CreateIntroSettings(
|
||||
QWidget *parent,
|
||||
not_null<Window::Controller*> window) {
|
||||
auto result = object_ptr<Ui::VerticalLayout>(parent);
|
||||
|
||||
AddDivider(result);
|
||||
AddSkip(result);
|
||||
SetupLanguageButton(result, false);
|
||||
if (HasConnectionType()) {
|
||||
SetupConnectionType(result);
|
||||
SetupConnectionType(&window->account(), result);
|
||||
}
|
||||
AddSkip(result);
|
||||
if (HasUpdate()) {
|
||||
|
@ -162,7 +165,9 @@ void TopBar::paintEvent(QPaintEvent *e) {
|
|||
|
||||
class IntroWidget : public Ui::RpWidget {
|
||||
public:
|
||||
IntroWidget(QWidget *parent);
|
||||
IntroWidget(
|
||||
QWidget *parent,
|
||||
not_null<Window::Controller*> window);
|
||||
|
||||
void forceContentRepaint();
|
||||
|
||||
|
@ -184,7 +189,7 @@ private:
|
|||
void updateControlsGeometry();
|
||||
QRect contentGeometry() const;
|
||||
void setInnerWidget(object_ptr<Ui::RpWidget> content);
|
||||
void showContent();
|
||||
void showContent(not_null<Window::Controller*> window);
|
||||
rpl::producer<bool> topShadowToggledValue() const;
|
||||
void createTopBar();
|
||||
void applyAdditionalScroll(int additionalScroll);
|
||||
|
@ -203,7 +208,9 @@ private:
|
|||
|
||||
};
|
||||
|
||||
IntroWidget::IntroWidget(QWidget *parent)
|
||||
IntroWidget::IntroWidget(
|
||||
QWidget *parent,
|
||||
not_null<Window::Controller*> window)
|
||||
: RpWidget(parent)
|
||||
, _wrap(this)
|
||||
, _scroll(Ui::CreateChild<Ui::ScrollArea>(_wrap.data(), st::infoScroll))
|
||||
|
@ -221,7 +228,7 @@ IntroWidget::IntroWidget(QWidget *parent)
|
|||
}, lifetime());
|
||||
|
||||
createTopBar();
|
||||
showContent();
|
||||
showContent(window);
|
||||
_topShadow->toggleOn(
|
||||
topShadowToggledValue(
|
||||
) | rpl::filter([](bool shown) {
|
||||
|
@ -316,8 +323,8 @@ rpl::producer<bool> IntroWidget::topShadowToggledValue() const {
|
|||
) | rpl::map((_1 > 0) || (_2 > 0));
|
||||
}
|
||||
|
||||
void IntroWidget::showContent() {
|
||||
setInnerWidget(CreateIntroSettings(_scroll));
|
||||
void IntroWidget::showContent(not_null<Window::Controller*> window) {
|
||||
setInnerWidget(CreateIntroSettings(_scroll, window));
|
||||
|
||||
_additionalScroll = 0;
|
||||
updateControlsGeometry();
|
||||
|
@ -393,8 +400,8 @@ rpl::producer<int> IntroWidget::scrollTillBottomChanges() const {
|
|||
|
||||
IntroWidget::~IntroWidget() = default;
|
||||
|
||||
LayerWidget::LayerWidget(QWidget*)
|
||||
: _content(this) {
|
||||
LayerWidget::LayerWidget(QWidget*, not_null<Window::Controller*> window)
|
||||
: _content(this, window) {
|
||||
setupHeightConsumers();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,13 +17,17 @@ template <typename Widget>
|
|||
class FadeWrap;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Window {
|
||||
class Controller;
|
||||
} // namespace Window
|
||||
|
||||
namespace Settings {
|
||||
|
||||
class IntroWidget;
|
||||
|
||||
class LayerWidget : public Ui::LayerWidget {
|
||||
public:
|
||||
LayerWidget(QWidget*);
|
||||
LayerWidget(QWidget*, not_null<Window::Controller*> window);
|
||||
|
||||
void showFinished() override;
|
||||
void parentResized() override;
|
||||
|
|
|
@ -10,7 +10,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/details/storage_file_utilities.h"
|
||||
#include "storage/cache/storage_cache_database.h"
|
||||
#include "core/application.h"
|
||||
#include "main/main_account.h"
|
||||
#include "storage/serialize_common.h"
|
||||
#include "ui/effects/animation_value.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
|
@ -134,8 +133,8 @@ bool ReadSetting(
|
|||
if (!CheckStreamStatus(stream)) return false;
|
||||
|
||||
DEBUG_LOG(("MTP Info: user found, dc %1, uid %2").arg(dcId).arg(userId));
|
||||
Core::App().activeAccount().setMtpMainDcId(dcId);
|
||||
Core::App().activeAccount().setSessionUserId(userId);
|
||||
context.mtpLegacyMainDcId = dcId;
|
||||
context.mtpLegacyUserId = userId;
|
||||
} break;
|
||||
|
||||
case dbiKey: {
|
||||
|
@ -144,7 +143,10 @@ bool ReadSetting(
|
|||
auto key = Serialize::read<MTP::AuthKey::Data>(stream);
|
||||
if (!CheckStreamStatus(stream)) return false;
|
||||
|
||||
Core::App().activeAccount().setMtpKey(dcId, key);
|
||||
context.mtpLegacyKeys.push_back(std::make_shared<MTP::AuthKey>(
|
||||
MTP::AuthKey::Type::ReadFromFile,
|
||||
dcId,
|
||||
key));
|
||||
} break;
|
||||
|
||||
case dbiMtpAuthorization: {
|
||||
|
@ -152,7 +154,7 @@ bool ReadSetting(
|
|||
stream >> serialized;
|
||||
if (!CheckStreamStatus(stream)) return false;
|
||||
|
||||
Core::App().activeAccount().setMtpAuthorization(serialized);
|
||||
context.mtpAuthorization = serialized;
|
||||
} break;
|
||||
|
||||
case dbiAutoStart: {
|
||||
|
|
|
@ -11,6 +11,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "main/main_settings.h"
|
||||
#include "storage/storage_account.h"
|
||||
|
||||
namespace MTP {
|
||||
class AuthKey;
|
||||
} // namespace MTP
|
||||
|
||||
namespace Storage {
|
||||
namespace details {
|
||||
|
||||
|
@ -42,6 +46,11 @@ struct ReadSettingsContext {
|
|||
FileKey languagesKey = 0;
|
||||
|
||||
QByteArray callSettings;
|
||||
|
||||
QByteArray mtpAuthorization;
|
||||
std::vector<std::shared_ptr<MTP::AuthKey>> mtpLegacyKeys;
|
||||
qint32 mtpLegacyMainDcId = 0;
|
||||
qint32 mtpLegacyUserId = 0;
|
||||
};
|
||||
|
||||
[[nodiscard]] bool ReadSetting(
|
||||
|
|
|
@ -906,7 +906,20 @@ std::unique_ptr<Main::Settings> Account::applyReadContext(
|
|||
_cacheBigFileTotalSizeLimit = context.cacheBigFileTotalSizeLimit;
|
||||
_cacheBigFileTotalTimeLimit = context.cacheBigFileTotalTimeLimit;
|
||||
|
||||
deserializeCallSettings(context.callSettings);
|
||||
if (!context.callSettings.isEmpty()) {
|
||||
deserializeCallSettings(context.callSettings);
|
||||
}
|
||||
if (!context.mtpAuthorization.isEmpty()) {
|
||||
_owner->setMtpAuthorization(context.mtpAuthorization);
|
||||
} else {
|
||||
for (auto &key : context.mtpLegacyKeys) {
|
||||
_owner->setLegacyMtpKey(std::move(key));
|
||||
}
|
||||
if (context.mtpLegacyMainDcId) {
|
||||
_owner->setLegacyMtpMainDcId(context.mtpLegacyMainDcId);
|
||||
_owner->setSessionUserId(context.mtpLegacyUserId);
|
||||
}
|
||||
}
|
||||
|
||||
return std::move(context.sessionSettingsStorage);
|
||||
}
|
||||
|
@ -918,7 +931,7 @@ void Account::writeMtpData() {
|
|||
return;
|
||||
}
|
||||
|
||||
auto mtpAuthorizationSerialized = Core::App().activeAccount().serializeMtpAuthorization();
|
||||
auto mtpAuthorizationSerialized = _owner->serializeMtpAuthorization();
|
||||
|
||||
quint32 size = sizeof(quint32) + Serialize::bytearraySize(mtpAuthorizationSerialized);
|
||||
|
||||
|
|
|
@ -547,7 +547,7 @@ void ChatBackground::start() {
|
|||
set(Data::ThemeWallPaper());
|
||||
}
|
||||
|
||||
Core::App().activeAccount().sessionValue(
|
||||
Core::App().activeAccount().sessionValue( // #TODO multi activeSessionValue
|
||||
) | rpl::filter([=](Main::Session *session) {
|
||||
return session != _session;
|
||||
}) | rpl::start_with_next([=](Main::Session *session) {
|
||||
|
|
|
@ -74,7 +74,10 @@ void Progress::animationStep() {
|
|||
|
||||
class ConnectionState::Widget : public Ui::AbstractButton {
|
||||
public:
|
||||
Widget(QWidget *parent, const Layout &layout);
|
||||
Widget(
|
||||
QWidget *parent,
|
||||
not_null<Main::Account*> account,
|
||||
const Layout &layout);
|
||||
|
||||
void refreshRetryLink(bool hasRetry);
|
||||
void setLayout(const Layout &layout);
|
||||
|
@ -201,8 +204,10 @@ bool ConnectionState::State::operator==(const State &other) const {
|
|||
|
||||
ConnectionState::ConnectionState(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<Main::Account*> account,
|
||||
rpl::producer<bool> shown)
|
||||
: _parent(parent)
|
||||
: _account(account)
|
||||
, _parent(parent)
|
||||
, _refreshTimer([=] { refreshState(); })
|
||||
, _currentLayout(computeLayout(_state)) {
|
||||
rpl::combine(
|
||||
|
@ -232,7 +237,7 @@ ConnectionState::ConnectionState(
|
|||
}
|
||||
|
||||
void ConnectionState::createWidget() {
|
||||
_widget = base::make_unique_q<Widget>(_parent, _currentLayout);
|
||||
_widget = base::make_unique_q<Widget>(_parent, _account, _currentLayout);
|
||||
_widget->setVisible(!_forceHidden);
|
||||
|
||||
updateWidth();
|
||||
|
@ -469,14 +474,17 @@ void ConnectionState::updateWidth() {
|
|||
refreshProgressVisibility();
|
||||
}
|
||||
|
||||
ConnectionState::Widget::Widget(QWidget *parent, const Layout &layout)
|
||||
ConnectionState::Widget::Widget(
|
||||
QWidget *parent,
|
||||
not_null<Main::Account*> account,
|
||||
const Layout &layout)
|
||||
: AbstractButton(parent)
|
||||
, _currentLayout(layout) {
|
||||
_proxyIcon = Ui::CreateChild<ProxyIcon>(this);
|
||||
_progress = Ui::CreateChild<Progress>(this);
|
||||
|
||||
addClickHandler([=] {
|
||||
Ui::show(ProxiesBoxController::CreateOwningBox());
|
||||
Ui::show(ProxiesBoxController::CreateOwningBox(account));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,17 @@ namespace Ui {
|
|||
class RpWidget;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Main {
|
||||
class Account;
|
||||
} // namespace Main
|
||||
|
||||
namespace Window {
|
||||
|
||||
class ConnectionState : private base::Subscriber {
|
||||
public:
|
||||
ConnectionState(
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<Main::Account*> account,
|
||||
rpl::producer<bool> shown);
|
||||
|
||||
void raise();
|
||||
|
@ -71,6 +76,7 @@ private:
|
|||
void updateVisibility();
|
||||
void refreshProgressVisibility();
|
||||
|
||||
const not_null<Main::Account*> _account;
|
||||
not_null<Ui::RpWidget*> _parent;
|
||||
base::unique_qptr<Widget> _widget;
|
||||
bool _forceHidden = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue