mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Collapse stories on archive open/close.
This commit is contained in:
parent
9ccb11bd1a
commit
6e3c3a8dd2
6 changed files with 50 additions and 10 deletions
|
@ -1075,19 +1075,52 @@ void Widget::changeOpenedFolder(Data::Folder *folder, anim::type animated) {
|
||||||
cancelSearch();
|
cancelSearch();
|
||||||
closeChildList(anim::type::instant);
|
closeChildList(anim::type::instant);
|
||||||
controller()->closeForum();
|
controller()->closeForum();
|
||||||
const auto was = (_openedFolder != nullptr);
|
|
||||||
_openedFolder = folder;
|
_openedFolder = folder;
|
||||||
_inner->changeOpenedFolder(folder);
|
_inner->changeOpenedFolder(folder);
|
||||||
storiesToggleExplicitExpand(false);
|
if (_stories) {
|
||||||
if (was != (_openedFolder != nullptr)) {
|
storiesExplicitCollapse();
|
||||||
using List = Data::StorySourcesList;
|
|
||||||
_storiesContents.fire(Stories::ContentForSession(
|
|
||||||
&controller()->session(),
|
|
||||||
folder ? List::Hidden : List::NotHidden));
|
|
||||||
}
|
}
|
||||||
}, (folder != nullptr), animated);
|
}, (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) {
|
void Widget::changeOpenedForum(Data::Forum *forum, anim::type animated) {
|
||||||
if (_openedForum == forum) {
|
if (_openedForum == forum) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "dialogs/dialogs_key.h"
|
#include "dialogs/dialogs_key.h"
|
||||||
#include "window/section_widget.h"
|
#include "window/section_widget.h"
|
||||||
#include "ui/effects/animations.h"
|
#include "ui/effects/animations.h"
|
||||||
|
#include "ui/userpic_view.h"
|
||||||
#include "mtproto/sender.h"
|
#include "mtproto/sender.h"
|
||||||
#include "api/api_single_message_search.h"
|
#include "api/api_single_message_search.h"
|
||||||
|
|
||||||
|
@ -20,6 +21,7 @@ class Error;
|
||||||
|
|
||||||
namespace Data {
|
namespace Data {
|
||||||
class Forum;
|
class Forum;
|
||||||
|
enum class StorySourcesList : uchar;
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
||||||
namespace Main {
|
namespace Main {
|
||||||
|
@ -168,6 +170,8 @@ private:
|
||||||
void setupDownloadBar();
|
void setupDownloadBar();
|
||||||
void setupShortcuts();
|
void setupShortcuts();
|
||||||
void setupStories();
|
void setupStories();
|
||||||
|
void storiesExplicitCollapse();
|
||||||
|
void collectStoriesUserpicsViews(Data::StorySourcesList list);
|
||||||
void storiesToggleExplicitExpand(bool expand);
|
void storiesToggleExplicitExpand(bool expand);
|
||||||
void trackScroll(not_null<Ui::RpWidget*> widget);
|
void trackScroll(not_null<Ui::RpWidget*> widget);
|
||||||
[[nodiscard]] bool searchForPeersRequired(const QString &query) const;
|
[[nodiscard]] bool searchForPeersRequired(const QString &query) const;
|
||||||
|
@ -281,6 +285,8 @@ private:
|
||||||
QString _lastFilterText;
|
QString _lastFilterText;
|
||||||
|
|
||||||
rpl::event_stream<rpl::producer<Stories::Content>> _storiesContents;
|
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;
|
Fn<void()> _updateScrollGeometryCached;
|
||||||
std::unique_ptr<Stories::List> _stories;
|
std::unique_ptr<Stories::List> _stories;
|
||||||
Ui::Animations::Simple _storiesExplicitExpandAnimation;
|
Ui::Animations::Simple _storiesExplicitExpandAnimation;
|
||||||
|
|
|
@ -622,6 +622,7 @@ void List::mousePressEvent(QMouseEvent *e) {
|
||||||
return;
|
return;
|
||||||
} else if (_state == State::Small) {
|
} else if (_state == State::Small) {
|
||||||
requestExpanded(true);
|
requestExpanded(true);
|
||||||
|
return;
|
||||||
} else if (_state != State::Full) {
|
} else if (_state != State::Full) {
|
||||||
return;
|
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…
Add table
Reference in a new issue