mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +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 sectionIndex = history->lifetime().make_state<int>(0);
|
||||||
|
|
||||||
const auto fill = [=](
|
const auto fill = [=, peer = _peer](
|
||||||
not_null<PeerData*> premiumBot,
|
not_null<PeerData*> premiumBot,
|
||||||
const Data::CreditsStatusSlice &fullSlice,
|
const Data::CreditsStatusSlice &fullSlice,
|
||||||
const Data::CreditsStatusSlice &inSlice,
|
const Data::CreditsStatusSlice &inSlice,
|
||||||
|
@ -368,7 +368,7 @@ void InnerWidget::fillHistory() {
|
||||||
fullSlice,
|
fullSlice,
|
||||||
fullWrap->entity(),
|
fullWrap->entity(),
|
||||||
entryClicked,
|
entryClicked,
|
||||||
premiumBot,
|
peer,
|
||||||
star,
|
star,
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
|
@ -377,7 +377,7 @@ void InnerWidget::fillHistory() {
|
||||||
inSlice,
|
inSlice,
|
||||||
inWrap->entity(),
|
inWrap->entity(),
|
||||||
entryClicked,
|
entryClicked,
|
||||||
premiumBot,
|
peer,
|
||||||
star,
|
star,
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
|
@ -386,7 +386,7 @@ void InnerWidget::fillHistory() {
|
||||||
outSlice,
|
outSlice,
|
||||||
outWrap->entity(),
|
outWrap->entity(),
|
||||||
std::move(entryClicked),
|
std::move(entryClicked),
|
||||||
premiumBot,
|
peer,
|
||||||
star,
|
star,
|
||||||
false,
|
false,
|
||||||
true);
|
true);
|
||||||
|
@ -398,11 +398,11 @@ void InnerWidget::fillHistory() {
|
||||||
const auto apiLifetime = history->lifetime().make_state<rpl::lifetime>();
|
const auto apiLifetime = history->lifetime().make_state<rpl::lifetime>();
|
||||||
rpl::single(rpl::empty) | rpl::then(
|
rpl::single(rpl::empty) | rpl::then(
|
||||||
_stateUpdated.events()
|
_stateUpdated.events()
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=, peer = _peer] {
|
||||||
using Api = Api::CreditsHistory;
|
using Api = Api::CreditsHistory;
|
||||||
const auto apiFull = apiLifetime->make_state<Api>(_peer, true, true);
|
const auto apiFull = apiLifetime->make_state<Api>(peer, true, true);
|
||||||
const auto apiIn = apiLifetime->make_state<Api>(_peer, true, false);
|
const auto apiIn = apiLifetime->make_state<Api>(peer, true, false);
|
||||||
const auto apiOut = apiLifetime->make_state<Api>(_peer, false, true);
|
const auto apiOut = apiLifetime->make_state<Api>(peer, false, true);
|
||||||
apiFull->request({}, [=](Data::CreditsStatusSlice fullSlice) {
|
apiFull->request({}, [=](Data::CreditsStatusSlice fullSlice) {
|
||||||
apiIn->request({}, [=](Data::CreditsStatusSlice inSlice) {
|
apiIn->request({}, [=](Data::CreditsStatusSlice inSlice) {
|
||||||
apiOut->request({}, [=](Data::CreditsStatusSlice outSlice) {
|
apiOut->request({}, [=](Data::CreditsStatusSlice outSlice) {
|
||||||
|
|
|
@ -1419,7 +1419,7 @@ void InnerWidget::fill() {
|
||||||
data.creditsStatusSlice,
|
data.creditsStatusSlice,
|
||||||
tabCreditsList->entity(),
|
tabCreditsList->entity(),
|
||||||
entryClicked,
|
entryClicked,
|
||||||
premiumBot,
|
_peer,
|
||||||
star,
|
star,
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
|
|
|
@ -131,7 +131,7 @@ struct BoostsDescriptor final {
|
||||||
struct CreditsDescriptor final {
|
struct CreditsDescriptor final {
|
||||||
Data::CreditsStatusSlice firstSlice;
|
Data::CreditsStatusSlice firstSlice;
|
||||||
Fn<void(const Data::CreditsHistoryEntry &)> entryClickedCallback;
|
Fn<void(const Data::CreditsHistoryEntry &)> entryClickedCallback;
|
||||||
not_null<PeerData*> premiumBot;
|
not_null<PeerData*> peer;
|
||||||
not_null<QImage*> creditIcon;
|
not_null<QImage*> creditIcon;
|
||||||
bool in = false;
|
bool in = false;
|
||||||
bool out = false;
|
bool out = false;
|
||||||
|
@ -889,7 +889,6 @@ 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 not_null<PeerData*> _premiumBot;
|
|
||||||
Fn<void(const Data::CreditsHistoryEntry &)> _entryClickedCallback;
|
Fn<void(const Data::CreditsHistoryEntry &)> _entryClickedCallback;
|
||||||
not_null<QImage*> const _creditIcon;
|
not_null<QImage*> const _creditIcon;
|
||||||
|
|
||||||
|
@ -903,11 +902,10 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
CreditsController::CreditsController(CreditsDescriptor d)
|
CreditsController::CreditsController(CreditsDescriptor d)
|
||||||
: _session(&d.premiumBot->session())
|
: _session(&d.peer->session())
|
||||||
, _premiumBot(d.premiumBot)
|
|
||||||
, _entryClickedCallback(std::move(d.entryClickedCallback))
|
, _entryClickedCallback(std::move(d.entryClickedCallback))
|
||||||
, _creditIcon(d.creditIcon)
|
, _creditIcon(d.creditIcon)
|
||||||
, _api(d.premiumBot->session().user(), d.in, d.out)
|
, _api(d.peer, d.in, d.out)
|
||||||
, _firstSlice(std::move(d.firstSlice)) {
|
, _firstSlice(std::move(d.firstSlice)) {
|
||||||
PeerListController::setStyleOverrides(&st::boostsListBox);
|
PeerListController::setStyleOverrides(&st::boostsListBox);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ void AddCreditsHistoryList(
|
||||||
const Data::CreditsStatusSlice &firstSlice,
|
const Data::CreditsStatusSlice &firstSlice,
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
Fn<void(const Data::CreditsHistoryEntry &)> entryClickedCallback,
|
Fn<void(const Data::CreditsHistoryEntry &)> entryClickedCallback,
|
||||||
not_null<PeerData*> premiumBot,
|
not_null<PeerData*> peer,
|
||||||
not_null<QImage*> creditIcon,
|
not_null<QImage*> creditIcon,
|
||||||
bool in,
|
bool in,
|
||||||
bool out);
|
bool out);
|
||||||
|
|
|
@ -128,6 +128,7 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
||||||
container,
|
container,
|
||||||
object_ptr<Ui::VerticalLayout>(container)));
|
object_ptr<Ui::VerticalLayout>(container)));
|
||||||
const auto content = history->entity();
|
const auto content = history->entity();
|
||||||
|
const auto self = _controller->session().user();
|
||||||
|
|
||||||
Ui::AddSkip(content, st::settingsPremiumOptionsPadding.top());
|
Ui::AddSkip(content, st::settingsPremiumOptionsPadding.top());
|
||||||
|
|
||||||
|
@ -231,7 +232,7 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
||||||
fullSlice,
|
fullSlice,
|
||||||
fullWrap->entity(),
|
fullWrap->entity(),
|
||||||
entryClicked,
|
entryClicked,
|
||||||
premiumBot,
|
self,
|
||||||
&_star,
|
&_star,
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
|
@ -240,7 +241,7 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
||||||
inSlice,
|
inSlice,
|
||||||
inWrap->entity(),
|
inWrap->entity(),
|
||||||
entryClicked,
|
entryClicked,
|
||||||
premiumBot,
|
self,
|
||||||
&_star,
|
&_star,
|
||||||
true,
|
true,
|
||||||
false);
|
false);
|
||||||
|
@ -249,7 +250,7 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
||||||
outSlice,
|
outSlice,
|
||||||
outWrap->entity(),
|
outWrap->entity(),
|
||||||
std::move(entryClicked),
|
std::move(entryClicked),
|
||||||
premiumBot,
|
self,
|
||||||
&_star,
|
&_star,
|
||||||
false,
|
false,
|
||||||
true);
|
true);
|
||||||
|
@ -263,7 +264,6 @@ void Credits::setupHistory(not_null<Ui::VerticalLayout*> container) {
|
||||||
const auto apiLifetime = content->lifetime().make_state<rpl::lifetime>();
|
const auto apiLifetime = content->lifetime().make_state<rpl::lifetime>();
|
||||||
{
|
{
|
||||||
using Api = Api::CreditsHistory;
|
using Api = Api::CreditsHistory;
|
||||||
const auto self = _controller->session().user();
|
|
||||||
const auto apiFull = apiLifetime->make_state<Api>(self, true, true);
|
const auto apiFull = apiLifetime->make_state<Api>(self, true, true);
|
||||||
const auto apiIn = apiLifetime->make_state<Api>(self, true, false);
|
const auto apiIn = apiLifetime->make_state<Api>(self, true, false);
|
||||||
const auto apiOut = apiLifetime->make_state<Api>(self, false, true);
|
const auto apiOut = apiLifetime->make_state<Api>(self, false, true);
|
||||||
|
|
Loading…
Add table
Reference in a new issue