mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 14:08:41 +00:00
Use langpack-ed about for Verification Codes.
This commit is contained in:
@@ -3376,6 +3376,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_replies_no_comments" = "No comments here yet...";
|
||||
|
||||
"lng_verification_codes" = "Verification Codes";
|
||||
"lng_verification_codes_about" = "Third-party services, like websites and stores, can send verification codes to your phone number via Telegram instead of SMS. Such codes will appear in this chat.\n\nIf you didn't request any codes — don't worry! Most likely, someone made a mistake when entering their number.";
|
||||
|
||||
"lng_archived_name" = "Archived chats";
|
||||
"lng_archived_add" = "Archive";
|
||||
|
@@ -241,6 +241,13 @@ HistoryItem *AboutView::item() const {
|
||||
}
|
||||
|
||||
bool AboutView::refresh() {
|
||||
if (_history->peer->isVerifyCodes()) {
|
||||
if (_item) {
|
||||
return false;
|
||||
}
|
||||
setItem(makeAboutVerifyCodes(), nullptr);
|
||||
return true;
|
||||
}
|
||||
const auto user = _history->peer->asUser();
|
||||
const auto info = user ? user->botInfo.get() : nullptr;
|
||||
if (!info) {
|
||||
@@ -359,10 +366,24 @@ void AboutView::setItem(AdminLog::OwnedItem item, DocumentData *sticker) {
|
||||
toggleStickerRegistered(true);
|
||||
}
|
||||
|
||||
AdminLog::OwnedItem AboutView::makeAboutVerifyCodes() {
|
||||
return makeAboutSimple(
|
||||
tr::lng_verification_codes_about(tr::now, Ui::Text::RichLangValue));
|
||||
}
|
||||
|
||||
AdminLog::OwnedItem AboutView::makeAboutBot(not_null<BotInfo*> info) {
|
||||
const auto textWithEntities = TextUtilities::ParseEntities(
|
||||
info->description,
|
||||
Ui::ItemTextBotNoMonoOptions().flags);
|
||||
return makeAboutSimple(
|
||||
TextUtilities::ParseEntities(
|
||||
info->description,
|
||||
Ui::ItemTextBotNoMonoOptions().flags),
|
||||
info->document,
|
||||
info->photo);
|
||||
}
|
||||
|
||||
AdminLog::OwnedItem AboutView::makeAboutSimple(
|
||||
TextWithEntities textWithEntities,
|
||||
DocumentData *document,
|
||||
PhotoData *photo) {
|
||||
const auto make = [&](auto &&...args) {
|
||||
return _history->makeMessage({
|
||||
.id = _history->nextNonHistoryEntryId(),
|
||||
@@ -372,10 +393,10 @@ AdminLog::OwnedItem AboutView::makeAboutBot(not_null<BotInfo*> info) {
|
||||
.from = _history->peer->id,
|
||||
}, std::forward<decltype(args)>(args)...);
|
||||
};
|
||||
const auto item = info->document
|
||||
? make(info->document, textWithEntities)
|
||||
: info->photo
|
||||
? make(info->photo, textWithEntities)
|
||||
const auto item = document
|
||||
? make(document, textWithEntities)
|
||||
: photo
|
||||
? make(photo, textWithEntities)
|
||||
: make(textWithEntities, MTP_messageMediaEmpty());
|
||||
return AdminLog::OwnedItem(_delegate, item);
|
||||
}
|
||||
|
@@ -34,7 +34,12 @@ public:
|
||||
int height = 0;
|
||||
|
||||
private:
|
||||
[[nodiscard]] AdminLog::OwnedItem makeAboutVerifyCodes();
|
||||
[[nodiscard]] AdminLog::OwnedItem makeAboutBot(not_null<BotInfo*> info);
|
||||
[[nodiscard]] AdminLog::OwnedItem makeAboutSimple(
|
||||
TextWithEntities textWithEntities,
|
||||
DocumentData *document = nullptr,
|
||||
PhotoData *photo = nullptr);
|
||||
[[nodiscard]] AdminLog::OwnedItem makePremiumRequired();
|
||||
[[nodiscard]] AdminLog::OwnedItem makeBlocked();
|
||||
void makeIntro(not_null<UserData*> user);
|
||||
|
Reference in New Issue
Block a user