mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-02 23:55:12 +00:00
Better special config implementation.
This commit is contained in:
@@ -390,7 +390,11 @@ void Messenger::setMtpAuthorization(const QByteArray &serialized) {
|
||||
void Messenger::startMtp() {
|
||||
Expects(!_mtproto);
|
||||
|
||||
_mtproto = std::make_unique<MTP::Instance>(_dcOptions.get(), MTP::Instance::Mode::Normal, base::take(_private->mtpConfig));
|
||||
_mtproto = std::make_unique<MTP::Instance>(
|
||||
_dcOptions.get(),
|
||||
MTP::Instance::Mode::Normal,
|
||||
base::take(_private->mtpConfig));
|
||||
_mtproto->setUserPhone(cLoggedPhoneNumber());
|
||||
_private->mtpConfig.mainDcId = _mtproto->mainDcId();
|
||||
|
||||
_mtproto->setStateChangedHandler([](MTP::ShiftedDcId shiftedDcId, int32 state) {
|
||||
@@ -489,6 +493,20 @@ void Messenger::startLocalStorage() {
|
||||
}
|
||||
});
|
||||
});
|
||||
subscribe(Global::RefSelfChanged(), [=] {
|
||||
InvokeQueued(this, [=] {
|
||||
const auto phone = App::self()
|
||||
? App::self()->phone()
|
||||
: QString();
|
||||
if (cLoggedPhoneNumber() != phone) {
|
||||
cSetLoggedPhoneNumber(phone);
|
||||
if (_mtproto) {
|
||||
_mtproto->setUserPhone(phone);
|
||||
}
|
||||
Local::writeSettings();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void Messenger::regPhotoUpdate(const PeerId &peer, const FullMsgId &msgId) {
|
||||
|
Reference in New Issue
Block a user