2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Version 1.8.12: Apply user settings in Session().

Fixes #6617.
This commit is contained in:
John Preston
2019-10-02 13:46:02 +03:00
parent ecfe1dacb2
commit af818b40aa
6 changed files with 78 additions and 53 deletions

View File

@@ -37,8 +37,10 @@ constexpr auto kLegacyCallsPeerToPeerNobody = 4;
Session::Session(
not_null<Main::Account*> account,
const MTPUser &user)
const MTPUser &user,
Settings &&settings)
: _account(account)
, _settings(std::move(settings))
, _saveSettingsTimer([=] { Local::writeUserSettings(); })
, _autoLockTimer([=] { checkAutoLock(); })
, _api(std::make_unique<ApiWrap>(this))
@@ -84,6 +86,15 @@ Session::Session(
Local::writeSelf();
}
}));
if (_settings.hadLegacyCallsPeerToPeerNobody()) {
api().savePrivacy(
MTP_inputPrivacyKeyPhoneP2P(),
QVector<MTPInputPrivacyRule>(
1,
MTP_inputPrivacyValueDisallowAll()));
saveSettingsDelayed();
}
});
Window::Theme::Background()->start();
@@ -127,18 +138,6 @@ bool Session::validateSelf(const MTPUser &user) {
return true;
}
void Session::moveSettingsFrom(Settings &&other) {
_settings.moveFrom(std::move(other));
if (_settings.hadLegacyCallsPeerToPeerNobody()) {
api().savePrivacy(
MTP_inputPrivacyKeyPhoneP2P(),
QVector<MTPInputPrivacyRule>(
1,
MTP_inputPrivacyValueDisallowAll()));
saveSettingsDelayed();
}
}
void Session::saveSettingsDelayed(crl::time delay) {
Expects(this == &Auth());