Collapse stories on archive open/close.
This commit is contained in:
parent
9ccb11bd1a
commit
6e3c3a8dd2
|
@ -1075,19 +1075,52 @@ void Widget::changeOpenedFolder(Data::Folder *folder, anim::type animated) {
|
|||
cancelSearch();
|
||||
closeChildList(anim::type::instant);
|
||||
controller()->closeForum();
|
||||
const auto was = (_openedFolder != nullptr);
|
||||
_openedFolder = folder;
|
||||
_inner->changeOpenedFolder(folder);
|
||||
storiesToggleExplicitExpand(false);
|
||||
if (was != (_openedFolder != nullptr)) {
|
||||
using List = Data::StorySourcesList;
|
||||
_storiesContents.fire(Stories::ContentForSession(
|
||||
&controller()->session(),
|
||||
folder ? List::Hidden : List::NotHidden));
|
||||
if (_stories) {
|
||||
storiesExplicitCollapse();
|
||||
}
|
||||
}, (folder != nullptr), animated);
|
||||
}
|
||||
|
||||
void Widget::storiesExplicitCollapse() {
|
||||
if (_storiesExplicitExpand) {
|
||||
storiesToggleExplicitExpand(false);
|
||||
} else if (_stories) {
|
||||
using Type = Ui::ElasticScroll::OverscrollType;
|
||||
_scroll->setOverscrollDefaults(0, 0);
|
||||
_scroll->setOverscrollTypes(Type::None, Type::Real);
|
||||
_scroll->setOverscrollTypes(
|
||||
_stories->isHidden() ? Type::Real : Type::Virtual,
|
||||
Type::Real);
|
||||
}
|
||||
_storiesExplicitExpandAnimation.stop();
|
||||
_storiesExplicitExpandValue = 0;
|
||||
|
||||
using List = Data::StorySourcesList;
|
||||
collectStoriesUserpicsViews(_openedFolder
|
||||
? List::NotHidden
|
||||
: List::Hidden);
|
||||
_storiesContents.fire(Stories::ContentForSession(
|
||||
&session(),
|
||||
_openedFolder ? List::Hidden : List::NotHidden));
|
||||
}
|
||||
|
||||
void Widget::collectStoriesUserpicsViews(Data::StorySourcesList list) {
|
||||
auto &map = (list == Data::StorySourcesList::Hidden)
|
||||
? _storiesUserpicsViewsHidden
|
||||
: _storiesUserpicsViewsShown;
|
||||
map.clear();
|
||||
auto &owner = session().data();
|
||||
for (const auto &source : owner.stories().sources(list)) {
|
||||
if (const auto peer = owner.peerLoaded(source.id)) {
|
||||
if (auto view = peer->activeUserpicView(); view.cloud) {
|
||||
map.emplace(source.id, std::move(view));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::changeOpenedForum(Data::Forum *forum, anim::type animated) {
|
||||
if (_openedForum == forum) {
|
||||
return;
|
||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "dialogs/dialogs_key.h"
|
||||
#include "window/section_widget.h"
|
||||
#include "ui/effects/animations.h"
|
||||
#include "ui/userpic_view.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "api/api_single_message_search.h"
|
||||
|
||||
|
@ -20,6 +21,7 @@ class Error;
|
|||
|
||||
namespace Data {
|
||||
class Forum;
|
||||
enum class StorySourcesList : uchar;
|
||||
} // namespace Data
|
||||
|
||||
namespace Main {
|
||||
|
@ -168,6 +170,8 @@ private:
|
|||
void setupDownloadBar();
|
||||
void setupShortcuts();
|
||||
void setupStories();
|
||||
void storiesExplicitCollapse();
|
||||
void collectStoriesUserpicsViews(Data::StorySourcesList list);
|
||||
void storiesToggleExplicitExpand(bool expand);
|
||||
void trackScroll(not_null<Ui::RpWidget*> widget);
|
||||
[[nodiscard]] bool searchForPeersRequired(const QString &query) const;
|
||||
|
@ -281,6 +285,8 @@ private:
|
|||
QString _lastFilterText;
|
||||
|
||||
rpl::event_stream<rpl::producer<Stories::Content>> _storiesContents;
|
||||
base::flat_map<PeerId, Ui::PeerUserpicView> _storiesUserpicsViewsHidden;
|
||||
base::flat_map<PeerId, Ui::PeerUserpicView> _storiesUserpicsViewsShown;
|
||||
Fn<void()> _updateScrollGeometryCached;
|
||||
std::unique_ptr<Stories::List> _stories;
|
||||
Ui::Animations::Simple _storiesExplicitExpandAnimation;
|
||||
|
|
|
@ -622,6 +622,7 @@ void List::mousePressEvent(QMouseEvent *e) {
|
|||
return;
|
||||
} else if (_state == State::Small) {
|
||||
requestExpanded(true);
|
||||
return;
|
||||
} else if (_state != State::Full) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 74be75339d474df1a2863028ec146744597bd0bb
|
||||
Subproject commit 2669a04579069942b6208a18abe93c26adfddf2a
|
|
@ -1 +1 @@
|
|||
Subproject commit 8f03125ec1d6b0f4a3f0fe6b6849aa57a1006063
|
||||
Subproject commit 288bec7157bf654d121ebfd2828801b49beb34ec
|
|
@ -1 +1 @@
|
|||
Subproject commit ec24c7a96036268b2024ca9765a66c63e6b8396a
|
||||
Subproject commit ebb8b8b91fe357b2c397a3eb98655c585b8c856e
|
Loading…
Reference in New Issue