mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Replaced credits currency with icon only in buttons with Buy type.
This commit is contained in:
parent
6f6fb3d1b6
commit
bb33d0b997
1 changed files with 13 additions and 3 deletions
|
@ -694,10 +694,20 @@ ReplyKeyboard::ReplyKeyboard(
|
||||||
newRow.reserve(rowSize);
|
newRow.reserve(rowSize);
|
||||||
for (auto j = 0; j != rowSize; ++j) {
|
for (auto j = 0; j != rowSize; ++j) {
|
||||||
auto button = Button();
|
auto button = Button();
|
||||||
const auto text = base::duplicate(row[j].text).replace(
|
using Type = HistoryMessageMarkupButton::Type;
|
||||||
Ui::kCreditsCurrency,
|
const auto isBuy = (row[j].type == Type::Buy);
|
||||||
QChar(0x2B50));
|
static const auto RegExp = QRegularExpression("\\b"
|
||||||
|
+ Ui::kCreditsCurrency
|
||||||
|
+ "\\b");
|
||||||
|
const auto text = isBuy
|
||||||
|
? base::duplicate(row[j].text).replace(
|
||||||
|
RegExp,
|
||||||
|
QChar(0x2B50))
|
||||||
|
: row[j].text;
|
||||||
const auto textWithEntities = [&] {
|
const auto textWithEntities = [&] {
|
||||||
|
if (!isBuy) {
|
||||||
|
return TextWithEntities();
|
||||||
|
}
|
||||||
auto result = TextWithEntities();
|
auto result = TextWithEntities();
|
||||||
auto firstPart = true;
|
auto firstPart = true;
|
||||||
for (const auto &part : text.split(QChar(0x2B50))) {
|
for (const auto &part : text.split(QChar(0x2B50))) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue