2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Show folder using slide animation.

This commit is contained in:
John Preston
2019-04-24 14:15:10 +04:00
parent 6dd8f32f66
commit f56df0e1d9
9 changed files with 720 additions and 601 deletions

View File

@@ -108,6 +108,16 @@ Controller::Controller(
Ui::show(Box<EditPeerInfoBox>(peer));
}
});
session->data().chatsListChanges(
) | rpl::filter([=](Data::Folder *folder) {
return (folder != nullptr)
&& (folder == _openedFolder.current())
&& folder->chatsList()->indexed(Global::DialogsMode())->empty();
}) | rpl::start_with_next([=](Data::Folder *folder) {
folder->updateChatListSortPosition();
closeFolder();
}, lifetime());
}
void Controller::showEditPeerBox(PeerData *peer) {
@@ -137,6 +147,24 @@ void Controller::initSupportMode() {
}, lifetime());
}
bool Controller::uniqueChatsInSearchResults() const {
return session().supportMode()
&& !session().settings().supportAllSearchResults()
&& !searchInChat.current();
}
void Controller::openFolder(not_null<Data::Folder*> folder) {
_openedFolder = folder.get();
}
void Controller::closeFolder() {
_openedFolder = nullptr;
}
const rpl::variable<Data::Folder*> &Controller::openedFolder() const {
return _openedFolder;
}
void Controller::setActiveChatEntry(Dialogs::RowDescriptor row) {
_activeChatEntry = row;
if (session().supportMode()) {

View File

@@ -150,8 +150,12 @@ public:
}
// This is needed for History TopBar updating when searchInChat
// is changed in the DialogsWidget of the current window.
// is changed in the Dialogs::Widget of the current window.
rpl::variable<Dialogs::Key> searchInChat;
bool uniqueChatsInSearchResults() const;
void openFolder(not_null<Data::Folder*> folder);
void closeFolder();
const rpl::variable<Data::Folder*> &openedFolder() const;
void setActiveChatEntry(Dialogs::RowDescriptor row);
void setActiveChatEntry(Dialogs::Key key);
@@ -304,6 +308,7 @@ private:
Media::Player::FloatDelegate *_replacementFloatPlayerDelegate = nullptr;
PeerData *_showEditPeer = nullptr;
rpl::variable<Data::Folder*> _openedFolder;
rpl::lifetime _lifetime;