mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix lock/unlock toggle without stories.
This commit is contained in:
parent
3851fa27d9
commit
6b4ccd2995
2 changed files with 19 additions and 9 deletions
|
@ -212,7 +212,9 @@ Widget::Widget(
|
||||||
_searchControls,
|
_searchControls,
|
||||||
object_ptr<Ui::IconButton>(this, st::dialogsCalendar))
|
object_ptr<Ui::IconButton>(this, st::dialogsCalendar))
|
||||||
, _cancelSearch(_searchControls, st::dialogsCancelSearch)
|
, _cancelSearch(_searchControls, st::dialogsCancelSearch)
|
||||||
, _lockUnlock(_searchControls, st::dialogsLock)
|
, _lockUnlock(
|
||||||
|
_searchControls,
|
||||||
|
object_ptr<Ui::IconButton>(this, st::dialogsLock))
|
||||||
, _scroll(this)
|
, _scroll(this)
|
||||||
, _scrollToTop(_scroll, st::dialogsToUp)
|
, _scrollToTop(_scroll, st::dialogsToUp)
|
||||||
, _stories((_layout != Layout::Child)
|
, _stories((_layout != Layout::Child)
|
||||||
|
@ -370,10 +372,13 @@ Widget::Widget(
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
updateLockUnlockVisibility();
|
updateLockUnlockVisibility();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
_lockUnlock->setClickedCallback([this] {
|
const auto lockUnlock = _lockUnlock->entity();
|
||||||
_lockUnlock->setIconOverride(&st::dialogsUnlockIcon, &st::dialogsUnlockIconOver);
|
lockUnlock->setClickedCallback([=] {
|
||||||
|
lockUnlock->setIconOverride(
|
||||||
|
&st::dialogsUnlockIcon,
|
||||||
|
&st::dialogsUnlockIconOver);
|
||||||
Core::App().maybeLockByPasscode();
|
Core::App().maybeLockByPasscode();
|
||||||
_lockUnlock->setIconOverride(nullptr);
|
lockUnlock->setIconOverride(nullptr);
|
||||||
});
|
});
|
||||||
|
|
||||||
setupMainMenuToggle();
|
setupMainMenuToggle();
|
||||||
|
@ -2273,6 +2278,7 @@ void Widget::applyFilterUpdate(bool force) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateLockUnlockVisibility(anim::type::normal);
|
||||||
updateStoriesVisibility();
|
updateStoriesVisibility();
|
||||||
const auto filterText = currentSearchQuery();
|
const auto filterText = currentSearchQuery();
|
||||||
_inner->applyFilterUpdate(filterText, force);
|
_inner->applyFilterUpdate(filterText, force);
|
||||||
|
@ -2607,7 +2613,7 @@ void Widget::resizeEvent(QResizeEvent *e) {
|
||||||
updateControlsGeometry();
|
updateControlsGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::updateLockUnlockVisibility() {
|
void Widget::updateLockUnlockVisibility(anim::type animated) {
|
||||||
if (_showAnimation) {
|
if (_showAnimation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2618,8 +2624,11 @@ void Widget::updateLockUnlockVisibility() {
|
||||||
|| _childList
|
|| _childList
|
||||||
|| !_filter->getLastText().isEmpty()
|
|| !_filter->getLastText().isEmpty()
|
||||||
|| _searchInChat;
|
|| _searchInChat;
|
||||||
if (_lockUnlock->isHidden() != hidden) {
|
if (_lockUnlock->toggled() == hidden) {
|
||||||
_lockUnlock->setVisible(!hidden);
|
const auto stories = _stories && !_stories->empty();
|
||||||
|
_lockUnlock->toggle(
|
||||||
|
!hidden,
|
||||||
|
stories ? anim::type::instant : animated);
|
||||||
if (!hidden) {
|
if (!hidden) {
|
||||||
updateLockUnlockPosition();
|
updateLockUnlockPosition();
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,8 @@ private:
|
||||||
void clearSearchCache();
|
void clearSearchCache();
|
||||||
void setSearchQuery(const QString &query);
|
void setSearchQuery(const QString &query);
|
||||||
void updateControlsVisibility(bool fast = false);
|
void updateControlsVisibility(bool fast = false);
|
||||||
void updateLockUnlockVisibility();
|
void updateLockUnlockVisibility(
|
||||||
|
anim::type animated = anim::type::instant);
|
||||||
void updateLoadMoreChatsVisibility();
|
void updateLoadMoreChatsVisibility();
|
||||||
void updateStoriesVisibility();
|
void updateStoriesVisibility();
|
||||||
void updateJumpToDateVisibility(bool fast = false);
|
void updateJumpToDateVisibility(bool fast = false);
|
||||||
|
@ -245,7 +246,7 @@ private:
|
||||||
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _chooseFromUser;
|
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _chooseFromUser;
|
||||||
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _jumpToDate;
|
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _jumpToDate;
|
||||||
object_ptr<Ui::CrossButton> _cancelSearch;
|
object_ptr<Ui::CrossButton> _cancelSearch;
|
||||||
object_ptr<Ui::IconButton> _lockUnlock;
|
object_ptr< Ui::FadeWrapScaled<Ui::IconButton>> _lockUnlock;
|
||||||
|
|
||||||
std::unique_ptr<Ui::MoreChatsBar> _moreChatsBar;
|
std::unique_ptr<Ui::MoreChatsBar> _moreChatsBar;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue