Add file_index to td_api::passportElementErrorSourceFile.
GitOrigin-RevId: d77d21361dfece0867bfe880d93aa9c8a2898ac9
This commit is contained in:
parent
900eab129b
commit
29e65aab4a
@ -1002,14 +1002,14 @@ passportElementErrorSourceReverseSide = PassportElementErrorSource;
|
|||||||
//@description The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes
|
//@description The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes
|
||||||
passportElementErrorSourceSelfie = PassportElementErrorSource;
|
passportElementErrorSourceSelfie = PassportElementErrorSource;
|
||||||
|
|
||||||
//@description One of files with the translation of the document contains an error. The error will be considered resolved when the file changes
|
//@description One of files with the translation of the document contains an error. The error will be considered resolved when the file changes @file_index Index of a file with the error
|
||||||
passportElementErrorSourceTranslationFile = PassportElementErrorSource;
|
passportElementErrorSourceTranslationFile file_index:int32 = PassportElementErrorSource;
|
||||||
|
|
||||||
//@description The translation of the document contains an error. The error will be considered resolved when the list of translation files changes
|
//@description The translation of the document contains an error. The error will be considered resolved when the list of translation files changes
|
||||||
passportElementErrorSourceTranslationFiles = PassportElementErrorSource;
|
passportElementErrorSourceTranslationFiles = PassportElementErrorSource;
|
||||||
|
|
||||||
//@description The file contains an error. The error will be considered resolved when the file changes
|
//@description The file contains an error. The error will be considered resolved when the file changes @file_index Index of a file with the error
|
||||||
passportElementErrorSourceFile = PassportElementErrorSource;
|
passportElementErrorSourceFile file_index:int32 = PassportElementErrorSource;
|
||||||
|
|
||||||
//@description The list of attached files contains an error. The error will be considered resolved when the list of files changes
|
//@description The list of attached files contains an error. The error will be considered resolved when the list of files changes
|
||||||
passportElementErrorSourceFiles = PassportElementErrorSource;
|
passportElementErrorSourceFiles = PassportElementErrorSource;
|
||||||
|
Binary file not shown.
@ -690,6 +690,15 @@ class GetPassportAuthorizationForm : public NetQueryCallback {
|
|||||||
loop();
|
loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int32 get_file_index(const vector<SecureFileCredentials> &file_credentials, Slice file_hash) {
|
||||||
|
for (size_t i = 0; i < file_credentials.size(); i++) {
|
||||||
|
if (file_credentials[i].hash == file_hash) {
|
||||||
|
return narrow_cast<int32>(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void loop() override {
|
void loop() override {
|
||||||
if (!secret_ || !authorization_form_) {
|
if (!secret_ || !authorization_form_) {
|
||||||
return;
|
return;
|
||||||
@ -732,6 +741,7 @@ class GetPassportAuthorizationForm : public NetQueryCallback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<TdApiSecureValue> values;
|
std::vector<TdApiSecureValue> values;
|
||||||
|
std::map<SecureValueType, SecureValueCredentials> all_credentials;
|
||||||
for (auto suitable_type : all_types) {
|
for (auto suitable_type : all_types) {
|
||||||
auto type = suitable_type.first;
|
auto type = suitable_type.first;
|
||||||
for (auto &value : authorization_form_->values_) {
|
for (auto &value : authorization_form_->values_) {
|
||||||
@ -753,14 +763,15 @@ class GetPassportAuthorizationForm : public NetQueryCallback {
|
|||||||
|
|
||||||
send_closure(parent_, &SecureManager::on_get_secure_value, r_secure_value.ok());
|
send_closure(parent_, &SecureManager::on_get_secure_value, r_secure_value.ok());
|
||||||
|
|
||||||
auto r_passport_element =
|
auto secure_value = r_secure_value.move_as_ok();
|
||||||
get_passport_element_object(file_manager, std::move(r_secure_value.move_as_ok().value));
|
auto r_passport_element = get_passport_element_object(file_manager, std::move(secure_value.value));
|
||||||
if (r_passport_element.is_error()) {
|
if (r_passport_element.is_error()) {
|
||||||
LOG(ERROR) << "Failed to get passport element object: " << r_passport_element.error();
|
LOG(ERROR) << "Failed to get passport element object: " << r_passport_element.error();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
values.push_back(r_passport_element.move_as_ok());
|
values.push_back(r_passport_element.move_as_ok());
|
||||||
|
all_credentials.emplace(type, std::move(secure_value.credentials));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -794,7 +805,12 @@ class GetPassportAuthorizationForm : public NetQueryCallback {
|
|||||||
auto error = move_tl_object_as<telegram_api::secureValueErrorFile>(error_ptr);
|
auto error = move_tl_object_as<telegram_api::secureValueErrorFile>(error_ptr);
|
||||||
type = get_secure_value_type(error->type_);
|
type = get_secure_value_type(error->type_);
|
||||||
message = std::move(error->text_);
|
message = std::move(error->text_);
|
||||||
source = td_api::make_object<td_api::passportElementErrorSourceFile>();
|
int32 file_index = get_file_index(all_credentials[type].files, error->file_hash_.as_slice());
|
||||||
|
if (file_index == -1) {
|
||||||
|
LOG(ERROR) << "Can't find file with error";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
source = td_api::make_object<td_api::passportElementErrorSourceFile>(file_index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case telegram_api::secureValueErrorFiles::ID: {
|
case telegram_api::secureValueErrorFiles::ID: {
|
||||||
@ -829,7 +845,12 @@ class GetPassportAuthorizationForm : public NetQueryCallback {
|
|||||||
auto error = move_tl_object_as<telegram_api::secureValueErrorTranslationFile>(error_ptr);
|
auto error = move_tl_object_as<telegram_api::secureValueErrorTranslationFile>(error_ptr);
|
||||||
type = get_secure_value_type(error->type_);
|
type = get_secure_value_type(error->type_);
|
||||||
message = std::move(error->text_);
|
message = std::move(error->text_);
|
||||||
source = td_api::make_object<td_api::passportElementErrorSourceTranslationFile>();
|
int32 file_index = get_file_index(all_credentials[type].translations, error->file_hash_.as_slice());
|
||||||
|
if (file_index == -1) {
|
||||||
|
LOG(ERROR) << "Can't find translation file with error";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
source = td_api::make_object<td_api::passportElementErrorSourceTranslationFile>(file_index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case telegram_api::secureValueErrorTranslationFiles::ID: {
|
case telegram_api::secureValueErrorTranslationFiles::ID: {
|
||||||
|
Reference in New Issue
Block a user