mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Decouple MTP::Instance from Core::App.
This commit is contained in:
@@ -440,10 +440,13 @@ void Application::setMtpAuthorization(const QByteArray &serialized) {
|
||||
void Application::startMtp() {
|
||||
Expects(!_mtproto);
|
||||
|
||||
auto config = base::take(_private->mtpConfig);
|
||||
config.deviceModel = _launcher->deviceModel();
|
||||
config.systemVersion = _launcher->systemVersion();
|
||||
_mtproto = std::make_unique<MTP::Instance>(
|
||||
_dcOptions.get(),
|
||||
MTP::Instance::Mode::Normal,
|
||||
base::take(_private->mtpConfig));
|
||||
std::move(config));
|
||||
_mtproto->setUserPhone(cLoggedPhoneNumber());
|
||||
_private->mtpConfig.mainDcId = _mtproto->mainDcId();
|
||||
|
||||
@@ -526,7 +529,12 @@ void Application::destroyMtpKeys(MTP::AuthKeysList &&keys) {
|
||||
auto destroyConfig = MTP::Instance::Config();
|
||||
destroyConfig.mainDcId = MTP::Instance::Config::kNoneMainDc;
|
||||
destroyConfig.keys = std::move(keys);
|
||||
_mtprotoForKeysDestroy = std::make_unique<MTP::Instance>(_dcOptions.get(), MTP::Instance::Mode::KeysDestroyer, std::move(destroyConfig));
|
||||
destroyConfig.deviceModel = _launcher->deviceModel();
|
||||
destroyConfig.systemVersion = _launcher->systemVersion();
|
||||
_mtprotoForKeysDestroy = std::make_unique<MTP::Instance>(
|
||||
_dcOptions.get(),
|
||||
MTP::Instance::Mode::KeysDestroyer,
|
||||
std::move(destroyConfig));
|
||||
connect(
|
||||
_mtprotoForKeysDestroy.get(),
|
||||
&MTP::Instance::allKeysDestroyed,
|
||||
|
Reference in New Issue
Block a user