2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Allow archive with stories only.

This commit is contained in:
John Preston
2023-07-18 12:15:19 +04:00
parent 35214d108e
commit 4402cce928
17 changed files with 207 additions and 78 deletions

View File

@@ -572,7 +572,7 @@ void MainMenu::setupArchive() {
const auto checkArchive = [=] {
const auto f = folder();
return f
&& !f->chatsList()->empty()
&& (!f->chatsList()->empty() || f->storiesCount() > 0)
&& controller->session().settings().archiveInMainMenu();
};
@@ -650,10 +650,15 @@ void MainMenu::setupArchive() {
return Badge::UnreadBadge{ state.unreadCounter, true };
}));
controller->session().data().chatsListChanges(
) | rpl::filter([](Data::Folder *folder) {
return folder && (folder->id() == Data::Folder::kId);
}) | rpl::start_with_next([=] {
rpl::merge(
controller->session().data().chatsListChanges(
) | rpl::filter([](Data::Folder *folder) {
return folder && (folder->id() == Data::Folder::kId);
}) | rpl::to_empty,
controller->session().data().stories().sourcesChanged(
Data::StorySourcesList::Hidden
)
) | rpl::start_with_next([=] {
const auto isArchiveVisible = checkArchive();
wrap->toggle(isArchiveVisible, anim::type::normal);
if (!isArchiveVisible) {