mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 22:27:20 +02:00
Fixed peer in list of credits history entries.
This commit is contained in:
parent
4f7a124f3e
commit
a52d4eb4e8
5 changed files with 17 additions and 19 deletions
|
@ -261,7 +261,7 @@ void InnerWidget::fillHistory() {
|
|||
|
||||
const auto sectionIndex = history->lifetime().make_state<int>(0);
|
||||
|
||||
const auto fill = [=](
|
||||
const auto fill = [=, peer = _peer](
|
||||
not_null<PeerData*> premiumBot,
|
||||
const Data::CreditsStatusSlice &fullSlice,
|
||||
const Data::CreditsStatusSlice &inSlice,
|
||||
|
@ -368,7 +368,7 @@ void InnerWidget::fillHistory() {
|
|||
fullSlice,
|
||||
fullWrap->entity(),
|
||||
entryClicked,
|
||||
premiumBot,
|
||||
peer,
|
||||
star,
|
||||
true,
|
||||
true);
|
||||
|
@ -377,7 +377,7 @@ void InnerWidget::fillHistory() {
|
|||
inSlice,
|
||||
inWrap->entity(),
|
||||
entryClicked,
|
||||
premiumBot,
|
||||
peer,
|
||||
star,
|
||||
true,
|
||||
false);
|
||||
|
@ -386,7 +386,7 @@ void InnerWidget::fillHistory() {
|
|||
outSlice,
|
||||
outWrap->entity(),
|
||||
std::move(entryClicked),
|
||||
premiumBot,
|
||||
peer,
|
||||
star,
|
||||
false,
|
||||
true);
|
||||
|
@ -398,11 +398,11 @@ void InnerWidget::fillHistory() {
|
|||
const auto apiLifetime = history->lifetime().make_state<rpl::lifetime>();
|
||||
rpl::single(rpl::empty) | rpl::then(
|
||||
_stateUpdated.events()
|
||||
) | rpl::start_with_next([=] {
|
||||
) | rpl::start_with_next([=, peer = _peer] {
|
||||
using Api = Api::CreditsHistory;
|
||||
const auto apiFull = apiLifetime->make_state<Api>(_peer, true, true);
|
||||
const auto apiIn = apiLifetime->make_state<Api>(_peer, true, false);
|
||||
const auto apiOut = apiLifetime->make_state<Api>(_peer, false, true);
|
||||
const auto apiFull = apiLifetime->make_state<Api>(peer, true, true);
|
||||
const auto apiIn = apiLifetime->make_state<Api>(peer, true, false);
|
||||
const auto apiOut = apiLifetime->make_state<Api>(peer, false, true);
|
||||
apiFull->request({}, [=](Data::CreditsStatusSlice fullSlice) {
|
||||
apiIn->request({}, [=](Data::CreditsStatusSlice inSlice) {
|
||||
apiOut->request({}, [=](Data::CreditsStatusSlice outSlice) {
|
||||
|
|
|
@ -1419,7 +1419,7 @@ void InnerWidget::fill() {
|
|||
data.creditsStatusSlice,
|
||||
tabCreditsList->entity(),
|
||||
entryClicked,
|
||||
premiumBot,
|
||||
_peer,
|
||||
star,
|
||||
true,
|
||||
true);
|
||||
|
|
|
@ -131,7 +131,7 @@ struct BoostsDescriptor final {
|
|||
struct CreditsDescriptor final {
|
||||
Data::CreditsStatusSlice firstSlice;
|
||||
Fn<void(const Data::CreditsHistoryEntry &)> entryClickedCallback;
|
||||
not_null<PeerData*> premiumBot;
|
||||
not_null<PeerData*> peer;
|
||||
not_null<QImage*> creditIcon;
|
||||
bool in = false;
|
||||
bool out = false;
|
||||
|
@ -889,7 +889,6 @@ private:
|
|||
void applySlice(const Data::CreditsStatusSlice &slice);
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
const not_null<PeerData*> _premiumBot;
|
||||
Fn<void(const Data::CreditsHistoryEntry &)> _entryClickedCallback;
|
||||
not_null<QImage*> const _creditIcon;
|
||||
|
||||
|
@ -903,11 +902,10 @@ private:
|
|||
};
|
||||
|
||||
CreditsController::CreditsController(CreditsDescriptor d)
|
||||
: _session(&d.premiumBot->session())
|
||||
, _premiumBot(d.premiumBot)
|
||||
: _session(&d.peer->session())
|
||||
, _entryClickedCallback(std::move(d.entryClickedCallback))
|
||||
, _creditIcon(d.creditIcon)
|
||||
, _api(d.premiumBot->session().user(), d.in, d.out)
|
||||
, _api(d.peer, d.in, d.out)
|
||||
, _firstSlice(std::move(d.firstSlice)) {
|
||||
PeerListController::setStyleOverrides(&st::boostsListBox);
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ void AddCreditsHistoryList(
|
|||
const Data::CreditsStatusSlice &firstSlice,
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
Fn<void(const Data::CreditsHistoryEntry &)> entryClickedCallback,
|
||||
not_null<PeerData*> premiumBot,
|
||||
not_null<PeerData*> peer,
|
||||
not_null<QImage*> creditIcon,
|
||||
bool in,
|
||||
bool out);
|
||||
|
|
|
@ -128,6 +128,7 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
|||
container,
|
||||
object_ptr<Ui::VerticalLayout>(container)));
|
||||
const auto content = history->entity();
|
||||
const auto self = _controller->session().user();
|
||||
|
||||
Ui::AddSkip(content, st::settingsPremiumOptionsPadding.top());
|
||||
|
||||
|
@ -231,7 +232,7 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
|||
fullSlice,
|
||||
fullWrap->entity(),
|
||||
entryClicked,
|
||||
premiumBot,
|
||||
self,
|
||||
&_star,
|
||||
true,
|
||||
true);
|
||||
|
@ -240,7 +241,7 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
|||
inSlice,
|
||||
inWrap->entity(),
|
||||
entryClicked,
|
||||
premiumBot,
|
||||
self,
|
||||
&_star,
|
||||
true,
|
||||
false);
|
||||
|
@ -249,7 +250,7 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
|||
outSlice,
|
||||
outWrap->entity(),
|
||||
std::move(entryClicked),
|
||||
premiumBot,
|
||||
self,
|
||||
&_star,
|
||||
false,
|
||||
true);
|
||||
|
@ -263,7 +264,6 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
|||
const auto apiLifetime = content->lifetime().make_state<rpl::lifetime>();
|
||||
{
|
||||
using Api = Api::CreditsHistory;
|
||||
const auto self = _controller->session().user();
|
||||
const auto apiFull = apiLifetime->make_state<Api>(self, true, true);
|
||||
const auto apiIn = apiLifetime->make_state<Api>(self, true, false);
|
||||
const auto apiOut = apiLifetime->make_state<Api>(self, false, true);
|
||||
|
|
Loading…
Add table
Reference in a new issue