mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-13 09:13:02 +02:00
Fix tabs transfer between chat widgets.
This commit is contained in:
parent
c3860cfe72
commit
853757e611
4 changed files with 31 additions and 2 deletions
|
@ -2474,6 +2474,7 @@ void HistoryWidget::showHistory(
|
|||
_silent.destroy();
|
||||
updateBotKeyboard();
|
||||
|
||||
_subsectionCheckLifetime.destroy();
|
||||
if (_subsectionTabs) {
|
||||
_subsectionTabsLifetime.destroy();
|
||||
controller()->saveSubsectionTabs(base::take(_subsectionTabs));
|
||||
|
@ -2623,7 +2624,6 @@ void HistoryWidget::showHistory(
|
|||
channel->flagsValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
refreshJoinChannelText();
|
||||
validateSubsectionTabs();
|
||||
}, _list->lifetime());
|
||||
} else {
|
||||
refreshJoinChannelText();
|
||||
|
@ -8245,6 +8245,21 @@ void HistoryWidget::showPremiumToast(not_null<DocumentData*> document) {
|
|||
}
|
||||
|
||||
void HistoryWidget::validateSubsectionTabs() {
|
||||
if (!_subsectionCheckLifetime
|
||||
&& _history
|
||||
&& _history->peer->isMegagroup()) {
|
||||
_subsectionCheckLifetime = _history->peer->asChannel()->flagsValue(
|
||||
) | rpl::skip(
|
||||
1
|
||||
) | rpl::filter([=](Data::Flags<ChannelDataFlags>::Change change) {
|
||||
const auto mask = ChannelDataFlag::Forum
|
||||
| ChannelDataFlag::ForumTabs
|
||||
| ChannelDataFlag::MonoforumAdmin;
|
||||
return change.diff & mask;
|
||||
}) | rpl::start_with_next([=] {
|
||||
validateSubsectionTabs();
|
||||
});
|
||||
}
|
||||
if (!_history || !HistoryView::SubsectionTabs::UsedFor(_history)) {
|
||||
if (_subsectionTabs) {
|
||||
_subsectionTabsLifetime.destroy();
|
||||
|
|
|
@ -829,6 +829,7 @@ private:
|
|||
std::unique_ptr<HistoryView::ComposeSearch> _composeSearch;
|
||||
std::unique_ptr<HistoryView::SubsectionTabs> _subsectionTabs;
|
||||
rpl::lifetime _subsectionTabsLifetime;
|
||||
rpl::lifetime _subsectionCheckLifetime;
|
||||
bool _cmdStartShown = false;
|
||||
object_ptr<Ui::InputField> _field;
|
||||
base::unique_qptr<Ui::RpWidget> _fieldDisabled;
|
||||
|
|
|
@ -928,7 +928,6 @@ void ChatWidget::setupComposeControls() {
|
|||
channel->flagsValue()
|
||||
) | rpl::start_with_next([=] {
|
||||
refreshJoinGroupButton();
|
||||
validateSubsectionTabs();
|
||||
}, lifetime());
|
||||
} else {
|
||||
refreshJoinGroupButton();
|
||||
|
@ -1522,6 +1521,19 @@ void ChatWidget::edit(
|
|||
}
|
||||
|
||||
void ChatWidget::validateSubsectionTabs() {
|
||||
if (!_subsectionCheckLifetime && _history->peer->isMegagroup()) {
|
||||
_subsectionCheckLifetime = _history->peer->asChannel()->flagsValue(
|
||||
) | rpl::skip(
|
||||
1
|
||||
) | rpl::filter([=](Data::Flags<ChannelDataFlags>::Change change) {
|
||||
const auto mask = ChannelDataFlag::Forum
|
||||
| ChannelDataFlag::ForumTabs
|
||||
| ChannelDataFlag::MonoforumAdmin;
|
||||
return change.diff & mask;
|
||||
}) | rpl::start_with_next([=] {
|
||||
validateSubsectionTabs();
|
||||
});
|
||||
}
|
||||
if (!HistoryView::SubsectionTabs::UsedFor(_history)) {
|
||||
if (_subsectionTabs) {
|
||||
_subsectionTabsLifetime.destroy();
|
||||
|
|
|
@ -409,6 +409,7 @@ private:
|
|||
std::unique_ptr<EmptyPainter> _emptyPainter;
|
||||
std::unique_ptr<SubsectionTabs> _subsectionTabs;
|
||||
rpl::lifetime _subsectionTabsLifetime;
|
||||
rpl::lifetime _subsectionCheckLifetime;
|
||||
bool _canSendTexts = false;
|
||||
bool _skipScrollEvent = false;
|
||||
bool _synteticScrollEvent = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue