chore: hide annoying gift button

This commit is contained in:
AlexeyZavar 2025-02-14 02:07:32 +03:00
parent 451940e6a7
commit ee0238bad8
2 changed files with 8 additions and 2 deletions

View file

@ -1090,15 +1090,19 @@ void HistoryWidget::refreshJoinChannelText() {
} }
void HistoryWidget::refreshGiftToChannelShown() { void HistoryWidget::refreshGiftToChannelShown() {
if (!_giftToChannelIn || !_giftToChannelOut) { if (!_giftToChannelIn || !_giftToChannelOut || !_giftToChannelDiscuss) {
return; return;
} }
// AyuGram: hide gift button almost everywhere
// still accessible via the menu in peer window
const auto channel = _peer->asChannel(); const auto channel = _peer->asChannel();
const auto shown = channel const auto shown = channel
&& channel->isBroadcast() && channel->isBroadcast()
&& channel->stargiftsAvailable(); && channel->stargiftsAvailable()
&& isExteraPeer(getBareID(channel));
_giftToChannelIn->setVisible(shown); _giftToChannelIn->setVisible(shown);
_giftToChannelOut->setVisible(shown); _giftToChannelOut->setVisible(shown);
_giftToChannelDiscuss->setVisible(shown);
} }
void HistoryWidget::refreshTopBarActiveChat() { void HistoryWidget::refreshTopBarActiveChat() {
@ -2144,6 +2148,7 @@ void HistoryWidget::setupGiftToChannelButton() {
}; };
_giftToChannelIn = setupButton(_muteUnmute); _giftToChannelIn = setupButton(_muteUnmute);
_giftToChannelOut = setupButton(_joinChannel); _giftToChannelOut = setupButton(_joinChannel);
_giftToChannelDiscuss = setupButton(_discuss);
} }
void HistoryWidget::pushReplyReturn(not_null<HistoryItem*> item) { void HistoryWidget::pushReplyReturn(not_null<HistoryItem*> item) {

View file

@ -781,6 +781,7 @@ private:
object_ptr<Ui::FlatButton> _muteUnmute; object_ptr<Ui::FlatButton> _muteUnmute;
QPointer<Ui::IconButton> _giftToChannelIn; QPointer<Ui::IconButton> _giftToChannelIn;
QPointer<Ui::IconButton> _giftToChannelOut; QPointer<Ui::IconButton> _giftToChannelOut;
QPointer<Ui::IconButton> _giftToChannelDiscuss;
object_ptr<Ui::FlatButton> _discuss; object_ptr<Ui::FlatButton> _discuss;
object_ptr<Ui::FlatButton> _reportMessages; object_ptr<Ui::FlatButton> _reportMessages;
struct { struct {