Add td_api::reportPhoneNumberCodeMissing.
This commit is contained in:
parent
440176cd3c
commit
495e578a81
@ -9807,6 +9807,9 @@ sendPhoneNumberCode phone_number:string settings:phoneNumberAuthenticationSettin
|
||||
//@token SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application
|
||||
sendPhoneNumberFirebaseSms token:string = Ok;
|
||||
|
||||
//@description Reports that authentication code wasn't delivered via SMS to the specified phone number; for official mobile apps only @mobile_network_code Current mobile network code
|
||||
reportPhoneNumberCodeMissing mobile_network_code:string = Ok;
|
||||
|
||||
//@description Resends the authentication code sent to a phone number. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed
|
||||
resendPhoneNumberCode = AuthenticationCodeInfo;
|
||||
|
||||
|
@ -78,6 +78,31 @@ class RequestFirebaseSmsQuery final : public Td::ResultHandler {
|
||||
}
|
||||
};
|
||||
|
||||
class ReportMissingCodeQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
|
||||
public:
|
||||
explicit ReportMissingCodeQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
|
||||
}
|
||||
|
||||
void send(const telegram_api::auth_reportMissingCode &query) {
|
||||
send_query(G()->net_query_creator().create(query));
|
||||
}
|
||||
|
||||
void on_result(BufferSlice packet) final {
|
||||
auto result_ptr = fetch_result<telegram_api::auth_reportMissingCode>(packet);
|
||||
if (result_ptr.is_error()) {
|
||||
return on_error(result_ptr.move_as_error());
|
||||
}
|
||||
|
||||
promise_.set_value(Unit());
|
||||
}
|
||||
|
||||
void on_error(Status status) final {
|
||||
promise_.set_error(std::move(status));
|
||||
}
|
||||
};
|
||||
|
||||
class ChangePhoneQuery final : public Td::ResultHandler {
|
||||
Promise<Unit> promise_;
|
||||
|
||||
@ -255,6 +280,15 @@ void PhoneNumberManager::send_firebase_sms(const string &token, Promise<Unit> &&
|
||||
td_->create_handler<RequestFirebaseSmsQuery>(std::move(promise))->send(send_code_helper_.request_firebase_sms(token));
|
||||
}
|
||||
|
||||
void PhoneNumberManager::report_missing_code(const string &mobile_network_code, Promise<Unit> &&promise) {
|
||||
if (state_ != State::WaitCode) {
|
||||
return promise.set_error(Status::Error(400, "Can't report missing code"));
|
||||
}
|
||||
|
||||
td_->create_handler<ReportMissingCodeQuery>(std::move(promise))
|
||||
->send(send_code_helper_.report_missing_code(mobile_network_code));
|
||||
}
|
||||
|
||||
void PhoneNumberManager::resend_authentication_code(
|
||||
Promise<td_api::object_ptr<td_api::authenticationCodeInfo>> &&promise) {
|
||||
if (state_ != State::WaitCode) {
|
||||
|
@ -30,6 +30,8 @@ class PhoneNumberManager final : public Actor {
|
||||
|
||||
void send_firebase_sms(const string &token, Promise<Unit> &&promise);
|
||||
|
||||
void report_missing_code(const string &mobile_network_code, Promise<Unit> &&promise);
|
||||
|
||||
void resend_authentication_code(Promise<td_api::object_ptr<td_api::authenticationCodeInfo>> &&promise);
|
||||
|
||||
void check_code(string code, Promise<Unit> &&promise);
|
||||
|
@ -4635,6 +4635,13 @@ void Td::on_request(uint64 id, td_api::sendPhoneNumberFirebaseSms &request) {
|
||||
phone_number_manager_->send_firebase_sms(std::move(request.token_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, td_api::reportPhoneNumberCodeMissing &request) {
|
||||
CHECK_IS_USER();
|
||||
CLEAN_INPUT_STRING(request.mobile_network_code_);
|
||||
CREATE_OK_REQUEST_PROMISE();
|
||||
phone_number_manager_->report_missing_code(std::move(request.mobile_network_code_), std::move(promise));
|
||||
}
|
||||
|
||||
void Td::on_request(uint64 id, const td_api::resendPhoneNumberCode &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
|
@ -573,6 +573,8 @@ class Td final : public Actor {
|
||||
|
||||
void on_request(uint64 id, td_api::sendPhoneNumberFirebaseSms &request);
|
||||
|
||||
void on_request(uint64 id, td_api::reportPhoneNumberCodeMissing &request);
|
||||
|
||||
void on_request(uint64 id, const td_api::resendPhoneNumberCode &request);
|
||||
|
||||
void on_request(uint64 id, td_api::checkPhoneNumberCode &request);
|
||||
|
@ -2735,6 +2735,8 @@ class CliClient final : public Actor {
|
||||
phone_number, nullptr, td_api::make_object<td_api::phoneNumberCodeTypeConfirmOwnership>(hash)));
|
||||
} else if (op == "spnfs") {
|
||||
send_request(td_api::make_object<td_api::sendPhoneNumberFirebaseSms>(args));
|
||||
} else if (op == "rpncm") {
|
||||
send_request(td_api::make_object<td_api::reportPhoneNumberCodeMissing>(args));
|
||||
} else if (op == "rpnc") {
|
||||
send_request(td_api::make_object<td_api::resendPhoneNumberCode>());
|
||||
} else if (op == "cpnc") {
|
||||
|
Loading…
x
Reference in New Issue
Block a user