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
|
@ -138,6 +138,7 @@ struct CreditsDescriptor final {
|
||||||
not_null<PeerData*> peer;
|
not_null<PeerData*> peer;
|
||||||
bool in = false;
|
bool in = false;
|
||||||
bool out = false;
|
bool out = false;
|
||||||
|
bool subscription = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PeerListRowWithFullId : public PeerListRow {
|
class PeerListRowWithFullId : public PeerListRow {
|
||||||
|
@ -963,6 +964,7 @@ private:
|
||||||
void applySlice(const Data::CreditsStatusSlice &slice);
|
void applySlice(const Data::CreditsStatusSlice &slice);
|
||||||
|
|
||||||
const not_null<Main::Session*> _session;
|
const not_null<Main::Session*> _session;
|
||||||
|
const bool _subscription;
|
||||||
Clicked _entryClickedCallback;
|
Clicked _entryClickedCallback;
|
||||||
|
|
||||||
Api::CreditsHistory _api;
|
Api::CreditsHistory _api;
|
||||||
|
@ -977,6 +979,7 @@ private:
|
||||||
|
|
||||||
CreditsController::CreditsController(CreditsDescriptor d)
|
CreditsController::CreditsController(CreditsDescriptor d)
|
||||||
: _session(&d.peer->session())
|
: _session(&d.peer->session())
|
||||||
|
, _subscription(d.subscription)
|
||||||
, _entryClickedCallback(std::move(d.entryClickedCallback))
|
, _entryClickedCallback(std::move(d.entryClickedCallback))
|
||||||
, _api(d.peer, d.in, d.out)
|
, _api(d.peer, d.in, d.out)
|
||||||
, _firstSlice(std::move(d.firstSlice))
|
, _firstSlice(std::move(d.firstSlice))
|
||||||
|
@ -1017,7 +1020,7 @@ void CreditsController::loadMoreRows() {
|
||||||
|
|
||||||
void CreditsController::applySlice(const Data::CreditsStatusSlice &slice) {
|
void CreditsController::applySlice(const Data::CreditsStatusSlice &slice) {
|
||||||
_allLoaded = slice.allLoaded;
|
_allLoaded = slice.allLoaded;
|
||||||
_apiToken = slice.tokenSubscriptions;
|
_apiToken = _subscription ? slice.tokenSubscriptions : slice.token;
|
||||||
|
|
||||||
auto create = [&](
|
auto create = [&](
|
||||||
const Data::CreditsHistoryEntry &i,
|
const Data::CreditsHistoryEntry &i,
|
||||||
|
@ -1216,7 +1219,8 @@ void AddCreditsHistoryList(
|
||||||
Clicked callback,
|
Clicked callback,
|
||||||
not_null<PeerData*> bot,
|
not_null<PeerData*> bot,
|
||||||
bool in,
|
bool in,
|
||||||
bool out) {
|
bool out,
|
||||||
|
bool subscription) {
|
||||||
struct State final {
|
struct State final {
|
||||||
State(
|
State(
|
||||||
CreditsDescriptor d,
|
CreditsDescriptor d,
|
||||||
|
@ -1228,7 +1232,7 @@ void AddCreditsHistoryList(
|
||||||
CreditsController controller;
|
CreditsController controller;
|
||||||
};
|
};
|
||||||
const auto state = container->lifetime().make_state<State>(
|
const auto state = container->lifetime().make_state<State>(
|
||||||
CreditsDescriptor{ firstSlice, callback, bot, in, out },
|
CreditsDescriptor{ firstSlice, callback, bot, in, out, subscription },
|
||||||
show);
|
show);
|
||||||
|
|
||||||
state->delegate.setContent(container->add(
|
state->delegate.setContent(container->add(
|
||||||
|
|
|
@ -61,6 +61,7 @@ void AddCreditsHistoryList(
|
||||||
Clicked entryClickedCallback,
|
Clicked entryClickedCallback,
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
bool in,
|
bool in,
|
||||||
bool out);
|
bool out,
|
||||||
|
bool subscription = false);
|
||||||
|
|
||||||
} // namespace Info::Statistics
|
} // namespace Info::Statistics
|
||||||
|
|
|
@ -153,11 +153,8 @@ void Credits::setupSubscriptions(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto entryClicked = [=](
|
const auto entryClicked = [=](
|
||||||
const Data::CreditsHistoryEntry &e,
|
const Data::CreditsHistoryEntry &e,
|
||||||
const Data::SubscriptionEntry &s) {
|
const Data::SubscriptionEntry &s) {
|
||||||
controller->uiShow()->show(Box(
|
controller->uiShow()->show(
|
||||||
ReceiptCreditsBox,
|
Box(ReceiptCreditsBox, controller, e, s));
|
||||||
controller,
|
|
||||||
e,
|
|
||||||
s));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Info::Statistics::AddCreditsHistoryList(
|
Info::Statistics::AddCreditsHistoryList(
|
||||||
|
@ -167,6 +164,7 @@ void Credits::setupSubscriptions(not_null<Ui::VerticalLayout*> container) {
|
||||||
entryClicked,
|
entryClicked,
|
||||||
self,
|
self,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
Ui::AddSkip(inner);
|
Ui::AddSkip(inner);
|
||||||
|
|
Loading…
Reference in a new issue