mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-26 07:23:02 +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();
|
return QString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[[nodiscard]] QString FixupTransactionId(QString origin) {
|
||||||
|
return origin.replace(kHorizontalBar, QChar('-'));
|
||||||
|
}
|
||||||
|
|
||||||
[[nodiscard]] Data::GiftCodeLink MakeGiftCodeLink(
|
[[nodiscard]] Data::GiftCodeLink MakeGiftCodeLink(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
const QString &slug) {
|
const QString &slug) {
|
||||||
|
@ -1383,9 +1387,7 @@ void AddStarGiftTable(
|
||||||
auto label = MakeMaybeMultilineTokenValue(table, address, st);
|
auto label = MakeMaybeMultilineTokenValue(table, address, st);
|
||||||
label->setClickHandlerFilter([=](const auto &...) {
|
label->setClickHandlerFilter([=](const auto &...) {
|
||||||
TextUtilities::SetClipboardText(
|
TextUtilities::SetClipboardText(
|
||||||
TextForMimeData::Simple(
|
TextForMimeData::Simple(FixupTransactionId(address)));
|
||||||
base::duplicate(address)
|
|
||||||
.replace(kHorizontalBar, QChar('-'))));
|
|
||||||
show->showToast(
|
show->showToast(
|
||||||
tr::lng_gift_unique_address_copied(tr::now));
|
tr::lng_gift_unique_address_copied(tr::now));
|
||||||
return false;
|
return false;
|
||||||
|
@ -1810,9 +1812,7 @@ void AddCreditsHistoryEntryTable(
|
||||||
auto label = MakeMaybeMultilineTokenValue(table, entry.id, st);
|
auto label = MakeMaybeMultilineTokenValue(table, entry.id, st);
|
||||||
label->setClickHandlerFilter([=](const auto &...) {
|
label->setClickHandlerFilter([=](const auto &...) {
|
||||||
TextUtilities::SetClipboardText(
|
TextUtilities::SetClipboardText(
|
||||||
TextForMimeData::Simple(
|
TextForMimeData::Simple(FixupTransactionId(entry.id)));
|
||||||
base::duplicate(entry.id)
|
|
||||||
.replace(kHorizontalBar, QChar('-'))));
|
|
||||||
show->showToast(
|
show->showToast(
|
||||||
tr::lng_credits_box_history_entry_id_copied(tr::now));
|
tr::lng_credits_box_history_entry_id_copied(tr::now));
|
||||||
return false;
|
return false;
|
||||||
|
@ -1987,3 +1987,29 @@ void AddCreditsBoostTable(
|
||||||
rpl::single(Ui::Text::WithEntities(langDateTime(b.expiresAt))));
|
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 Settings
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
class Show;
|
||||||
class GenericBox;
|
class GenericBox;
|
||||||
class VerticalLayout;
|
class VerticalLayout;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
@ -100,3 +101,8 @@ void AddCreditsBoostTable(
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
Settings::CreditsEntryBoxStyleOverrides st,
|
Settings::CreditsEntryBoxStyleOverrides st,
|
||||||
const Data::Boost &boost);
|
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_text_entities.h"
|
||||||
#include "api/api_updates.h"
|
#include "api/api_updates.h"
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
|
#include "boxes/gift_premium_box.h"
|
||||||
#include "boxes/peers/edit_peer_color_box.h" // AddLevelBadge.
|
#include "boxes/peers/edit_peer_color_box.h" // AddLevelBadge.
|
||||||
#include "chat_helpers/stickers_emoji_pack.h"
|
#include "chat_helpers/stickers_emoji_pack.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
@ -1233,6 +1234,11 @@ void InnerWidget::fill() {
|
||||||
st::channelEarnHistorySubLabel)));
|
st::channelEarnHistorySubLabel)));
|
||||||
Ui::AddSkip(box->verticalLayout());
|
Ui::AddSkip(box->verticalLayout());
|
||||||
Ui::AddSkip(box->verticalLayout());
|
Ui::AddSkip(box->verticalLayout());
|
||||||
|
AddChannelEarnTable(
|
||||||
|
box->uiShow(),
|
||||||
|
box->verticalLayout(),
|
||||||
|
entry);
|
||||||
|
Ui::AddSkip(box->verticalLayout());
|
||||||
Ui::AddSkip(box->verticalLayout());
|
Ui::AddSkip(box->verticalLayout());
|
||||||
box->addRow(object_ptr<Ui::CenterWrap<>>(
|
box->addRow(object_ptr<Ui::CenterWrap<>>(
|
||||||
box,
|
box,
|
||||||
|
|
Loading…
Add table
Reference in a new issue