From f3225b7106dbd7a84397adb6c27ac74cb43f8ee5 Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 19 Mar 2023 00:29:10 +0300 Subject: [PATCH] Allow to call resendAuthenticationCode for Firenase SMS. --- td/generate/scheme/td_api.tl | 2 +- td/telegram/SendCodeHelper.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/td/generate/scheme/td_api.tl b/td/generate/scheme/td_api.tl index fd1946ba4..3a832f5f0 100644 --- a/td/generate/scheme/td_api.tl +++ b/td/generate/scheme/td_api.tl @@ -56,7 +56,7 @@ authenticationCodeTypeFragment url:string length:int32 = AuthenticationCodeType; authenticationCodeTypeFirebaseAndroid nonce:bytes length:int32 = AuthenticationCodeType; //@description An authentication code is delivered via Firebase Authentication to the official iOS application -//@receipt Receipt of successful applikation token validation to compare with receipt from push notification +//@receipt Receipt of successful application token validation to compare with receipt from push notification //@push_timeout Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds //@length Length of the code authenticationCodeTypeFirebaseIos receipt:string push_timeout:int32 length:int32 = AuthenticationCodeType; diff --git a/td/telegram/SendCodeHelper.cpp b/td/telegram/SendCodeHelper.cpp index 91be3cb07..9c2421359 100644 --- a/td/telegram/SendCodeHelper.cpp +++ b/td/telegram/SendCodeHelper.cpp @@ -17,6 +17,12 @@ void SendCodeHelper::on_sent_code(telegram_api::object_ptrtype_)); next_code_info_ = get_authentication_code_info(std::move(sent_code->next_type_)); next_code_timestamp_ = Time::now() + sent_code->timeout_; + + if (next_code_info_.type == AuthenticationCodeInfo::Type::None && + (sent_code_info_.type == AuthenticationCodeInfo::Type::FirebaseAndroid || + sent_code_info_.type == AuthenticationCodeInfo::Type::FirebaseIos)) { + next_code_info_ = {AuthenticationCodeInfo::Type::Sms, sent_code_info_.length, string()}; + } } void SendCodeHelper::on_phone_code_hash(string &&phone_code_hash) {