mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add "Boost Group/Channel" button to chat menu.
This commit is contained in:
parent
9251e6faba
commit
86d0c49e44
1 changed files with 16 additions and 6 deletions
|
@ -300,6 +300,7 @@ private:
|
||||||
void addDeleteTopic();
|
void addDeleteTopic();
|
||||||
void addVideoChat();
|
void addVideoChat();
|
||||||
void addViewStatistics();
|
void addViewStatistics();
|
||||||
|
void addBoostChat();
|
||||||
|
|
||||||
not_null<SessionController*> _controller;
|
not_null<SessionController*> _controller;
|
||||||
Dialogs::EntryState _request;
|
Dialogs::EntryState _request;
|
||||||
|
@ -1034,6 +1035,20 @@ void Filler::addManageChat() {
|
||||||
}, &st::menuIconManage);
|
}, &st::menuIconManage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Filler::addBoostChat() {
|
||||||
|
if (const auto channel = _peer->asChannel()) {
|
||||||
|
const auto text = channel->isMegagroup()
|
||||||
|
? tr::lng_boost_group_button(tr::now)
|
||||||
|
: tr::lng_boost_channel_button(tr::now);
|
||||||
|
const auto weak = base::make_weak(_controller);
|
||||||
|
_addAction(text, [=] {
|
||||||
|
if (const auto strong = weak.get()) {
|
||||||
|
strong->resolveBoostState(channel);
|
||||||
|
}
|
||||||
|
}, &st::menuIconBoosts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Filler::addViewStatistics() {
|
void Filler::addViewStatistics() {
|
||||||
if (const auto channel = _peer->asChannel()) {
|
if (const auto channel = _peer->asChannel()) {
|
||||||
const auto controller = _controller;
|
const auto controller = _controller;
|
||||||
|
@ -1058,12 +1073,6 @@ void Filler::addViewStatistics() {
|
||||||
controller->showSection(Info::Boosts::Make(peer));
|
controller->showSection(Info::Boosts::Make(peer));
|
||||||
}
|
}
|
||||||
}, &st::menuIconBoosts);
|
}, &st::menuIconBoosts);
|
||||||
} else if (channel->isMegagroup()) {
|
|
||||||
_addAction(tr::lng_boost_group_button(tr::now), [=] {
|
|
||||||
if (const auto strong = weak.get()) {
|
|
||||||
controller->resolveBoostState(channel);
|
|
||||||
}
|
|
||||||
}, &st::menuIconBoosts);
|
|
||||||
}
|
}
|
||||||
if (canViewEarn) {
|
if (canViewEarn) {
|
||||||
_addAction(tr::lng_channel_earn_title(tr::now), [=] {
|
_addAction(tr::lng_channel_earn_title(tr::now), [=] {
|
||||||
|
@ -1312,6 +1321,7 @@ void Filler::fillHistoryActions() {
|
||||||
addStoryArchive();
|
addStoryArchive();
|
||||||
addSupportInfo();
|
addSupportInfo();
|
||||||
addManageChat();
|
addManageChat();
|
||||||
|
addBoostChat();
|
||||||
addCreatePoll();
|
addCreatePoll();
|
||||||
addThemeEdit();
|
addThemeEdit();
|
||||||
addViewDiscussion();
|
addViewDiscussion();
|
||||||
|
|
Loading…
Add table
Reference in a new issue