mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Move MTP::Instance to Main::Account.
This commit is contained in:
@@ -120,34 +120,16 @@ public:
|
||||
MTP::DcOptions *dcOptions() {
|
||||
return _dcOptions.get();
|
||||
}
|
||||
struct ProxyChange {
|
||||
ProxyData was;
|
||||
ProxyData now;
|
||||
};
|
||||
void setCurrentProxy(
|
||||
const ProxyData &proxy,
|
||||
ProxyData::Settings settings);
|
||||
[[nodiscard]] rpl::producer<ProxyChange> proxyChanges() const;
|
||||
void badMtprotoConfigurationError();
|
||||
|
||||
// Set from legacy storage.
|
||||
void setMtpMainDcId(MTP::DcId mainDcId);
|
||||
void setMtpKey(MTP::DcId dcId, const MTP::AuthKey::Data &keyData);
|
||||
void setAuthSessionUserId(UserId userId);
|
||||
void setAuthSessionFromStorage(
|
||||
std::unique_ptr<AuthSessionSettings> data,
|
||||
QByteArray &&selfSerialized,
|
||||
int32 selfStreamVersion);
|
||||
AuthSessionSettings *getAuthSessionSettings();
|
||||
|
||||
// Serialization.
|
||||
QByteArray serializeMtpAuthorization() const;
|
||||
void setMtpAuthorization(const QByteArray &serialized);
|
||||
|
||||
void startMtp();
|
||||
MTP::Instance *mtp() {
|
||||
return _mtproto.get();
|
||||
}
|
||||
void suggestMainDcId(MTP::DcId mainDcId);
|
||||
void destroyStaleAuthorizationKeys();
|
||||
void configUpdated();
|
||||
[[nodiscard]] rpl::producer<> configUpdates() const;
|
||||
|
||||
// Databases.
|
||||
Storage::Databases &databases() {
|
||||
return *_databases;
|
||||
@@ -159,10 +141,8 @@ public:
|
||||
}
|
||||
|
||||
// AuthSession component.
|
||||
void authSessionCreate(const MTPUser &user);
|
||||
int unreadBadge() const;
|
||||
bool unreadBadgeMuted() const;
|
||||
void logOut();
|
||||
|
||||
// Media component.
|
||||
Media::Audio::Instance &audio() {
|
||||
@@ -244,9 +224,6 @@ private:
|
||||
friend bool IsAppLaunched();
|
||||
friend Application &App();
|
||||
|
||||
void destroyMtpKeys(MTP::AuthKeysList &&keys);
|
||||
void allKeysDestroyed();
|
||||
|
||||
void startLocalStorage();
|
||||
void startShortcuts();
|
||||
|
||||
@@ -256,14 +233,20 @@ private:
|
||||
static void QuitAttempt();
|
||||
void quitDelayed();
|
||||
|
||||
void resetAuthorizationKeys();
|
||||
void authSessionDestroy();
|
||||
void clearPasscodeLock();
|
||||
void loggedOut();
|
||||
|
||||
static Application *Instance;
|
||||
struct InstanceSetter {
|
||||
InstanceSetter(not_null<Application*> instance) {
|
||||
Expects(Instance == nullptr);
|
||||
|
||||
Instance = instance;
|
||||
}
|
||||
};
|
||||
InstanceSetter _setter = { this };
|
||||
|
||||
not_null<Launcher*> _launcher;
|
||||
rpl::event_stream<ProxyChange> _proxyChanges;
|
||||
|
||||
// Some fields are just moved from the declaration.
|
||||
struct Private;
|
||||
@@ -273,6 +256,7 @@ private:
|
||||
|
||||
const std::unique_ptr<Storage::Databases> _databases;
|
||||
const std::unique_ptr<Ui::Animations::Manager> _animationsManager;
|
||||
const std::unique_ptr<MTP::DcOptions> _dcOptions;
|
||||
const std::unique_ptr<Main::Account> _account;
|
||||
std::unique_ptr<Window::Controller> _window;
|
||||
std::unique_ptr<Media::View::OverlayWidget> _mediaView;
|
||||
@@ -280,10 +264,6 @@ private:
|
||||
std::unique_ptr<Lang::CloudManager> _langCloudManager;
|
||||
const std::unique_ptr<ChatHelpers::EmojiKeywords> _emojiKeywords;
|
||||
std::unique_ptr<Lang::Translator> _translator;
|
||||
std::unique_ptr<MTP::DcOptions> _dcOptions;
|
||||
std::unique_ptr<MTP::Instance> _mtproto;
|
||||
std::unique_ptr<MTP::Instance> _mtprotoForKeysDestroy;
|
||||
rpl::event_stream<> _configUpdates;
|
||||
base::Observable<void> _passcodedChanged;
|
||||
QPointer<BoxContent> _badProxyDisableBox;
|
||||
|
||||
|
Reference in New Issue
Block a user