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