mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-20 02:10:24 +00:00
Improve phrases in passport.
This commit is contained in:
parent
e1fd43b2a4
commit
661de0c326
@ -1595,14 +1595,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_passport_selfie_name" = "Photo";
|
||||
"lng_passport_selfie_description" = "Upload a photo of yourself holding your document. Make sure the ID and your face are clearly visible.";
|
||||
"lng_passport_upload_selfie" = "Upload selfie";
|
||||
"lng_passport_reupload_selfie" = "Reupload selfie";
|
||||
"lng_passport_front_side_title" = "Front side";
|
||||
"lng_passport_front_side_name" = "Scan";
|
||||
"lng_passport_front_side_description" = "Upload the front side of your document.";
|
||||
"lng_passport_upload_front_side" = "Upload a scan of the front side";
|
||||
"lng_passport_reupload_front_side" = "Reupload a scan of the front side";
|
||||
"lng_passport_reverse_side_title" = "Reverse side";
|
||||
"lng_passport_reverse_side_name" = "Scan";
|
||||
"lng_passport_reverse_side_description" = "Upload the reverse side of your document.";
|
||||
"lng_passport_upload_reverse_side" = "Upload a scan of the reverse side";
|
||||
"lng_passport_reupload_reverse_side" = "Reupload a scan of the reverse side";
|
||||
"lng_passport_main_page_title" = "Main page";
|
||||
"lng_passport_main_page_name" = "Scan";
|
||||
"lng_passport_main_page_description" = "Upload the main page of your document.";
|
||||
"lng_passport_upload_main_page" = "Upload a scan of the main page";
|
||||
"lng_passport_reupload_main_page" = "Reupload a scan of the main page";
|
||||
"lng_passport_personal_details" = "Personal details";
|
||||
"lng_passport_personal_details_enter" = "Enter your personal details";
|
||||
"lng_passport_choose_image" = "Choose scan image";
|
||||
@ -1617,7 +1625,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_passport_country" = "Country";
|
||||
"lng_passport_residence_country" = "Residence";
|
||||
"lng_passport_country_choose" = "Choose country";
|
||||
"lng_passport_document_number" = "Card Number";
|
||||
"lng_passport_document_number" = "Document Number";
|
||||
"lng_passport_expiry_date" = "Expiry date";
|
||||
"lng_passport_address" = "Address";
|
||||
"lng_passport_address_enter" = "Enter your address";
|
||||
|
@ -117,7 +117,7 @@ struct EditScans::SpecialScan {
|
||||
QPointer<Info::Profile::Button> upload;
|
||||
bool errorShown = false;
|
||||
Animation errorAnimation;
|
||||
|
||||
rpl::variable<bool> rowCreated;
|
||||
};
|
||||
|
||||
ScanButton::ScanButton(
|
||||
@ -390,10 +390,14 @@ void EditScans::setupScans(const QString &header) {
|
||||
}
|
||||
|
||||
void EditScans::setupSpecialScans(std::map<SpecialFile, ScanInfo> &&files) {
|
||||
const auto title = [](SpecialFile type) {
|
||||
const auto requiresBothSides = files.find(SpecialFile::ReverseSide)
|
||||
!= end(files);
|
||||
const auto title = [&](SpecialFile type) {
|
||||
switch (type) {
|
||||
case SpecialFile::FrontSide:
|
||||
return lang(lng_passport_front_side_title);
|
||||
return lang(requiresBothSides
|
||||
? lng_passport_front_side_title
|
||||
: lng_passport_main_page_title);
|
||||
case SpecialFile::ReverseSide:
|
||||
return lang(lng_passport_reverse_side_title);
|
||||
case SpecialFile::Selfie:
|
||||
@ -401,21 +405,33 @@ void EditScans::setupSpecialScans(std::map<SpecialFile, ScanInfo> &&files) {
|
||||
}
|
||||
Unexpected("Type in special row title.");
|
||||
};
|
||||
const auto uploadKey = [](SpecialFile type) {
|
||||
const auto uploadKey = [=](SpecialFile type, bool hasScan) {
|
||||
switch (type) {
|
||||
case SpecialFile::FrontSide:
|
||||
return lng_passport_upload_front_side;
|
||||
return requiresBothSides
|
||||
? (hasScan
|
||||
? lng_passport_reupload_front_side
|
||||
: lng_passport_upload_front_side)
|
||||
: (hasScan
|
||||
? lng_passport_reupload_main_page
|
||||
: lng_passport_upload_main_page);
|
||||
case SpecialFile::ReverseSide:
|
||||
return lng_passport_upload_reverse_side;
|
||||
return hasScan
|
||||
? lng_passport_reupload_reverse_side
|
||||
: lng_passport_upload_reverse_side;
|
||||
case SpecialFile::Selfie:
|
||||
return lng_passport_upload_selfie;
|
||||
return hasScan
|
||||
? lng_passport_reupload_selfie
|
||||
: lng_passport_upload_selfie;
|
||||
}
|
||||
Unexpected("Type in special row upload key.");
|
||||
};
|
||||
const auto description = [](SpecialFile type) {
|
||||
const auto description = [&](SpecialFile type) {
|
||||
switch (type) {
|
||||
case SpecialFile::FrontSide:
|
||||
return lang(lng_passport_front_side_description);
|
||||
return lang(requiresBothSides
|
||||
? lng_passport_front_side_description
|
||||
: lng_passport_main_page_description);
|
||||
case SpecialFile::ReverseSide:
|
||||
return lang(lng_passport_reverse_side_description);
|
||||
case SpecialFile::Selfie:
|
||||
@ -444,14 +460,17 @@ void EditScans::setupSpecialScans(std::map<SpecialFile, ScanInfo> &&files) {
|
||||
scan.header->toggle(scan.file.key.id != 0, anim::type::instant);
|
||||
scan.wrap = inner->add(object_ptr<Ui::VerticalLayout>(inner));
|
||||
if (scan.file.key.id) {
|
||||
createSpecialScanRow(scan, scan.file);
|
||||
createSpecialScanRow(scan, scan.file, requiresBothSides);
|
||||
}
|
||||
auto label = scan.rowCreated.value(
|
||||
) | rpl::map([=](bool created) {
|
||||
return Lang::Viewer(uploadKey(type, created));
|
||||
}) | rpl::flatten_latest(
|
||||
) | Info::Profile::ToUpperValue();
|
||||
scan.upload = inner->add(
|
||||
object_ptr<Info::Profile::Button>(
|
||||
inner,
|
||||
Lang::Viewer(
|
||||
uploadKey(type)
|
||||
) | Info::Profile::ToUpperValue(),
|
||||
std::move(label),
|
||||
st::passportUploadButton),
|
||||
st::passportUploadButtonPadding);
|
||||
scan.upload->addClickHandler([=, type = type] {
|
||||
@ -527,11 +546,15 @@ void EditScans::updateSpecialScan(SpecialFile type, ScanInfo &&info) {
|
||||
auto &scan = i->second;
|
||||
if (scan.file.key.id) {
|
||||
updateFileRow(scan.row->entity(), info);
|
||||
scan.rowCreated = !info.deleted;
|
||||
if (!info.deleted) {
|
||||
hideSpecialScanError(type);
|
||||
}
|
||||
} else {
|
||||
createSpecialScanRow(scan, info);
|
||||
const auto requiresBothSides
|
||||
= (_specialScans.find(SpecialFile::ReverseSide)
|
||||
!= end(_specialScans));
|
||||
createSpecialScanRow(scan, info, requiresBothSides);
|
||||
scan.wrap->resizeToWidth(width());
|
||||
scan.row->show(anim::type::normal);
|
||||
scan.header->show(anim::type::normal);
|
||||
@ -551,14 +574,17 @@ void EditScans::updateFileRow(
|
||||
|
||||
void EditScans::createSpecialScanRow(
|
||||
SpecialScan &scan,
|
||||
const ScanInfo &info) {
|
||||
const ScanInfo &info,
|
||||
bool requiresBothSides) {
|
||||
Expects(scan.file.special.has_value());
|
||||
|
||||
const auto type = *scan.file.special;
|
||||
const auto name = [&] {
|
||||
switch (type) {
|
||||
case SpecialFile::FrontSide:
|
||||
return lang(lng_passport_front_side_name);
|
||||
return lang(requiresBothSides
|
||||
? lng_passport_front_side_name
|
||||
: lng_passport_main_page_name);
|
||||
case SpecialFile::ReverseSide:
|
||||
return lang(lng_passport_reverse_side_name);
|
||||
case SpecialFile::Selfie:
|
||||
@ -579,6 +605,7 @@ void EditScans::createSpecialScanRow(
|
||||
_controller->restoreSpecialScan(type);
|
||||
}, row->lifetime());
|
||||
|
||||
scan.rowCreated = !info.deleted;
|
||||
hideSpecialScanError(type);
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,8 @@ private:
|
||||
void pushScan(const ScanInfo &info);
|
||||
void createSpecialScanRow(
|
||||
SpecialScan &scan,
|
||||
const ScanInfo &info);
|
||||
const ScanInfo &info,
|
||||
bool requiresBothSides);
|
||||
base::unique_qptr<Ui::SlideWrap<ScanButton>> createScan(
|
||||
not_null<Ui::VerticalLayout*> parent,
|
||||
const ScanInfo &info,
|
||||
|
Loading…
Reference in New Issue
Block a user