Put archive action on top of the menu.

This commit is contained in:
John Preston 2019-05-01 17:10:11 +04:00
parent 9b430147c0
commit 5f1cb9d31c

View file

@ -56,7 +56,8 @@ public:
private: private:
bool showInfo(); bool showInfo();
bool showToggleArchived(); bool showToggleArchived();
void addPinToggle(); bool showTogglePin();
void addTogglePin();
void addInfo(); void addInfo();
//void addSearch(); //void addSearch();
void addToggleUnreadMark(); void addToggleUnreadMark();
@ -84,7 +85,7 @@ public:
private: private:
//bool showInfo(); //bool showInfo();
//void addPinToggle(); //void addTogglePin();
//void addInfo(); //void addInfo();
//void addSearch(); //void addSearch();
//void addNotifications(); //void addNotifications();
@ -210,7 +211,15 @@ bool Filler::showToggleArchived() {
return history && (history->folder() != nullptr); return history && (history->folder() != nullptr);
} }
void Filler::addPinToggle() { bool Filler::showTogglePin() {
if (_source != PeerMenuSource::ChatsList) {
return false;
}
const auto history = _peer->owner().historyLoaded(_peer);
return history && !history->fixedOnTopIndex();
}
void Filler::addTogglePin() {
auto peer = _peer; auto peer = _peer;
auto isPinned = false; auto isPinned = false;
if (auto history = peer->owner().historyLoaded(peer)) { if (auto history = peer->owner().historyLoaded(peer)) {
@ -495,12 +504,11 @@ void Filler::addChannelActions(not_null<ChannelData*> channel) {
} }
void Filler::fill() { void Filler::fill() {
if (_source == PeerMenuSource::ChatsList) { if (showToggleArchived()) {
if (const auto history = _peer->owner().historyLoaded(_peer)) { addToggleArchive();
if (!history->fixedOnTopIndex()) {
addPinToggle();
}
} }
if (showTogglePin()) {
addTogglePin();
} }
if (showInfo()) { if (showInfo()) {
addInfo(); addInfo();
@ -520,9 +528,6 @@ void Filler::fill() {
} else if (const auto channel = _peer->asChannel()) { } else if (const auto channel = _peer->asChannel()) {
addChannelActions(channel); addChannelActions(channel);
} }
if (showToggleArchived()) {
addToggleArchive();
}
} }
FolderFiller::FolderFiller( FolderFiller::FolderFiller(
@ -538,7 +543,7 @@ FolderFiller::FolderFiller(
void FolderFiller::fill() { // #TODO archive void FolderFiller::fill() { // #TODO archive
//if (_source == PeerMenuSource::ChatsList) { //if (_source == PeerMenuSource::ChatsList) {
// addPinToggle(); // addTogglePin();
//} //}
//if (showInfo()) { //if (showInfo()) {
// addInfo(); // addInfo();
@ -565,7 +570,7 @@ void FolderFiller::fill() { // #TODO archive
// return false; // return false;
//} //}
// //
//void FolderFiller::addPinToggle() { //void FolderFiller::addTogglePin() {
// const auto feed = _feed; // const auto feed = _feed;
// const auto isPinned = feed->isPinnedDialog(); // const auto isPinned = feed->isPinnedDialog();
// const auto pinText = [](bool isPinned) { // const auto pinText = [](bool isPinned) {