mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 07:07:08 +02:00
Fixed loading of credits history list with offset.
This commit is contained in:
parent
0a0dab74a1
commit
d143e32022
3 changed files with 12 additions and 9 deletions
Telegram/SourceFiles
info/statistics
settings
|
@ -138,6 +138,7 @@ struct CreditsDescriptor final {
|
|||
not_null<PeerData*> peer;
|
||||
bool in = false;
|
||||
bool out = false;
|
||||
bool subscription = false;
|
||||
};
|
||||
|
||||
class PeerListRowWithFullId : public PeerListRow {
|
||||
|
@ -963,6 +964,7 @@ private:
|
|||
void applySlice(const Data::CreditsStatusSlice &slice);
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
const bool _subscription;
|
||||
Clicked _entryClickedCallback;
|
||||
|
||||
Api::CreditsHistory _api;
|
||||
|
@ -977,6 +979,7 @@ private:
|
|||
|
||||
CreditsController::CreditsController(CreditsDescriptor d)
|
||||
: _session(&d.peer->session())
|
||||
, _subscription(d.subscription)
|
||||
, _entryClickedCallback(std::move(d.entryClickedCallback))
|
||||
, _api(d.peer, d.in, d.out)
|
||||
, _firstSlice(std::move(d.firstSlice))
|
||||
|
@ -1017,7 +1020,7 @@ void CreditsController::loadMoreRows() {
|
|||
|
||||
void CreditsController::applySlice(const Data::CreditsStatusSlice &slice) {
|
||||
_allLoaded = slice.allLoaded;
|
||||
_apiToken = slice.tokenSubscriptions;
|
||||
_apiToken = _subscription ? slice.tokenSubscriptions : slice.token;
|
||||
|
||||
auto create = [&](
|
||||
const Data::CreditsHistoryEntry &i,
|
||||
|
@ -1216,7 +1219,8 @@ void AddCreditsHistoryList(
|
|||
Clicked callback,
|
||||
not_null<PeerData*> bot,
|
||||
bool in,
|
||||
bool out) {
|
||||
bool out,
|
||||
bool subscription) {
|
||||
struct State final {
|
||||
State(
|
||||
CreditsDescriptor d,
|
||||
|
@ -1228,7 +1232,7 @@ void AddCreditsHistoryList(
|
|||
CreditsController controller;
|
||||
};
|
||||
const auto state = container->lifetime().make_state<State>(
|
||||
CreditsDescriptor{ firstSlice, callback, bot, in, out },
|
||||
CreditsDescriptor{ firstSlice, callback, bot, in, out, subscription },
|
||||
show);
|
||||
|
||||
state->delegate.setContent(container->add(
|
||||
|
|
|
@ -61,6 +61,7 @@ void AddCreditsHistoryList(
|
|||
Clicked entryClickedCallback,
|
||||
not_null<PeerData*> peer,
|
||||
bool in,
|
||||
bool out);
|
||||
bool out,
|
||||
bool subscription = false);
|
||||
|
||||
} // namespace Info::Statistics
|
||||
|
|
|
@ -153,11 +153,8 @@ void Credits::setupSubscriptions(not_null<Ui::VerticalLayout*> container) {
|
|||
const auto entryClicked = [=](
|
||||
const Data::CreditsHistoryEntry &e,
|
||||
const Data::SubscriptionEntry &s) {
|
||||
controller->uiShow()->show(Box(
|
||||
ReceiptCreditsBox,
|
||||
controller,
|
||||
e,
|
||||
s));
|
||||
controller->uiShow()->show(
|
||||
Box(ReceiptCreditsBox, controller, e, s));
|
||||
};
|
||||
|
||||
Info::Statistics::AddCreditsHistoryList(
|
||||
|
@ -167,6 +164,7 @@ void Credits::setupSubscriptions(not_null<Ui::VerticalLayout*> container) {
|
|||
entryClicked,
|
||||
self,
|
||||
true,
|
||||
true,
|
||||
true);
|
||||
|
||||
Ui::AddSkip(inner);
|
||||
|
|
Loading…
Add table
Reference in a new issue