mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-25 15:03:03 +02:00
Added transaction id info to channel earn history entries.
This commit is contained in:
parent
0fd7061671
commit
bee567f2b1
3 changed files with 44 additions and 6 deletions
|
@ -96,6 +96,10 @@ constexpr auto kHorizontalBar = QChar(0x2015);
|
|||
return QString();
|
||||
};
|
||||
|
||||
[[nodiscard]] QString FixupTransactionId(QString origin) {
|
||||
return origin.replace(kHorizontalBar, QChar('-'));
|
||||
}
|
||||
|
||||
[[nodiscard]] Data::GiftCodeLink MakeGiftCodeLink(
|
||||
not_null<Main::Session*> session,
|
||||
const QString &slug) {
|
||||
|
@ -1383,9 +1387,7 @@ void AddStarGiftTable(
|
|||
auto label = MakeMaybeMultilineTokenValue(table, address, st);
|
||||
label->setClickHandlerFilter([=](const auto &...) {
|
||||
TextUtilities::SetClipboardText(
|
||||
TextForMimeData::Simple(
|
||||
base::duplicate(address)
|
||||
.replace(kHorizontalBar, QChar('-'))));
|
||||
TextForMimeData::Simple(FixupTransactionId(address)));
|
||||
show->showToast(
|
||||
tr::lng_gift_unique_address_copied(tr::now));
|
||||
return false;
|
||||
|
@ -1810,9 +1812,7 @@ void AddCreditsHistoryEntryTable(
|
|||
auto label = MakeMaybeMultilineTokenValue(table, entry.id, st);
|
||||
label->setClickHandlerFilter([=](const auto &...) {
|
||||
TextUtilities::SetClipboardText(
|
||||
TextForMimeData::Simple(
|
||||
base::duplicate(entry.id)
|
||||
.replace(kHorizontalBar, QChar('-'))));
|
||||
TextForMimeData::Simple(FixupTransactionId(entry.id)));
|
||||
show->showToast(
|
||||
tr::lng_credits_box_history_entry_id_copied(tr::now));
|
||||
return false;
|
||||
|
@ -1987,3 +1987,29 @@ void AddCreditsBoostTable(
|
|||
rpl::single(Ui::Text::WithEntities(langDateTime(b.expiresAt))));
|
||||
}
|
||||
}
|
||||
|
||||
void AddChannelEarnTable(
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
const Data::CreditsHistoryEntry &entry) {
|
||||
const auto table = container->add(
|
||||
object_ptr<Ui::TableLayout>(
|
||||
container,
|
||||
st::giveawayGiftCodeTable),
|
||||
st::giveawayGiftCodeTableMargin);
|
||||
if (!entry.id.isEmpty()) {
|
||||
auto label = MakeMaybeMultilineTokenValue(table, entry.id, {});
|
||||
label->setClickHandlerFilter([=](const auto &...) {
|
||||
TextUtilities::SetClipboardText(
|
||||
TextForMimeData::Simple(FixupTransactionId(entry.id)));
|
||||
show->showToast(
|
||||
tr::lng_credits_box_history_entry_id_copied(tr::now));
|
||||
return false;
|
||||
});
|
||||
AddTableRow(
|
||||
table,
|
||||
tr::lng_credits_box_history_entry_id(),
|
||||
std::move(label),
|
||||
st::giveawayGiftCodeValueMargin);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ struct CreditsEntryBoxStyleOverrides;
|
|||
} // namespace Settings
|
||||
|
||||
namespace Ui {
|
||||
class Show;
|
||||
class GenericBox;
|
||||
class VerticalLayout;
|
||||
} // namespace Ui
|
||||
|
@ -100,3 +101,8 @@ void AddCreditsBoostTable(
|
|||
not_null<Ui::VerticalLayout*> container,
|
||||
Settings::CreditsEntryBoxStyleOverrides st,
|
||||
const Data::Boost &boost);
|
||||
|
||||
void AddChannelEarnTable(
|
||||
std::shared_ptr<Ui::Show> show,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
const Data::CreditsHistoryEntry &entry);
|
||||
|
|
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "api/api_text_entities.h"
|
||||
#include "api/api_updates.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "boxes/gift_premium_box.h"
|
||||
#include "boxes/peers/edit_peer_color_box.h" // AddLevelBadge.
|
||||
#include "chat_helpers/stickers_emoji_pack.h"
|
||||
#include "core/application.h"
|
||||
|
@ -1233,6 +1234,11 @@ void InnerWidget::fill() {
|
|||
st::channelEarnHistorySubLabel)));
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
AddChannelEarnTable(
|
||||
box->uiShow(),
|
||||
box->verticalLayout(),
|
||||
entry);
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
box->addRow(object_ptr<Ui::CenterWrap<>>(
|
||||
box,
|
||||
|
|
Loading…
Add table
Reference in a new issue