mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-20 08:03:45 +08:00
Load correctly transactions after first page.
This commit is contained in:
@@ -140,6 +140,7 @@ struct CreditsDescriptor final {
|
||||
bool in = false;
|
||||
bool out = false;
|
||||
bool subscription = false;
|
||||
bool currency = false;
|
||||
};
|
||||
|
||||
class PeerListRowWithFullId : public PeerListRow {
|
||||
@@ -1230,7 +1231,7 @@ CreditsController::CreditsController(CreditsDescriptor d)
|
||||
: _session(&d.peer->session())
|
||||
, _subscription(d.subscription)
|
||||
, _entryClickedCallback(std::move(d.entryClickedCallback))
|
||||
, _api(d.peer, d.in, d.out)
|
||||
, _api(d.peer, d.in, d.out, d.currency)
|
||||
, _firstSlice(std::move(d.firstSlice))
|
||||
, _context([&]() -> Ui::Text::MarkedContext {
|
||||
const auto height = st::creditsHistoryRowRightStyle.font->height
|
||||
@@ -1534,7 +1535,8 @@ void AddCreditsHistoryList(
|
||||
not_null<PeerData*> bot,
|
||||
bool in,
|
||||
bool out,
|
||||
bool subs) {
|
||||
bool subs,
|
||||
bool currency) {
|
||||
struct State final {
|
||||
State(CreditsDescriptor d) : controller(std::move(d)) {
|
||||
}
|
||||
@@ -1543,7 +1545,15 @@ void AddCreditsHistoryList(
|
||||
CreditsController controller;
|
||||
};
|
||||
const auto state = container->lifetime().make_state<State>(
|
||||
CreditsDescriptor{ firstSlice, callback, bot, in, out, subs });
|
||||
CreditsDescriptor{
|
||||
firstSlice,
|
||||
callback,
|
||||
bot,
|
||||
in,
|
||||
out,
|
||||
subs,
|
||||
currency,
|
||||
});
|
||||
if (subs) {
|
||||
state->subscriptionDelegate.emplace();
|
||||
state->subscriptionDelegate->setUiShow(show);
|
||||
|
||||
@@ -65,7 +65,8 @@ void AddCreditsHistoryList(
|
||||
not_null<PeerData*> peer,
|
||||
bool in,
|
||||
bool out,
|
||||
bool subscription = false);
|
||||
bool subscription = false,
|
||||
bool currency = false);
|
||||
|
||||
[[nodiscard]] not_null<Ui::SlideWrap<Ui::SettingsButton>*> AddShowMoreButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
|
||||
@@ -282,6 +282,8 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
||||
|
||||
Ui::AddSkip(content, st::lineWidth * 6);
|
||||
|
||||
const auto currency = (_creditsType == CreditsType::Ton);
|
||||
|
||||
const auto fill = [=](
|
||||
const Data::CreditsStatusSlice &fullSlice,
|
||||
const Data::CreditsStatusSlice &inSlice,
|
||||
@@ -381,7 +383,9 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
||||
entryClicked,
|
||||
self,
|
||||
true,
|
||||
true);
|
||||
true,
|
||||
false,
|
||||
currency);
|
||||
Info::Statistics::AddCreditsHistoryList(
|
||||
window->uiShow(),
|
||||
inSlice,
|
||||
@@ -389,7 +393,9 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
||||
entryClicked,
|
||||
self,
|
||||
true,
|
||||
false);
|
||||
false,
|
||||
false,
|
||||
currency);
|
||||
Info::Statistics::AddCreditsHistoryList(
|
||||
window->uiShow(),
|
||||
outSlice,
|
||||
@@ -397,7 +403,9 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
||||
std::move(entryClicked),
|
||||
self,
|
||||
false,
|
||||
true);
|
||||
true,
|
||||
false,
|
||||
currency);
|
||||
|
||||
Ui::AddSkip(inner);
|
||||
Ui::AddSkip(inner);
|
||||
@@ -409,10 +417,21 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
||||
{
|
||||
using Api = Api::CreditsHistory;
|
||||
constexpr auto kFirstPageLimit = 20;
|
||||
const auto c = (_creditsType == CreditsType::Ton);
|
||||
const auto apiFull = apiLifetime->make_state<Api>(self, true, true, c);
|
||||
const auto apiIn = apiLifetime->make_state<Api>(self, true, false, c);
|
||||
const auto apiOut = apiLifetime->make_state<Api>(self, false, true, c);
|
||||
const auto apiFull = apiLifetime->make_state<Api>(
|
||||
self,
|
||||
true,
|
||||
true,
|
||||
currency);
|
||||
const auto apiIn = apiLifetime->make_state<Api>(
|
||||
self,
|
||||
true,
|
||||
false,
|
||||
currency);
|
||||
const auto apiOut = apiLifetime->make_state<Api>(
|
||||
self,
|
||||
false,
|
||||
true,
|
||||
currency);
|
||||
apiFull->request({}, [=](Data::CreditsStatusSlice fullSlice) {
|
||||
apiIn->request({}, [=](Data::CreditsStatusSlice inSlice) {
|
||||
apiOut->request({}, [=](Data::CreditsStatusSlice outSlice) {
|
||||
|
||||
Reference in New Issue
Block a user