mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +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 addVideoChat();
|
||||
void addViewStatistics();
|
||||
void addBoostChat();
|
||||
|
||||
not_null<SessionController*> _controller;
|
||||
Dialogs::EntryState _request;
|
||||
|
@ -1034,6 +1035,20 @@ void Filler::addManageChat() {
|
|||
}, &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() {
|
||||
if (const auto channel = _peer->asChannel()) {
|
||||
const auto controller = _controller;
|
||||
|
@ -1058,12 +1073,6 @@ void Filler::addViewStatistics() {
|
|||
controller->showSection(Info::Boosts::Make(peer));
|
||||
}
|
||||
}, &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) {
|
||||
_addAction(tr::lng_channel_earn_title(tr::now), [=] {
|
||||
|
@ -1312,6 +1321,7 @@ void Filler::fillHistoryActions() {
|
|||
addStoryArchive();
|
||||
addSupportInfo();
|
||||
addManageChat();
|
||||
addBoostChat();
|
||||
addCreatePoll();
|
||||
addThemeEdit();
|
||||
addViewDiscussion();
|
||||
|
|
Loading…
Add table
Reference in a new issue