Remove remained TON integration methods.

GitOrigin-RevId: 5d2045602cc31fb24225b604b11dacee88a1b65e
This commit is contained in:
levlam 2020-06-08 02:12:57 +03:00
parent 71ec8cc655
commit 6ed1a04cf1
7 changed files with 5 additions and 118 deletions

View File

@ -1287,8 +1287,6 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
LOG(INFO) << "Receive app config " << to_string(config);
vector<tl_object_ptr<telegram_api::jsonObjectValue>> new_values;
string wallet_blockchain_name;
string wallet_config;
string ignored_restriction_reasons;
vector<string> dice_emojis;
std::unordered_map<string, size_t> dice_emoji_index;
@ -1299,23 +1297,7 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
for (auto &key_value : static_cast<telegram_api::jsonObject *>(config.get())->value_) {
Slice key = key_value->key_;
telegram_api::JSONValue *value = key_value->value_.get();
if (key == "test" || key == "wallet_enabled") {
continue;
}
if (key == "wallet_blockchain_name") {
if (value->get_id() == telegram_api::jsonString::ID) {
wallet_blockchain_name = std::move(static_cast<telegram_api::jsonString *>(value)->value_);
} else {
LOG(ERROR) << "Receive unexpected wallet_blockchain_name " << to_string(*value);
}
continue;
}
if (key == "wallet_config") {
if (value->get_id() == telegram_api::jsonString::ID) {
wallet_config = std::move(static_cast<telegram_api::jsonString *>(value)->value_);
} else {
LOG(ERROR) << "Receive unexpected wallet_config " << to_string(*value);
}
if (key == "test" || key == "wallet_enabled" || key == "wallet_blockchain_name" || key == "wallet_config") {
continue;
}
if (key == "ignore_restriction_reasons") {
@ -1441,13 +1423,6 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
config = make_tl_object<telegram_api::jsonObject>(std::move(new_values));
ConfigShared &shared_config = G()->shared_config();
if (wallet_config.empty()) {
shared_config.set_option_empty("default_ton_blockchain_config");
shared_config.set_option_empty("default_ton_blockchain_name");
} else {
shared_config.set_option_string("default_ton_blockchain_name", wallet_blockchain_name);
shared_config.set_option_string("default_ton_blockchain_config", wallet_config);
}
if (ignored_restriction_reasons.empty()) {
shared_config.set_option_empty("ignored_restriction_reasons");
@ -1486,6 +1461,9 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
} else {
shared_config.set_option_string("animation_search_emojis", animation_search_emojis);
}
shared_config.set_option_empty("default_ton_blockchain_config");
shared_config.set_option_empty("default_ton_blockchain_name");
}
} // namespace td

View File

@ -732,41 +732,7 @@ void PasswordManager::drop_cached_secret() {
LOG(INFO) << "Drop passport secret";
secret_ = optional<secure_storage::Secret>();
}
/*
void PasswordManager::get_ton_wallet_password_salt(Promise<td_api::object_ptr<td_api::tonWalletPasswordSalt>> promise) {
if (!ton_wallet_password_salt_.empty()) {
return promise.set_value(td_api::make_object<td_api::tonWalletPasswordSalt>(ton_wallet_password_salt_));
}
get_ton_wallet_password_salt_queries_.push_back(std::move(promise));
if (get_ton_wallet_password_salt_queries_.size() == 1) {
send_with_promise(G()->net_query_creator().create(telegram_api::wallet_getKeySecretSalt(false)),
PromiseCreator::lambda([actor_id = actor_id(this)](Result<NetQueryPtr> r_query) mutable {
auto r_result = fetch_result<telegram_api::wallet_getKeySecretSalt>(std::move(r_query));
send_closure(actor_id, &PasswordManager::on_get_ton_wallet_password_salt, std::move(r_result));
}));
}
}
void PasswordManager::on_get_ton_wallet_password_salt(
Result<telegram_api::object_ptr<telegram_api::wallet_secretSalt>> result) {
auto promises = std::move(get_ton_wallet_password_salt_queries_);
reset_to_empty(get_ton_wallet_password_salt_queries_);
CHECK(!promises.empty());
if (result.is_ok()) {
ton_wallet_password_salt_ = result.ok()->salt_.as_slice().str();
for (auto &promise : promises) {
promise.set_value(td_api::make_object<td_api::tonWalletPasswordSalt>(ton_wallet_password_salt_));
}
} else {
for (auto &promise : promises) {
promise.set_error(result.error().clone());
}
}
}
*/
void PasswordManager::timeout_expired() {
if (Time::now() >= secret_expire_date_) {
drop_cached_secret();

View File

@ -89,8 +89,6 @@ class PasswordManager : public NetQueryCallback {
static TempPasswordState get_temp_password_state_sync();
// void get_ton_wallet_password_salt(Promise<td_api::object_ptr<td_api::tonWalletPasswordSalt>> promise);
private:
static constexpr size_t MIN_NEW_SALT_SIZE = 8;
static constexpr size_t MIN_NEW_SECURE_SALT_SIZE = 8;
@ -162,9 +160,6 @@ class PasswordManager : public NetQueryCallback {
int32 last_code_length_ = 0;
// string ton_wallet_password_salt_;
// vector<Promise<td_api::object_ptr<td_api::tonWalletPasswordSalt>>> get_ton_wallet_password_salt_queries_;
static Result<secure_storage::Secret> decrypt_secure_secret(
Slice password, tl_object_ptr<telegram_api::SecurePasswordKdfAlgo> algo_ptr, Slice secret, int64 secret_id);
@ -191,8 +186,6 @@ class PasswordManager : public NetQueryCallback {
Promise<TempPasswordState> promise);
void on_finish_create_temp_password(Result<TempPasswordState> result, bool dummy);
// void on_get_ton_wallet_password_salt(Result<telegram_api::object_ptr<telegram_api::wallet_secretSalt>> result);
void on_result(NetQueryPtr query) override;
void start_up() override;

View File

@ -514,34 +514,7 @@ class GetBankCardInfoQuery : public Td::ResultHandler {
promise_.set_error(std::move(status));
}
};
/*
class SendLiteRequestQuery : public Td::ResultHandler {
Promise<td_api::object_ptr<td_api::tonLiteServerResponse>> promise_;
public:
explicit SendLiteRequestQuery(Promise<td_api::object_ptr<td_api::tonLiteServerResponse>> &&promise)
: promise_(std::move(promise)) {
}
void send(BufferSlice request) {
send_query(G()->net_query_creator().create_unauth(telegram_api::wallet_sendLiteRequest(std::move(request))));
}
void on_result(uint64 id, BufferSlice packet) override {
auto result_ptr = fetch_result<telegram_api::wallet_sendLiteRequest>(packet);
if (result_ptr.is_error()) {
return on_error(id, result_ptr.move_as_error());
}
auto response = result_ptr.move_as_ok();
promise_.set_value(td_api::make_object<td_api::tonLiteServerResponse>(response->response_.as_slice().str()));
}
void on_error(uint64 id, Status status) override {
promise_.set_error(std::move(status));
}
};
*/
bool operator==(const LabeledPricePart &lhs, const LabeledPricePart &rhs) {
return lhs.label == rhs.label && lhs.amount == rhs.amount;
}
@ -927,9 +900,5 @@ void delete_saved_credentials(Promise<Unit> &&promise) {
void get_bank_card_info(const string &bank_card_number, Promise<td_api::object_ptr<td_api::bankCardInfo>> &&promise) {
G()->td().get_actor_unsafe()->create_handler<GetBankCardInfoQuery>(std::move(promise))->send(bank_card_number);
}
/*
void send_ton_lite_server_request(Slice request, Promise<td_api::object_ptr<td_api::tonLiteServerResponse>> &&promise) {
G()->td().get_actor_unsafe()->create_handler<SendLiteRequestQuery>(std::move(promise))->send(BufferSlice{request});
}
*/
} // namespace td

View File

@ -156,6 +156,4 @@ void delete_saved_credentials(Promise<Unit> &&promise);
void get_bank_card_info(const string &bank_card_number, Promise<td_api::object_ptr<td_api::bankCardInfo>> &&promise);
// void send_ton_lite_server_request(Slice request, Promise<td_api::object_ptr<td_api::tonLiteServerResponse>> &&promise);
} // namespace td

View File

@ -3282,7 +3282,6 @@ bool Td::is_preauthentication_request(int32 id) {
case td_api::setCustomLanguagePackString::ID:
case td_api::deleteLanguagePack::ID:
case td_api::processPushNotification::ID:
// case td_api::sendTonLiteServerRequest::ID:
case td_api::getOption::ID:
case td_api::setOption::ID:
case td_api::getStorageStatistics::ID:
@ -7305,18 +7304,6 @@ void Td::on_request(uint64 id, const td_api::deleteSavedCredentials &request) {
delete_saved_credentials(std::move(promise));
}
// void Td::on_request(uint64 id, const td_api::sendTonLiteServerRequest &request) {
// CHECK_IS_USER();
// CREATE_REQUEST_PROMISE();
// send_ton_lite_server_request(request.request_, std::move(promise));
// }
// void Td::on_request(uint64 id, const td_api::getTonWalletPasswordSalt &request) {
// CHECK_IS_USER();
// CREATE_REQUEST_PROMISE();
// send_closure(password_manager_, &PasswordManager::get_ton_wallet_password_salt, std::move(promise));
// }
void Td::on_request(uint64 id, td_api::getPassportElement &request) {
CHECK_IS_USER();
CLEAN_INPUT_STRING(request.password_);

View File

@ -973,10 +973,6 @@ class Td final : public NetQueryCallback {
void on_request(uint64 id, const td_api::deleteSavedCredentials &request);
// void on_request(uint64 id, const td_api::sendTonLiteServerRequest &request);
// void on_request(uint64 id, const td_api::getTonWalletPasswordSalt &request);
void on_request(uint64 id, td_api::getPassportElement &request);
void on_request(uint64 id, td_api::getAllPassportElements &request);