mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Replaced list of credits subscriptions with peer list with widgets.
This commit is contained in:
parent
3042fb7299
commit
479e369d29
1 changed files with 22 additions and 14 deletions
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "api/api_credits.h"
|
#include "api/api_credits.h"
|
||||||
#include "api/api_statistics.h"
|
#include "api/api_statistics.h"
|
||||||
#include "boxes/peer_list_controllers.h"
|
#include "boxes/peer_list_controllers.h"
|
||||||
|
#include "boxes/peer_list_widgets.h"
|
||||||
#include "chat_helpers/stickers_gift_box_pack.h"
|
#include "chat_helpers/stickers_gift_box_pack.h"
|
||||||
#include "core/ui_integration.h" // Core::MarkedTextContext.
|
#include "core/ui_integration.h" // Core::MarkedTextContext.
|
||||||
#include "data/data_channel.h"
|
#include "data/data_channel.h"
|
||||||
|
@ -1274,29 +1275,36 @@ void AddCreditsHistoryList(
|
||||||
not_null<PeerData*> bot,
|
not_null<PeerData*> bot,
|
||||||
bool in,
|
bool in,
|
||||||
bool out,
|
bool out,
|
||||||
bool subscription) {
|
bool subs) {
|
||||||
struct State final {
|
struct State final {
|
||||||
State(
|
State(CreditsDescriptor d) : controller(std::move(d)) {
|
||||||
CreditsDescriptor d,
|
|
||||||
std::shared_ptr<Main::SessionShow> show)
|
|
||||||
: delegate(std::move(show))
|
|
||||||
, controller(std::move(d)) {
|
|
||||||
}
|
}
|
||||||
PeerListContentDelegateShow delegate;
|
std::optional<PeerListContentDelegateShow> creditsDelegate;
|
||||||
|
std::optional<PeerListWidgetsDelegate> subscriptionDelegate;
|
||||||
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, subscription },
|
CreditsDescriptor{ firstSlice, callback, bot, in, out, subs });
|
||||||
show);
|
if (subs) {
|
||||||
|
state->subscriptionDelegate.emplace();
|
||||||
state->delegate.setContent(container->add(
|
state->subscriptionDelegate->setUiShow(show);
|
||||||
|
state->subscriptionDelegate->setContent(container->add(
|
||||||
|
object_ptr<PeerListWidgets>(container, &state->controller)));
|
||||||
|
state->controller.setDelegate(&(*state->subscriptionDelegate));
|
||||||
|
} else {
|
||||||
|
state->creditsDelegate.emplace(show);
|
||||||
|
state->creditsDelegate->setContent(container->add(
|
||||||
object_ptr<PeerListContent>(container, &state->controller)));
|
object_ptr<PeerListContent>(container, &state->controller)));
|
||||||
state->controller.setDelegate(&state->delegate);
|
state->controller.setDelegate(&(*state->creditsDelegate));
|
||||||
|
}
|
||||||
|
|
||||||
const auto wrap = container->add(
|
const auto wrap = container->add(
|
||||||
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
||||||
container,
|
container,
|
||||||
CreateShowMoreButton(container, tr::lng_stories_show_more())));
|
CreateShowMoreButton(container, tr::lng_stories_show_more())),
|
||||||
|
subs
|
||||||
|
? QMargins()
|
||||||
|
: QMargins(0, -st::settingsButton.padding.top(), 0, 0));
|
||||||
|
|
||||||
const auto showMore = [=] {
|
const auto showMore = [=] {
|
||||||
if (!state->controller.skipRequest()) {
|
if (!state->controller.skipRequest()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue