Add bot message secure-values-sent phrases.

This commit is contained in:
John Preston 2018-04-13 23:24:27 +04:00
parent 6de3112c8a
commit 362b3bc578
2 changed files with 39 additions and 2 deletions

View File

@ -825,6 +825,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_action_took_screenshot" = "{from} took a screenshot!";
"lng_action_you_took_screenshot" = "You took a screenshot!";
"lng_action_bot_allowed_from_domain" = "You allowed this bot to message you when you logged in on {domain}.";
"lng_action_secure_values_sent" = "{user} received the following documents: {documents}";
"lng_action_secure_personal_details" = "personal details";
"lng_action_secure_proof_of_identity" = "proof of identity";
"lng_action_secure_address" = "address";
"lng_action_secure_proof_of_address" = "proof of address";
"lng_action_secure_phone" = "phone number";
"lng_action_secure_email" = "email address";
"lng_ttl_photo_received" = "{from} sent you a self-destructing photo. Please view it on your mobile.";
"lng_ttl_photo_sent" = "You sent a self-destructing photo.";

View File

@ -167,8 +167,38 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
};
auto prepareSecureValuesSent = [&](const MTPDmessageActionSecureValuesSent &action) {
// #TODO passport
return PreparedText{ QString("Secure values sent.") };
auto result = PreparedText{};
auto documents = QStringList();
for (const auto &type : action.vtypes.v) {
documents.push_back([&] {
switch (type.type()) {
case mtpc_secureValueTypePersonalDetails:
return lang(lng_action_secure_personal_details);
case mtpc_secureValueTypePassport:
case mtpc_secureValueTypeDriverLicense:
case mtpc_secureValueTypeIdentityCard:
return lang(lng_action_secure_proof_of_identity);
case mtpc_secureValueTypeAddress:
return lang(lng_action_secure_address);
case mtpc_secureValueTypeUtilityBill:
case mtpc_secureValueTypeBankStatement:
case mtpc_secureValueTypeRentalAgreement:
return lang(lng_action_secure_proof_of_address);
case mtpc_secureValueTypePhone:
return lang(lng_action_secure_phone);
case mtpc_secureValueTypeEmail:
return lang(lng_action_secure_email);
}
Unexpected("Type in prepareSecureValuesSent.");
}());
};
result.links.push_back(history()->peer->createOpenLink());
result.text = lng_action_secure_values_sent(
lt_user,
textcmdLink(1, App::peerName(history()->peer)),
lt_documents,
documents.join(", "));
return result;
};
auto messageText = PreparedText {};