Fix setting "is_location_visible" option before authorization.

This commit is contained in:
levlam 2022-08-18 19:38:30 +03:00
parent 29b35f3698
commit 266e5d4b16
2 changed files with 11 additions and 1 deletions

View File

@ -107,6 +107,11 @@ OptionManager::~OptionManager() = default;
void OptionManager::on_td_inited() {
is_td_inited_ = true;
if (have_pending_is_location_visible_) {
have_pending_is_location_visible_ = false;
td_->contacts_manager_->set_location_visibility();
}
}
void OptionManager::set_option_boolean(Slice name, bool value) {
@ -679,7 +684,11 @@ void OptionManager::set_option(const string &name, td_api::object_ptr<td_api::Op
return;
}
if (!is_bot && set_boolean_option("is_location_visible")) {
if (is_td_inited_) {
td_->contacts_manager_->set_location_visibility();
} else {
have_pending_is_location_visible_ = true;
}
return;
}
break;

View File

@ -83,6 +83,7 @@ class OptionManager {
Td *td_;
bool is_td_inited_ = false;
bool have_pending_is_location_visible_ = false;
unique_ptr<TsSeqKeyValue> options_;
std::shared_ptr<KeyValueSyncInterface> option_pmc_;