mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Comment out non-folder feed code.
This commit is contained in:
parent
905a024aed
commit
9bf8a8108d
57 changed files with 1392 additions and 1459 deletions
|
@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_photo.h"
|
||||
#include "data/data_web_page.h"
|
||||
#include "data/data_poll.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_sparse_ids.h"
|
||||
#include "data/data_search_controller.h"
|
||||
|
@ -32,7 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history.h"
|
||||
#include "history/history_message.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/feed/history_feed_section.h"
|
||||
//#include "history/feed/history_feed_section.h" // #feed
|
||||
#include "storage/localstorage.h"
|
||||
#include "auth_session.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
|
@ -55,7 +55,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/storage_shared_media.h"
|
||||
#include "storage/storage_user_photos.h"
|
||||
#include "storage/storage_media_prepare.h"
|
||||
#include "storage/storage_feed_messages.h"
|
||||
//#include "storage/storage_feed_messages.h" // #feed
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -82,10 +82,10 @@ constexpr auto kUnreadMentionsPreloadIfLess = 5;
|
|||
constexpr auto kUnreadMentionsFirstRequestLimit = 10;
|
||||
constexpr auto kUnreadMentionsNextRequestLimit = 100;
|
||||
constexpr auto kSharedMediaLimit = 100;
|
||||
constexpr auto kFeedMessagesLimit = 50;
|
||||
//constexpr auto kFeedMessagesLimit = 50; // #feed
|
||||
constexpr auto kReadFeaturedSetsTimeout = crl::time(1000);
|
||||
constexpr auto kFileLoaderQueueStopTimeout = crl::time(5000);
|
||||
constexpr auto kFeedReadTimeout = crl::time(1000);
|
||||
//constexpr auto kFeedReadTimeout = crl::time(1000); // #feed
|
||||
constexpr auto kStickersByEmojiInvalidateTimeout = crl::time(60 * 60 * 1000);
|
||||
constexpr auto kNotifySettingSaveTimeout = crl::time(1000);
|
||||
|
||||
|
@ -190,7 +190,7 @@ ApiWrap::ApiWrap(not_null<AuthSession*> session)
|
|||
, _draftsSaveTimer([=] { saveDraftsToCloud(); })
|
||||
, _featuredSetsReadTimer([=] { readFeaturedSets(); })
|
||||
, _fileLoader(std::make_unique<TaskQueue>(kFileLoaderQueueStopTimeout))
|
||||
, _feedReadTimer([=] { readFeeds(); })
|
||||
//, _feedReadTimer([=] { readFeeds(); }) // #feed
|
||||
, _proxyPromotionTimer([=] { refreshProxyPromotion(); })
|
||||
, _updateNotifySettingsTimer([=] { sendNotifySettingsUpdates(); }) {
|
||||
crl::on_main([=] {
|
||||
|
@ -421,8 +421,8 @@ void ApiWrap::savePinnedOrder() {
|
|||
for (const auto &pinned : ranges::view::reverse(order)) {
|
||||
if (const auto history = pinned.history()) {
|
||||
peers.push_back(MTP_inputDialogPeer(history->peer->input));
|
||||
} else if (const auto feed = pinned.feed()) {
|
||||
// peers.push_back(MTP_inputDialogPeerFeed(MTP_int(feed->id()))); // #feed
|
||||
// } else if (const auto feed = pinned.feed()) { // #feed
|
||||
// peers.push_back(MTP_inputDialogPeerFeed(MTP_int(feed->id())));
|
||||
}
|
||||
}
|
||||
const auto folderId = 0;
|
||||
|
@ -686,23 +686,23 @@ void ApiWrap::requestContacts() {
|
|||
}).send();
|
||||
}
|
||||
|
||||
void ApiWrap::requestDialogEntry(not_null<Data::Feed*> feed) {
|
||||
if (_dialogFeedRequests.contains(feed)) {
|
||||
void ApiWrap::requestDialogEntry(not_null<Data::Folder*> folder) {
|
||||
if (_dialogFolderRequests.contains(folder)) {
|
||||
return;
|
||||
}
|
||||
_dialogFeedRequests.emplace(feed);
|
||||
_dialogFolderRequests.emplace(folder);
|
||||
|
||||
//auto peers = QVector<MTPInputDialogPeer>( // #feed
|
||||
// 1,
|
||||
// MTP_inputDialogPeerFeed(MTP_int(feed->id())));
|
||||
//request(MTPmessages_GetPeerDialogs(
|
||||
// MTP_vector(std::move(peers))
|
||||
//)).done([=](const MTPmessages_PeerDialogs &result) {
|
||||
// applyPeerDialogs(result);
|
||||
// _dialogFeedRequests.remove(feed);
|
||||
//}).fail([=](const RPCError &error) {
|
||||
// _dialogFeedRequests.remove(feed);
|
||||
//}).send();
|
||||
auto peers = QVector<MTPInputDialogPeer>(
|
||||
1,
|
||||
MTP_inputDialogPeerFolder(MTP_int(folder->id())));
|
||||
request(MTPmessages_GetPeerDialogs(
|
||||
MTP_vector(std::move(peers))
|
||||
)).done([=](const MTPmessages_PeerDialogs &result) {
|
||||
applyPeerDialogs(result);
|
||||
_dialogFolderRequests.remove(folder);
|
||||
}).fail([=](const RPCError &error) {
|
||||
_dialogFolderRequests.remove(folder);
|
||||
}).send();
|
||||
}
|
||||
|
||||
//void ApiWrap::requestFeedDialogsEntries(not_null<Data::Feed*> feed) {
|
||||
|
@ -813,63 +813,56 @@ void ApiWrap::applyPeerDialogs(const MTPmessages_PeerDialogs &dialogs) {
|
|||
_session->data().processChats(data.vchats);
|
||||
App::feedMsgs(data.vmessages, NewMessageLast);
|
||||
for (const auto &dialog : data.vdialogs.v) {
|
||||
switch (dialog.type()) {
|
||||
case mtpc_dialog: {
|
||||
const auto &fields = dialog.c_dialog();
|
||||
if (const auto peerId = peerFromMTP(fields.vpeer)) {
|
||||
_session->data().history(peerId)->applyDialog(fields);
|
||||
dialog.match([&](const MTPDdialog &data) {
|
||||
if (const auto peerId = peerFromMTP(data.vpeer)) {
|
||||
_session->data().history(peerId)->applyDialog(data);
|
||||
}
|
||||
} break;
|
||||
|
||||
//case mtpc_dialogFeed: { // #feed
|
||||
// const auto &fields = dialog.c_dialogFeed();
|
||||
// const auto feed = _session->data().feed(fields.vfeed_id.v);
|
||||
// feed->applyDialog(fields);
|
||||
//} break;
|
||||
}
|
||||
}, [&](const MTPDdialogFolder &data) { // #TODO archive
|
||||
//const auto folder = _session->data().processFolder(data.vfolder);
|
||||
//folder->applyDialog(data);
|
||||
});
|
||||
}
|
||||
_session->data().sendHistoryChangeNotifications();
|
||||
}
|
||||
|
||||
void ApiWrap::applyFeedDialogs(
|
||||
not_null<Data::Feed*> feed,
|
||||
const MTPmessages_Dialogs &dialogs) {
|
||||
if (dialogs.type() == mtpc_messages_dialogsNotModified) {
|
||||
LOG(("API Error: "
|
||||
"messages.dialogsNotModified in ApiWrap::applyFeedDialogs."));
|
||||
return;
|
||||
}
|
||||
// #TODO folders
|
||||
auto channels = std::vector<not_null<ChannelData*>>();
|
||||
dialogs.match([&](const MTPDmessages_dialogsNotModified &) {
|
||||
Unexpected("Type in ApiWrap::applyFeedDialogs.");
|
||||
}, [&](const auto &data) {
|
||||
_session->data().processUsers(data.vusers);
|
||||
_session->data().processChats(data.vchats);
|
||||
App::feedMsgs(data.vmessages.v, NewMessageLast);
|
||||
channels.reserve(data.vdialogs.v.size());
|
||||
for (const auto &dialog : data.vdialogs.v) {
|
||||
dialog.match([&](const MTPDdialog &data) {
|
||||
if (const auto peerId = peerFromMTP(data.vpeer)) {
|
||||
if (peerIsChannel(peerId)) {
|
||||
const auto history = _session->data().history(peerId);
|
||||
history->applyDialog(dialog.c_dialog());
|
||||
channels.emplace_back(history->peer->asChannel());
|
||||
} else {
|
||||
LOG(("API Error: "
|
||||
"Unexpected peer in folder dialogs list."));
|
||||
}
|
||||
}
|
||||
}, [&](const MTPDdialogFolder &data) {
|
||||
LOG(("API Error: "
|
||||
"Unexpected dialogFolder in folder dialogs list."));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
feed->setChannels(channels);
|
||||
_session->data().sendHistoryChangeNotifications();
|
||||
}
|
||||
// // #feed
|
||||
//void ApiWrap::applyFeedDialogs(
|
||||
// not_null<Data::Feed*> feed,
|
||||
// const MTPmessages_Dialogs &dialogs) {
|
||||
// if (dialogs.type() == mtpc_messages_dialogsNotModified) {
|
||||
// LOG(("API Error: "
|
||||
// "messages.dialogsNotModified in ApiWrap::applyFeedDialogs."));
|
||||
// return;
|
||||
// }
|
||||
// auto channels = std::vector<not_null<ChannelData*>>();
|
||||
// dialogs.match([&](const MTPDmessages_dialogsNotModified &) {
|
||||
// Unexpected("Type in ApiWrap::applyFeedDialogs.");
|
||||
// }, [&](const auto &data) {
|
||||
// _session->data().processUsers(data.vusers);
|
||||
// _session->data().processChats(data.vchats);
|
||||
// App::feedMsgs(data.vmessages.v, NewMessageLast);
|
||||
// channels.reserve(data.vdialogs.v.size());
|
||||
// for (const auto &dialog : data.vdialogs.v) {
|
||||
// dialog.match([&](const MTPDdialog &data) {
|
||||
// if (const auto peerId = peerFromMTP(data.vpeer)) {
|
||||
// if (peerIsChannel(peerId)) { // #TODO archive
|
||||
// const auto history = _session->data().history(peerId);
|
||||
// history->applyDialog(data);
|
||||
// channels.emplace_back(history->peer->asChannel());
|
||||
// } else {
|
||||
// LOG(("API Error: "
|
||||
// "Unexpected peer in folder dialogs list."));
|
||||
// }
|
||||
// }
|
||||
// }, [&](const MTPDdialogFolder &data) {
|
||||
// LOG(("API Error: "
|
||||
// "Unexpected dialogFolder in folder dialogs list."));
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// feed->setChannels(channels);
|
||||
// _session->data().sendHistoryChangeNotifications();
|
||||
//}
|
||||
|
||||
void ApiWrap::changeDialogUnreadMark(
|
||||
not_null<History*> history,
|
||||
|
@ -1539,8 +1532,7 @@ void ApiWrap::applyLastParticipantsList(
|
|||
channel->mgInfo->creator = user;
|
||||
if (!channel->mgInfo->admins.empty()
|
||||
&& !channel->mgInfo->admins.contains(userId)) {
|
||||
Data::ChannelAdminChanges changes(channel);
|
||||
changes.feed(userId, true);
|
||||
Data::ChannelAdminChanges(channel).feed(userId, true);
|
||||
}
|
||||
}
|
||||
if (!base::contains(channel->mgInfo->lastParticipants, user)) {
|
||||
|
@ -3651,8 +3643,8 @@ void ApiWrap::applyUpdateNoPtsCheck(const MTPUpdate &update) {
|
|||
void ApiWrap::jumpToDate(Dialogs::Key chat, const QDate &date) {
|
||||
if (const auto peer = chat.peer()) {
|
||||
jumpToHistoryDate(peer, date);
|
||||
} else if (const auto feed = chat.feed()) {
|
||||
jumpToFeedDate(feed, date);
|
||||
//} else if (const auto feed = chat.feed()) { // #feed
|
||||
// jumpToFeedDate(feed, date);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3746,64 +3738,64 @@ void ApiWrap::jumpToHistoryDate(not_null<PeerData*> peer, const QDate &date) {
|
|||
jumpToDateInPeer();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Callback>
|
||||
void ApiWrap::requestMessageAfterDate(
|
||||
not_null<Data::Feed*> feed,
|
||||
const QDate &date,
|
||||
Callback &&callback) {
|
||||
const auto offsetId = 0;
|
||||
const auto offsetDate = static_cast<TimeId>(QDateTime(date).toTime_t());
|
||||
const auto addOffset = -2;
|
||||
const auto limit = 1;
|
||||
const auto hash = 0;
|
||||
//request(MTPchannels_GetFeed( // #feed
|
||||
// MTP_flags(MTPchannels_GetFeed::Flag::f_offset_position),
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_feedPosition(
|
||||
// MTP_int(offsetDate),
|
||||
// MTP_peerUser(MTP_int(_session->userId())),
|
||||
// MTP_int(0)),
|
||||
// MTP_int(addOffset),
|
||||
// MTP_int(limit),
|
||||
// MTPfeedPosition(), // max_id
|
||||
// MTPfeedPosition(), // min_id
|
||||
// MTP_int(hash)
|
||||
//)).done([
|
||||
// =,
|
||||
// callback = std::forward<Callback>(callback)
|
||||
//](const MTPmessages_FeedMessages &result) {
|
||||
// if (result.type() == mtpc_messages_feedMessagesNotModified) {
|
||||
// LOG(("API Error: "
|
||||
// "Unexpected messages.feedMessagesNotModified."));
|
||||
// callback(Data::UnreadMessagePosition);
|
||||
// return;
|
||||
// }
|
||||
// Assert(result.type() == mtpc_messages_feedMessages);
|
||||
// const auto &data = result.c_messages_feedMessages();
|
||||
// const auto &messages = data.vmessages.v;
|
||||
// const auto type = NewMessageExisting;
|
||||
// _session->data().processUsers(data.vusers);
|
||||
// _session->data().processChats(data.vchats);
|
||||
// for (const auto &msg : messages) {
|
||||
// if (const auto item = _session->data().addNewMessage(msg, type)) {
|
||||
// if (item->date() >= offsetDate || true) {
|
||||
// callback(item->position());
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// callback(Data::UnreadMessagePosition);
|
||||
//}).send();
|
||||
}
|
||||
|
||||
void ApiWrap::jumpToFeedDate(not_null<Data::Feed*> feed, const QDate &date) {
|
||||
requestMessageAfterDate(feed, date, [=](Data::MessagePosition result) {
|
||||
Ui::hideLayer();
|
||||
App::wnd()->controller()->showSection(
|
||||
HistoryFeed::Memento(feed, result));
|
||||
});
|
||||
}
|
||||
// // #feed
|
||||
//template <typename Callback>
|
||||
//void ApiWrap::requestMessageAfterDate(
|
||||
// not_null<Data::Feed*> feed,
|
||||
// const QDate &date,
|
||||
// Callback &&callback) {
|
||||
// const auto offsetId = 0;
|
||||
// const auto offsetDate = static_cast<TimeId>(QDateTime(date).toTime_t());
|
||||
// const auto addOffset = -2;
|
||||
// const auto limit = 1;
|
||||
// const auto hash = 0;
|
||||
// request(MTPchannels_GetFeed(
|
||||
// MTP_flags(MTPchannels_GetFeed::Flag::f_offset_position),
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_feedPosition(
|
||||
// MTP_int(offsetDate),
|
||||
// MTP_peerUser(MTP_int(_session->userId())),
|
||||
// MTP_int(0)),
|
||||
// MTP_int(addOffset),
|
||||
// MTP_int(limit),
|
||||
// MTPfeedPosition(), // max_id
|
||||
// MTPfeedPosition(), // min_id
|
||||
// MTP_int(hash)
|
||||
// )).done([
|
||||
// =,
|
||||
// callback = std::forward<Callback>(callback)
|
||||
// ](const MTPmessages_FeedMessages &result) {
|
||||
// if (result.type() == mtpc_messages_feedMessagesNotModified) {
|
||||
// LOG(("API Error: "
|
||||
// "Unexpected messages.feedMessagesNotModified."));
|
||||
// callback(Data::UnreadMessagePosition);
|
||||
// return;
|
||||
// }
|
||||
// Assert(result.type() == mtpc_messages_feedMessages);
|
||||
// const auto &data = result.c_messages_feedMessages();
|
||||
// const auto &messages = data.vmessages.v;
|
||||
// const auto type = NewMessageExisting;
|
||||
// _session->data().processUsers(data.vusers);
|
||||
// _session->data().processChats(data.vchats);
|
||||
// for (const auto &msg : messages) {
|
||||
// if (const auto item = _session->data().addNewMessage(msg, type)) {
|
||||
// if (item->date() >= offsetDate || true) {
|
||||
// callback(item->position());
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// callback(Data::UnreadMessagePosition);
|
||||
// }).send();
|
||||
//}
|
||||
//
|
||||
//void ApiWrap::jumpToFeedDate(not_null<Data::Feed*> feed, const QDate &date) {
|
||||
// requestMessageAfterDate(feed, date, [=](Data::MessagePosition result) {
|
||||
// Ui::hideLayer();
|
||||
// App::wnd()->controller()->showSection(
|
||||
// HistoryFeed::Memento(feed, result));
|
||||
// });
|
||||
//}
|
||||
|
||||
void ApiWrap::preloadEnoughUnreadMentions(not_null<History*> history) {
|
||||
auto fullCount = history->getUnreadMentionsCount();
|
||||
|
@ -5849,59 +5841,59 @@ void ApiWrap::readServerHistoryForce(not_null<History*> history) {
|
|||
sendReadRequest(peer, upTo);
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::readFeed(
|
||||
not_null<Data::Feed*> feed,
|
||||
Data::MessagePosition position) {
|
||||
const auto already = feed->unreadPosition();
|
||||
if (already && already >= position) {
|
||||
return;
|
||||
}
|
||||
feed->setUnreadPosition(position);
|
||||
if (!_feedReadsDelayed.contains(feed)) {
|
||||
if (_feedReadsDelayed.empty()) {
|
||||
_feedReadTimer.callOnce(kFeedReadTimeout);
|
||||
}
|
||||
_feedReadsDelayed.emplace(feed, crl::now() + kFeedReadTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
void ApiWrap::readFeeds() {
|
||||
auto delay = kFeedReadTimeout;
|
||||
const auto now = crl::now();
|
||||
//for (auto i = begin(_feedReadsDelayed); i != end(_feedReadsDelayed);) { // #feed
|
||||
// const auto feed = i->first;
|
||||
// const auto time = i->second;
|
||||
// // Clang fails to capture structure-binded feed to lambda :(
|
||||
// //const auto [feed, time] = *i;
|
||||
// if (time > now) {
|
||||
// accumulate_min(delay, time - now);
|
||||
// ++i;
|
||||
// } else if (_feedReadRequests.contains(feed)) {
|
||||
// ++i;
|
||||
// } else {
|
||||
// const auto position = feed->unreadPosition();
|
||||
// const auto requestId = request(MTPchannels_ReadFeed(
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_feedPosition(
|
||||
// MTP_int(position.date),
|
||||
// MTP_peerChannel(MTP_int(position.fullId.channel)),
|
||||
// MTP_int(position.fullId.msg))
|
||||
// )).done([=](const MTPUpdates &result) {
|
||||
// applyUpdates(result);
|
||||
// _feedReadRequests.remove(feed);
|
||||
// }).fail([=](const RPCError &error) {
|
||||
// _feedReadRequests.remove(feed);
|
||||
// }).send();
|
||||
// _feedReadRequests.emplace(feed, requestId);
|
||||
|
||||
// i = _feedReadsDelayed.erase(i);
|
||||
// }
|
||||
//}
|
||||
//if (!_feedReadsDelayed.empty()) {
|
||||
// _feedReadTimer.callOnce(delay);
|
||||
//}
|
||||
}
|
||||
// // #feed
|
||||
//void ApiWrap::readFeed(
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Data::MessagePosition position) {
|
||||
// const auto already = feed->unreadPosition();
|
||||
// if (already && already >= position) {
|
||||
// return;
|
||||
// }
|
||||
// feed->setUnreadPosition(position);
|
||||
// if (!_feedReadsDelayed.contains(feed)) {
|
||||
// if (_feedReadsDelayed.empty()) {
|
||||
// _feedReadTimer.callOnce(kFeedReadTimeout);
|
||||
// }
|
||||
// _feedReadsDelayed.emplace(feed, crl::now() + kFeedReadTimeout);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void ApiWrap::readFeeds() {
|
||||
// auto delay = kFeedReadTimeout;
|
||||
// const auto now = crl::now();
|
||||
// for (auto i = begin(_feedReadsDelayed); i != end(_feedReadsDelayed);) {
|
||||
// const auto feed = i->first;
|
||||
// const auto time = i->second;
|
||||
// // Clang fails to capture structure-binded feed to lambda :(
|
||||
// //const auto [feed, time] = *i;
|
||||
// if (time > now) {
|
||||
// accumulate_min(delay, time - now);
|
||||
// ++i;
|
||||
// } else if (_feedReadRequests.contains(feed)) {
|
||||
// ++i;
|
||||
// } else {
|
||||
// const auto position = feed->unreadPosition();
|
||||
// const auto requestId = request(MTPchannels_ReadFeed(
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_feedPosition(
|
||||
// MTP_int(position.date),
|
||||
// MTP_peerChannel(MTP_int(position.fullId.channel)),
|
||||
// MTP_int(position.fullId.msg))
|
||||
// )).done([=](const MTPUpdates &result) {
|
||||
// applyUpdates(result);
|
||||
// _feedReadRequests.remove(feed);
|
||||
// }).fail([=](const RPCError &error) {
|
||||
// _feedReadRequests.remove(feed);
|
||||
// }).send();
|
||||
// _feedReadRequests.emplace(feed, requestId);
|
||||
//
|
||||
// i = _feedReadsDelayed.erase(i);
|
||||
// }
|
||||
// }
|
||||
// if (!_feedReadsDelayed.empty()) {
|
||||
// _feedReadTimer.callOnce(delay);
|
||||
// }
|
||||
//}
|
||||
|
||||
void ApiWrap::sendReadRequest(not_null<PeerData*> peer, MsgId upTo) {
|
||||
const auto requestId = [&] {
|
||||
|
|
|
@ -79,8 +79,8 @@ public:
|
|||
QString exportDirectMessageLink(not_null<HistoryItem*> item);
|
||||
|
||||
void requestContacts();
|
||||
void requestDialogEntry(not_null<Data::Feed*> feed);
|
||||
//void requestFeedDialogsEntries(not_null<Data::Feed*> feed);
|
||||
void requestDialogEntry(not_null<Data::Folder*> folder);
|
||||
//void requestFeedDialogsEntries(not_null<Data::Feed*> feed); // #feed
|
||||
void requestDialogEntry(
|
||||
not_null<History*> history,
|
||||
Fn<void()> callback = nullptr);
|
||||
|
@ -309,9 +309,9 @@ public:
|
|||
void shareContact(not_null<UserData*> user, const SendOptions &options);
|
||||
void readServerHistory(not_null<History*> history);
|
||||
void readServerHistoryForce(not_null<History*> history);
|
||||
void readFeed(
|
||||
not_null<Data::Feed*> feed,
|
||||
Data::MessagePosition position);
|
||||
//void readFeed( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Data::MessagePosition position);
|
||||
|
||||
void sendVoiceMessage(
|
||||
QByteArray result,
|
||||
|
@ -462,9 +462,9 @@ private:
|
|||
QVector<MTPInputMessage> collectMessageIds(const MessageDataRequests &requests);
|
||||
MessageDataRequests *messageDataRequests(ChannelData *channel, bool onlyExisting = false);
|
||||
void applyPeerDialogs(const MTPmessages_PeerDialogs &dialogs);
|
||||
void applyFeedDialogs(
|
||||
not_null<Data::Feed*> feed,
|
||||
const MTPmessages_Dialogs &dialogs);
|
||||
//void applyFeedDialogs( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// const MTPmessages_Dialogs &dialogs);
|
||||
|
||||
void gotChatFull(
|
||||
not_null<PeerData*> peer,
|
||||
|
@ -522,17 +522,17 @@ private:
|
|||
const QVector<MTPChannelParticipant> &participants);
|
||||
|
||||
void jumpToHistoryDate(not_null<PeerData*> peer, const QDate &date);
|
||||
void jumpToFeedDate(not_null<Data::Feed*> feed, const QDate &date);
|
||||
//void jumpToFeedDate(not_null<Data::Feed*> feed, const QDate &date); // #feed
|
||||
template <typename Callback>
|
||||
void requestMessageAfterDate(
|
||||
not_null<PeerData*> peer,
|
||||
const QDate &date,
|
||||
Callback &&callback);
|
||||
template <typename Callback>
|
||||
void requestMessageAfterDate(
|
||||
not_null<Data::Feed*> feed,
|
||||
const QDate &date,
|
||||
Callback &&callback);
|
||||
//template <typename Callback> // #feed
|
||||
//void requestMessageAfterDate(
|
||||
// not_null<Data::Feed*> feed,
|
||||
// const QDate &date,
|
||||
// Callback &&callback);
|
||||
|
||||
void sharedMediaDone(
|
||||
not_null<PeerData*> peer,
|
||||
|
@ -601,7 +601,7 @@ private:
|
|||
uint64 randomId);
|
||||
FileLoadTo fileLoadTaskOptions(const SendOptions &options) const;
|
||||
|
||||
void readFeeds();
|
||||
//void readFeeds(); // #feed
|
||||
|
||||
void getProxyPromotionDelayed(TimeId now, TimeId next);
|
||||
void proxyPromotionDone(const MTPhelp_ProxyData &proxy);
|
||||
|
@ -701,7 +701,7 @@ private:
|
|||
|
||||
mtpRequestId _contactsRequestId = 0;
|
||||
mtpRequestId _contactsStatusesRequestId = 0;
|
||||
base::flat_set<not_null<Data::Feed*>> _dialogFeedRequests;
|
||||
base::flat_set<not_null<Data::Folder*>> _dialogFolderRequests;
|
||||
base::flat_map<
|
||||
not_null<History*>,
|
||||
std::vector<Fn<void()>>> _dialogRequests;
|
||||
|
@ -720,19 +720,19 @@ private:
|
|||
|
||||
base::flat_map<not_null<UserData*>, mtpRequestId> _userPhotosRequests;
|
||||
|
||||
base::flat_set<not_null<Data::Feed*>> _feedChannelsGetRequests;
|
||||
base::flat_map<
|
||||
not_null<Data::Feed*>,
|
||||
mtpRequestId> _feedChannelsSetRequests;
|
||||
base::flat_set<std::tuple<
|
||||
not_null<Data::Feed*>,
|
||||
Data::MessagePosition,
|
||||
SliceType>> _feedMessagesRequests;
|
||||
base::flat_set<std::tuple<
|
||||
not_null<Data::Feed*>,
|
||||
Data::MessagePosition,
|
||||
SliceType>> _feedMessagesRequestsPending;
|
||||
mtpRequestId _saveDefaultFeedIdRequest = 0;
|
||||
//base::flat_set<not_null<Data::Feed*>> _feedChannelsGetRequests; // #feed
|
||||
//base::flat_map<
|
||||
// not_null<Data::Feed*>,
|
||||
// mtpRequestId> _feedChannelsSetRequests;
|
||||
//base::flat_set<std::tuple<
|
||||
// not_null<Data::Feed*>,
|
||||
// Data::MessagePosition,
|
||||
// SliceType>> _feedMessagesRequests;
|
||||
//base::flat_set<std::tuple<
|
||||
// not_null<Data::Feed*>,
|
||||
// Data::MessagePosition,
|
||||
// SliceType>> _feedMessagesRequestsPending;
|
||||
//mtpRequestId _saveDefaultFeedIdRequest = 0;
|
||||
|
||||
rpl::event_stream<SendOptions> _sendActions;
|
||||
|
||||
|
@ -755,9 +755,10 @@ private:
|
|||
|
||||
rpl::event_stream<uint64> _stickerSetInstalled;
|
||||
|
||||
base::flat_map<not_null<Data::Feed*>, crl::time> _feedReadsDelayed;
|
||||
base::flat_map<not_null<Data::Feed*>, mtpRequestId> _feedReadRequests;
|
||||
base::Timer _feedReadTimer;
|
||||
// #feed
|
||||
//base::flat_map<not_null<Data::Feed*>, crl::time> _feedReadsDelayed;
|
||||
//base::flat_map<not_null<Data::Feed*>, mtpRequestId> _feedReadRequests;
|
||||
//base::Timer _feedReadTimer;
|
||||
|
||||
mtpRequestId _proxyPromotionRequestId = 0;
|
||||
std::pair<QString, uint32> _proxyPromotionKey;
|
||||
|
|
|
@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_user.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "observer_peer.h"
|
||||
#include "auth_session.h"
|
||||
#include "apiwrap.h"
|
||||
|
@ -306,27 +306,27 @@ void ChannelData::setAvailableMinId(MsgId availableMinId) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChannelData::setFeed(not_null<Data::Feed*> feed) {
|
||||
setFeedPointer(feed);
|
||||
}
|
||||
|
||||
void ChannelData::clearFeed() {
|
||||
setFeedPointer(nullptr);
|
||||
}
|
||||
|
||||
void ChannelData::setFeedPointer(Data::Feed *feed) {
|
||||
if (_feed != feed) {
|
||||
const auto was = _feed;
|
||||
_feed = feed;
|
||||
if (was) {
|
||||
was->unregisterOne(this);
|
||||
}
|
||||
if (_feed) {
|
||||
_feed->registerOne(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
// #TODO archive
|
||||
//void ChannelData::setFeed(not_null<Data::Feed*> feed) {
|
||||
// setFeedPointer(feed);
|
||||
//}
|
||||
//
|
||||
//void ChannelData::clearFeed() {
|
||||
// setFeedPointer(nullptr);
|
||||
//}
|
||||
//
|
||||
//void ChannelData::setFeedPointer(Data::Feed *feed) {
|
||||
// if (_feed != feed) {
|
||||
// const auto was = _feed;
|
||||
// _feed = feed;
|
||||
// if (was) {
|
||||
// was->unregisterOne(this);
|
||||
// }
|
||||
// if (_feed) {
|
||||
// _feed->registerOne(this);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
bool ChannelData::canBanMembers() const {
|
||||
return amCreator()
|
||||
|
|
|
@ -327,13 +327,6 @@ public:
|
|||
}
|
||||
void setAvailableMinId(MsgId availableMinId);
|
||||
|
||||
void setFeed(not_null<Data::Feed*> feed);
|
||||
void clearFeed();
|
||||
|
||||
Data::Feed *feed() const {
|
||||
return _feed;
|
||||
}
|
||||
|
||||
enum class UpdateStatus {
|
||||
Good,
|
||||
TooOld,
|
||||
|
@ -365,7 +358,6 @@ public:
|
|||
|
||||
private:
|
||||
bool canEditLastAdmin(not_null<UserData*> user) const;
|
||||
void setFeedPointer(Data::Feed *feed);
|
||||
|
||||
Flags _flags = Flags(MTPDchannel_ClientFlag::f_forbidden | 0);
|
||||
FullFlags _fullFlags;
|
||||
|
@ -387,7 +379,6 @@ private:
|
|||
QString _unavailableReason;
|
||||
|
||||
QString _inviteLink;
|
||||
Data::Feed *_feed = nullptr;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ the official desktop application for the Telegram messaging service.
|
|||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_channel.h"
|
||||
|
@ -14,7 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_item.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "storage/storage_facade.h"
|
||||
#include "storage/storage_feed_messages.h"
|
||||
//#include "storage/storage_feed_messages.h" // #feed
|
||||
#include "auth_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "mainwidget.h"
|
||||
|
@ -31,7 +31,7 @@ namespace Data {
|
|||
// data.vid.v));
|
||||
//}
|
||||
|
||||
Feed::Feed(not_null<Data::Session*> owner, FeedId id)
|
||||
Folder::Folder(not_null<Data::Session*> owner, FolderId id)
|
||||
: Entry(this)
|
||||
, _id(id)
|
||||
, _owner(owner)
|
||||
|
@ -39,19 +39,19 @@ Feed::Feed(not_null<Data::Session*> owner, FeedId id)
|
|||
indexNameParts();
|
||||
}
|
||||
|
||||
Data::Session &Feed::owner() const {
|
||||
Data::Session &Folder::owner() const {
|
||||
return *_owner;
|
||||
}
|
||||
|
||||
AuthSession &Feed::session() const {
|
||||
AuthSession &Folder::session() const {
|
||||
return _owner->session();
|
||||
}
|
||||
|
||||
FeedId Feed::id() const {
|
||||
FolderId Folder::id() const {
|
||||
return _id;
|
||||
}
|
||||
|
||||
void Feed::indexNameParts() {
|
||||
void Folder::indexNameParts() {
|
||||
_nameWords.clear();
|
||||
_nameFirstLetters.clear();
|
||||
auto toIndexList = QStringList();
|
||||
|
@ -77,13 +77,13 @@ void Feed::indexNameParts() {
|
|||
}
|
||||
}
|
||||
|
||||
void Feed::registerOne(not_null<ChannelData*> channel) {
|
||||
const auto history = owner().history(channel);
|
||||
if (!base::contains(_channels, history)) {
|
||||
const auto invisible = (_channels.size() < 2);
|
||||
_channels.push_back(history);
|
||||
session().storage().invalidate(
|
||||
Storage::FeedMessagesInvalidate(_id));
|
||||
void Folder::registerOne(not_null<PeerData*> peer) {
|
||||
const auto history = owner().history(peer);
|
||||
if (!base::contains(_chats, history)) {
|
||||
const auto invisible = empty(_chats);
|
||||
_chats.push_back(history);
|
||||
//session().storage().invalidate( // #feed
|
||||
// Storage::FeedMessagesInvalidate(_id));
|
||||
|
||||
if (history->chatListMessageKnown()) {
|
||||
if (const auto last = history->chatListMessage()) {
|
||||
|
@ -103,30 +103,30 @@ void Feed::registerOne(not_null<ChannelData*> channel) {
|
|||
if (const auto count = history->unreadCount()) {
|
||||
unreadCountChanged(count, history->mute() ? count : 0);
|
||||
}
|
||||
} else if (!_settingChannels) {
|
||||
} else if (!_settingChats) {
|
||||
session().api().requestDialogEntry(this);
|
||||
}
|
||||
}
|
||||
if (invisible && _channels.size() > 1) {
|
||||
if (invisible && !empty(_chats)) {
|
||||
updateChatListExistence();
|
||||
for (const auto history : _channels) {
|
||||
for (const auto history : _chats) {
|
||||
history->updateChatListExistence();
|
||||
}
|
||||
} else {
|
||||
history->updateChatListExistence();
|
||||
}
|
||||
_owner->notifyFeedUpdated(this, FeedUpdateFlag::Channels);
|
||||
_owner->notifyFolderUpdated(this, FolderUpdateFlag::List);
|
||||
}
|
||||
}
|
||||
|
||||
void Feed::unregisterOne(not_null<ChannelData*> channel) {
|
||||
const auto history = owner().history(channel);
|
||||
const auto i = ranges::remove(_channels, history);
|
||||
if (i != end(_channels)) {
|
||||
const auto visible = (_channels.size() > 1);
|
||||
_channels.erase(i, end(_channels));
|
||||
session().storage().remove(
|
||||
Storage::FeedMessagesRemoveAll(_id, channel->bareId()));
|
||||
void Folder::unregisterOne(not_null<PeerData*> peer) {
|
||||
const auto history = owner().history(peer);
|
||||
const auto i = ranges::remove(_chats, history);
|
||||
if (i != end(_chats)) {
|
||||
const auto visible = !empty(_chats);
|
||||
_chats.erase(i, end(_chats));
|
||||
//session().storage().remove( // #feed
|
||||
// Storage::FeedMessagesRemoveAll(_id, channel->bareId()));
|
||||
|
||||
if (chatListMessageKnown()) {
|
||||
if (const auto last = chatListMessage()) {
|
||||
|
@ -144,19 +144,19 @@ void Feed::unregisterOne(not_null<ChannelData*> channel) {
|
|||
session().api().requestDialogEntry(this);
|
||||
}
|
||||
}
|
||||
if (visible && _channels.size() < 2) {
|
||||
if (visible && empty(_chats)) {
|
||||
updateChatListExistence();
|
||||
for (const auto history : _channels) {
|
||||
for (const auto history : _chats) {
|
||||
history->updateChatListExistence();
|
||||
}
|
||||
} else {
|
||||
history->updateChatListExistence();
|
||||
}
|
||||
_owner->notifyFeedUpdated(this, FeedUpdateFlag::Channels);
|
||||
_owner->notifyFolderUpdated(this, FolderUpdateFlag::List);
|
||||
}
|
||||
}
|
||||
|
||||
void Feed::updateChatListMessage(not_null<HistoryItem*> item) {
|
||||
void Folder::updateChatListMessage(not_null<HistoryItem*> item) {
|
||||
if (justUpdateChatListMessage(item)) {
|
||||
if (_chatListMessage && *_chatListMessage) {
|
||||
setChatListTimeId((*_chatListMessage)->date());
|
||||
|
@ -164,108 +164,108 @@ void Feed::updateChatListMessage(not_null<HistoryItem*> item) {
|
|||
}
|
||||
}
|
||||
|
||||
void Feed::loadUserpic() {
|
||||
constexpr auto kPaintUserpicsCount = 4;
|
||||
auto load = kPaintUserpicsCount;
|
||||
for (const auto channel : _channels) {
|
||||
channel->peer->loadUserpic();
|
||||
if (!--load) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
void Folder::loadUserpic() {
|
||||
//constexpr auto kPaintUserpicsCount = 4; // #feed
|
||||
//auto load = kPaintUserpicsCount;
|
||||
//for (const auto history : _chats) {
|
||||
// history->peer->loadUserpic();
|
||||
// if (!--load) {
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
void Feed::paintUserpic(
|
||||
void Folder::paintUserpic(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
int size) const {
|
||||
const auto small = (size - st::lineWidth) / 2;
|
||||
const auto delta = size - small;
|
||||
auto index = 0;
|
||||
for (const auto channel : _channels) {
|
||||
channel->peer->paintUserpic(p, x, y, small);
|
||||
switch (++index) {
|
||||
case 1:
|
||||
case 3: x += delta; break;
|
||||
case 2: x -= delta; y += delta; break;
|
||||
case 4: return;
|
||||
}
|
||||
}
|
||||
//const auto small = (size - st::lineWidth) / 2; // #feed
|
||||
//const auto delta = size - small;
|
||||
//auto index = 0;
|
||||
//for (const auto history : _chats) {
|
||||
// history->peer->paintUserpic(p, x, y, small);
|
||||
// switch (++index) {
|
||||
// case 1:
|
||||
// case 3: x += delta; break;
|
||||
// case 2: x -= delta; y += delta; break;
|
||||
// case 4: return;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
const std::vector<not_null<History*>> &Feed::channels() const {
|
||||
return _channels;
|
||||
const std::vector<not_null<History*>> &Folder::chats() const {
|
||||
return _chats;
|
||||
}
|
||||
|
||||
int32 Feed::channelsHash() const {
|
||||
int32 Folder::chatsHash() const {
|
||||
const auto ordered = ranges::view::all(
|
||||
_channels
|
||||
_chats
|
||||
) | ranges::view::transform([](not_null<History*> history) {
|
||||
return history->peer->bareId();
|
||||
}) | ranges::to_vector | ranges::action::sort;
|
||||
return Api::CountHash(ordered);
|
||||
}
|
||||
|
||||
bool Feed::channelsLoaded() const {
|
||||
return _channelsLoaded;
|
||||
bool Folder::chatsLoaded() const {
|
||||
return _chatsLoaded;
|
||||
}
|
||||
|
||||
void Feed::setChannelsLoaded(bool loaded) {
|
||||
if (_channelsLoaded != loaded) {
|
||||
_channelsLoaded = loaded;
|
||||
_owner->notifyFeedUpdated(this, FeedUpdateFlag::Channels);
|
||||
void Folder::setChatsLoaded(bool loaded) {
|
||||
if (_chatsLoaded != loaded) {
|
||||
_chatsLoaded = loaded;
|
||||
_owner->notifyFolderUpdated(this, FolderUpdateFlag::List);
|
||||
}
|
||||
}
|
||||
|
||||
void Feed::setChannels(std::vector<not_null<ChannelData*>> channels) {
|
||||
void Folder::setChats(std::vector<not_null<PeerData*>> chats) {
|
||||
const auto remove = ranges::view::all(
|
||||
_channels
|
||||
_chats
|
||||
) | ranges::view::transform([](not_null<History*> history) {
|
||||
return not_null<ChannelData*>(history->peer->asChannel());
|
||||
}) | ranges::view::filter([&](not_null<ChannelData*> channel) {
|
||||
return !base::contains(channels, channel);
|
||||
return history->peer;
|
||||
}) | ranges::view::filter([&](not_null<PeerData*> peer) {
|
||||
return !base::contains(chats, peer);
|
||||
}) | ranges::to_vector;
|
||||
|
||||
const auto add = ranges::view::all(
|
||||
channels
|
||||
) | ranges::view::filter([&](not_null<ChannelData*> channel) {
|
||||
chats
|
||||
) | ranges::view::filter([&](not_null<PeerData*> peer) {
|
||||
return ranges::find(
|
||||
_channels,
|
||||
channel.get(),
|
||||
[](auto history) { return history->peer->asChannel(); }
|
||||
) == end(_channels);
|
||||
}) | ranges::view::transform([](ChannelData *channel) {
|
||||
return not_null<ChannelData*>(channel);
|
||||
_chats,
|
||||
peer,
|
||||
[](auto history) { return history->peer; }
|
||||
) == end(_chats);
|
||||
}) | ranges::view::transform([](PeerData *peer) {
|
||||
return not_null<PeerData*>(peer);
|
||||
}) | ranges::to_vector;
|
||||
|
||||
changeChannelsList(add, remove);
|
||||
changeChatsList(add, remove);
|
||||
|
||||
setChannelsLoaded(true);
|
||||
setChatsLoaded(true);
|
||||
}
|
||||
|
||||
void Feed::changeChannelsList(
|
||||
const std::vector<not_null<ChannelData*>> &add,
|
||||
const std::vector<not_null<ChannelData*>> &remove) {
|
||||
_settingChannels = true;
|
||||
const auto restore = gsl::finally([&] { _settingChannels = false; });
|
||||
void Folder::changeChatsList(
|
||||
const std::vector<not_null<PeerData*>> &add,
|
||||
const std::vector<not_null<PeerData*>> &remove) {
|
||||
_settingChats = true;
|
||||
const auto restore = gsl::finally([&] { _settingChats = false; });
|
||||
|
||||
for (const auto channel : remove) {
|
||||
channel->clearFeed();
|
||||
}
|
||||
//for (const auto channel : remove) { // #TODO archive
|
||||
// channel->clearFeed();
|
||||
//}
|
||||
|
||||
// We assume the last message was correct before requesting the list.
|
||||
// So we save it and don't allow channels from the list to change it.
|
||||
// After that we restore it.
|
||||
//// We assume the last message was correct before requesting the list.
|
||||
//// So we save it and don't allow channels from the list to change it.
|
||||
//// After that we restore it.
|
||||
const auto oldChatListMessage = base::take(_chatListMessage);
|
||||
for (const auto channel : add) {
|
||||
_chatListMessage = std::nullopt;
|
||||
channel->setFeed(this);
|
||||
}
|
||||
//for (const auto channel : add) {
|
||||
// _chatListMessage = std::nullopt;
|
||||
// channel->setFeed(this);
|
||||
//}
|
||||
_chatListMessage = oldChatListMessage;
|
||||
}
|
||||
|
||||
bool Feed::justUpdateChatListMessage(not_null<HistoryItem*> item) {
|
||||
bool Folder::justUpdateChatListMessage(not_null<HistoryItem*> item) {
|
||||
if (!_chatListMessage) {
|
||||
return false;
|
||||
} else if (*_chatListMessage
|
||||
|
@ -276,13 +276,13 @@ bool Feed::justUpdateChatListMessage(not_null<HistoryItem*> item) {
|
|||
return true;
|
||||
}
|
||||
|
||||
void Feed::messageRemoved(not_null<HistoryItem*> item) {
|
||||
void Folder::messageRemoved(not_null<HistoryItem*> item) {
|
||||
if (chatListMessage() == item) {
|
||||
recountChatListMessage();
|
||||
}
|
||||
}
|
||||
|
||||
void Feed::historyCleared(not_null<History*> history) {
|
||||
void Folder::historyCleared(not_null<History*> history) {
|
||||
if (const auto last = chatListMessage()) {
|
||||
if (last->history() == history) {
|
||||
messageRemoved(last);
|
||||
|
@ -290,15 +290,15 @@ void Feed::historyCleared(not_null<History*> history) {
|
|||
}
|
||||
}
|
||||
|
||||
void Feed::requestChatListMessage() {
|
||||
void Folder::requestChatListMessage() {
|
||||
if (!chatListMessageKnown()) {
|
||||
session().api().requestDialogEntry(this);
|
||||
}
|
||||
}
|
||||
|
||||
void Feed::recountChatListMessage() {
|
||||
void Folder::recountChatListMessage() {
|
||||
_chatListMessage = std::nullopt;
|
||||
for (const auto history : _channels) {
|
||||
for (const auto history : _chats) {
|
||||
if (!history->chatListMessageKnown()) {
|
||||
requestChatListMessage();
|
||||
return;
|
||||
|
@ -307,9 +307,9 @@ void Feed::recountChatListMessage() {
|
|||
setChatListMessageFromChannels();
|
||||
}
|
||||
|
||||
void Feed::setChatListMessageFromChannels() {
|
||||
void Folder::setChatListMessageFromChannels() {
|
||||
_chatListMessage = nullptr;
|
||||
for (const auto history : _channels) {
|
||||
for (const auto history : _chats) {
|
||||
if (const auto last = history->chatListMessage()) {
|
||||
justUpdateChatListMessage(last);
|
||||
}
|
||||
|
@ -317,27 +317,27 @@ void Feed::setChatListMessageFromChannels() {
|
|||
updateChatListDate();
|
||||
}
|
||||
|
||||
void Feed::updateChatListDate() {
|
||||
void Folder::updateChatListDate() {
|
||||
if (_chatListMessage && *_chatListMessage) {
|
||||
setChatListTimeId((*_chatListMessage)->date());
|
||||
}
|
||||
}
|
||||
|
||||
int Feed::unreadCount() const {
|
||||
int Folder::unreadCount() const {
|
||||
return _unreadCount ? *_unreadCount : 0;
|
||||
}
|
||||
|
||||
rpl::producer<int> Feed::unreadCountValue() const {
|
||||
rpl::producer<int> Folder::unreadCountValue() const {
|
||||
return rpl::single(
|
||||
unreadCount()
|
||||
) | rpl::then(_unreadCountChanges.events());
|
||||
}
|
||||
|
||||
bool Feed::unreadCountKnown() const {
|
||||
bool Folder::unreadCountKnown() const {
|
||||
return !!_unreadCount;
|
||||
}
|
||||
// #feed
|
||||
//void Feed::applyDialog(const MTPDdialogFeed &data) {
|
||||
//void Folder::applyDialog(const MTPDdialogFeed &data) {
|
||||
// const auto addChannel = [&](ChannelId channelId) {
|
||||
// if (const auto channel = owner().channelLoaded(channelId)) {
|
||||
// channel->setFeed(this);
|
||||
|
@ -367,7 +367,7 @@ bool Feed::unreadCountKnown() const {
|
|||
// }
|
||||
//}
|
||||
|
||||
void Feed::changedInChatListHook(Dialogs::Mode list, bool added) {
|
||||
void Folder::changedInChatListHook(Dialogs::Mode list, bool added) {
|
||||
if (list != Dialogs::Mode::All) {
|
||||
return;
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ void Feed::changedInChatListHook(Dialogs::Mode list, bool added) {
|
|||
}
|
||||
|
||||
template <typename PerformUpdate>
|
||||
void Feed::updateUnreadCounts(PerformUpdate &&performUpdate) {
|
||||
void Folder::updateUnreadCounts(PerformUpdate &&performUpdate) {
|
||||
const auto wasUnreadCount = _unreadCount ? *_unreadCount : 0;
|
||||
const auto wasUnreadMutedCount = _unreadMutedCount;
|
||||
const auto wasFullMuted = (wasUnreadMutedCount > 0)
|
||||
|
@ -433,7 +433,7 @@ void Feed::updateUnreadCounts(PerformUpdate &&performUpdate) {
|
|||
}
|
||||
}
|
||||
|
||||
void Feed::setUnreadCounts(int unreadNonMutedCount, int unreadMutedCount) {
|
||||
void Folder::setUnreadCounts(int unreadNonMutedCount, int unreadMutedCount) {
|
||||
if (unreadCountKnown()
|
||||
&& (*_unreadCount == unreadNonMutedCount + unreadMutedCount)
|
||||
&& (_unreadMutedCount == unreadMutedCount)) {
|
||||
|
@ -445,13 +445,13 @@ void Feed::setUnreadCounts(int unreadNonMutedCount, int unreadMutedCount) {
|
|||
});
|
||||
}
|
||||
|
||||
void Feed::setUnreadPosition(const MessagePosition &position) {
|
||||
void Folder::setUnreadPosition(const MessagePosition &position) {
|
||||
if (_unreadPosition.current() < position) {
|
||||
_unreadPosition = position;
|
||||
}
|
||||
}
|
||||
|
||||
void Feed::unreadCountChanged(int unreadCountDelta, int mutedCountDelta) {
|
||||
void Folder::unreadCountChanged(int unreadCountDelta, int mutedCountDelta) {
|
||||
if (!unreadCountKnown()) {
|
||||
return;
|
||||
}
|
||||
|
@ -467,55 +467,55 @@ void Feed::unreadCountChanged(int unreadCountDelta, int mutedCountDelta) {
|
|||
});
|
||||
}
|
||||
|
||||
MessagePosition Feed::unreadPosition() const {
|
||||
MessagePosition Folder::unreadPosition() const {
|
||||
return _unreadPosition.current();
|
||||
}
|
||||
|
||||
rpl::producer<MessagePosition> Feed::unreadPositionChanges() const {
|
||||
rpl::producer<MessagePosition> Folder::unreadPositionChanges() const {
|
||||
return _unreadPosition.changes();
|
||||
}
|
||||
|
||||
bool Feed::toImportant() const {
|
||||
bool Folder::toImportant() const {
|
||||
return false; // TODO feeds workmode
|
||||
}
|
||||
|
||||
bool Feed::useProxyPromotion() const {
|
||||
bool Folder::useProxyPromotion() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Feed::shouldBeInChatList() const {
|
||||
return _channels.size() > 1;
|
||||
bool Folder::shouldBeInChatList() const {
|
||||
return !empty(_chats);
|
||||
}
|
||||
|
||||
int Feed::chatListUnreadCount() const {
|
||||
int Folder::chatListUnreadCount() const {
|
||||
return unreadCount();
|
||||
}
|
||||
|
||||
bool Feed::chatListUnreadMark() const {
|
||||
bool Folder::chatListUnreadMark() const {
|
||||
return false; // #feed unread mark
|
||||
}
|
||||
|
||||
bool Feed::chatListMutedBadge() const {
|
||||
bool Folder::chatListMutedBadge() const {
|
||||
return _unreadCount ? (*_unreadCount <= _unreadMutedCount) : false;
|
||||
}
|
||||
|
||||
HistoryItem *Feed::chatListMessage() const {
|
||||
HistoryItem *Folder::chatListMessage() const {
|
||||
return _chatListMessage ? *_chatListMessage : nullptr;
|
||||
}
|
||||
|
||||
bool Feed::chatListMessageKnown() const {
|
||||
bool Folder::chatListMessageKnown() const {
|
||||
return _chatListMessage.has_value();
|
||||
}
|
||||
|
||||
const QString &Feed::chatListName() const {
|
||||
const QString &Folder::chatListName() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
const base::flat_set<QString> &Feed::chatListNameWords() const {
|
||||
const base::flat_set<QString> &Folder::chatListNameWords() const {
|
||||
return _nameWords;
|
||||
}
|
||||
|
||||
const base::flat_set<QChar> &Feed::chatListFirstLetters() const {
|
||||
const base::flat_set<QChar> &Folder::chatListFirstLetters() const {
|
||||
return _nameFirstLetters;
|
||||
}
|
||||
|
|
@ -16,35 +16,33 @@ class AuthSession;
|
|||
namespace Data {
|
||||
|
||||
class Session;
|
||||
class Feed;
|
||||
class Folder;
|
||||
|
||||
enum class FeedUpdateFlag {
|
||||
Channels,
|
||||
ChannelPhoto,
|
||||
enum class FolderUpdateFlag {
|
||||
List,
|
||||
};
|
||||
|
||||
struct FeedUpdate {
|
||||
not_null<Data::Feed*> feed;
|
||||
FeedUpdateFlag flag;
|
||||
struct FolderUpdate {
|
||||
not_null<Data::Folder*> folder;
|
||||
FolderUpdateFlag flag;
|
||||
};
|
||||
|
||||
//MessagePosition FeedPositionFromMTP(const MTPFeedPosition &position); // #feed
|
||||
|
||||
class Feed : public Dialogs::Entry {
|
||||
class Folder : public Dialogs::Entry {
|
||||
public:
|
||||
static constexpr auto kId = 1;
|
||||
static constexpr auto kChannelsLimit = 1000;
|
||||
|
||||
Feed(not_null<Data::Session*> owner, FeedId id);
|
||||
Feed(const Feed &) = delete;
|
||||
Feed &operator=(const Feed &) = delete;
|
||||
Folder(not_null<Data::Session*> owner, FolderId id);
|
||||
Folder(const Folder &) = delete;
|
||||
Folder &operator=(const Folder &) = delete;
|
||||
|
||||
Data::Session &owner() const;
|
||||
AuthSession &session() const;
|
||||
|
||||
FeedId id() const;
|
||||
void registerOne(not_null<ChannelData*> channel);
|
||||
void unregisterOne(not_null<ChannelData*> channel);
|
||||
FolderId id() const;
|
||||
void registerOne(not_null<PeerData*> peer);
|
||||
void unregisterOne(not_null<PeerData*> peer);
|
||||
|
||||
void updateChatListMessage(not_null<HistoryItem*> item);
|
||||
void messageRemoved(not_null<HistoryItem*> item);
|
||||
|
@ -84,11 +82,11 @@ public:
|
|||
int y,
|
||||
int size) const override;
|
||||
|
||||
const std::vector<not_null<History*>> &channels() const;
|
||||
int32 channelsHash() const;
|
||||
bool channelsLoaded() const;
|
||||
void setChannelsLoaded(bool loaded);
|
||||
void setChannels(std::vector<not_null<ChannelData*>> channels);
|
||||
const std::vector<not_null<History*>> &chats() const;
|
||||
int32 chatsHash() const;
|
||||
bool chatsLoaded() const;
|
||||
void setChatsLoaded(bool loaded);
|
||||
void setChats(std::vector<not_null<PeerData*>> chats);
|
||||
|
||||
private:
|
||||
void indexNameParts();
|
||||
|
@ -96,18 +94,18 @@ private:
|
|||
void setChatListMessageFromChannels();
|
||||
bool justUpdateChatListMessage(not_null<HistoryItem*> item);
|
||||
void updateChatListDate();
|
||||
void changeChannelsList(
|
||||
const std::vector<not_null<ChannelData*>> &add,
|
||||
const std::vector<not_null<ChannelData*>> &remove);
|
||||
void changeChatsList(
|
||||
const std::vector<not_null<PeerData*>> &add,
|
||||
const std::vector<not_null<PeerData*>> &remove);
|
||||
|
||||
template <typename PerformUpdate>
|
||||
void updateUnreadCounts(PerformUpdate &&performUpdate);
|
||||
|
||||
FeedId _id = 0;
|
||||
FolderId _id = 0;
|
||||
not_null<Data::Session*> _owner;
|
||||
std::vector<not_null<History*>> _channels;
|
||||
bool _settingChannels = false;
|
||||
bool _channelsLoaded = false;
|
||||
std::vector<not_null<History*>> _chats;
|
||||
bool _settingChats = false;
|
||||
bool _chatsLoaded = false;
|
||||
|
||||
QString _name;
|
||||
base::flat_set<QString> _nameWords;
|
|
@ -5,7 +5,7 @@ the official desktop application for the Telegram messaging service.
|
|||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "data/data_feed_messages.h"
|
||||
#include "data/data_messages.h"
|
||||
|
||||
namespace Data {
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_chat.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_session.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "observer_peer.h"
|
||||
|
@ -356,13 +356,13 @@ void PeerData::setUserpicChecked(
|
|||
|| _userpicLocation != location) {
|
||||
setUserpic(photoId, location, userpic);
|
||||
Notify::peerUpdatedDelayed(this, UpdateFlag::PhotoChanged);
|
||||
if (const auto channel = asChannel()) {
|
||||
if (const auto feed = channel->feed()) {
|
||||
owner().notifyFeedUpdated(
|
||||
feed,
|
||||
Data::FeedUpdateFlag::ChannelPhoto);
|
||||
}
|
||||
}
|
||||
//if (const auto channel = asChannel()) { // #feed
|
||||
// if (const auto feed = channel->feed()) {
|
||||
// owner().notifyFeedUpdated(
|
||||
// feed,
|
||||
// Data::FeedUpdateFlag::ChannelPhoto);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,13 +576,6 @@ not_null<const PeerData*> PeerData::migrateToOrMe() const {
|
|||
return this;
|
||||
}
|
||||
|
||||
Data::Feed *PeerData::feed() const {
|
||||
if (const auto channel = asChannel()) {
|
||||
return channel->feed();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Text &PeerData::dialogName() const {
|
||||
return migrateTo()
|
||||
? migrateTo()->dialogName()
|
||||
|
|
|
@ -25,7 +25,6 @@ class ChannelData;
|
|||
|
||||
namespace Data {
|
||||
|
||||
class Feed;
|
||||
class Session;
|
||||
|
||||
int PeerColorIndex(PeerId peerId);
|
||||
|
@ -179,7 +178,6 @@ public:
|
|||
[[nodiscard]] ChannelData *migrateTo() const;
|
||||
[[nodiscard]] not_null<PeerData*> migrateToOrMe();
|
||||
[[nodiscard]] not_null<const PeerData*> migrateToOrMe() const;
|
||||
[[nodiscard]] Data::Feed *feed() const;
|
||||
|
||||
void updateFull();
|
||||
void updateFullForced();
|
||||
|
|
|
@ -31,7 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/themes/window_theme.h"
|
||||
#include "lang/lang_keys.h" // for lang(lng_deleted) in user name.
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_user.h"
|
||||
|
@ -910,7 +910,7 @@ void Session::setupChannelLeavingViewer() {
|
|||
return (channel != nullptr)
|
||||
&& !(channel->amIn());
|
||||
}) | rpl::start_with_next([=](not_null<ChannelData*> channel) {
|
||||
channel->clearFeed();
|
||||
// channel->clearFeed(); // #feed
|
||||
if (const auto history = historyLoaded(channel->id)) {
|
||||
history->removeJoinedMessage();
|
||||
history->updateChatListExistence();
|
||||
|
@ -1206,14 +1206,14 @@ rpl::producer<not_null<UserData*>> Session::megagroupParticipantAdded(
|
|||
});
|
||||
}
|
||||
|
||||
void Session::notifyFeedUpdated(
|
||||
not_null<Feed*> feed,
|
||||
FeedUpdateFlag update) {
|
||||
_feedUpdates.fire({ feed, update });
|
||||
void Session::notifyFolderUpdated(
|
||||
not_null<Folder*> folder,
|
||||
FolderUpdateFlag update) {
|
||||
_folderUpdates.fire({ folder, update });
|
||||
}
|
||||
|
||||
rpl::producer<FeedUpdate> Session::feedUpdated() const {
|
||||
return _feedUpdates.events();
|
||||
rpl::producer<FolderUpdate> Session::folderUpdated() const {
|
||||
return _folderUpdates.events();
|
||||
}
|
||||
|
||||
void Session::notifyStickersUpdated() {
|
||||
|
@ -1277,43 +1277,27 @@ void Session::setPinnedDialog(const Dialogs::Key &key, bool pinned) {
|
|||
void Session::applyPinnedDialogs(const QVector<MTPDialog> &list) {
|
||||
clearPinnedDialogs();
|
||||
for (auto i = list.size(); i != 0;) {
|
||||
const auto &dialog = list[--i];
|
||||
switch (dialog.type()) {
|
||||
case mtpc_dialog: {
|
||||
const auto &dialogData = dialog.c_dialog();
|
||||
if (const auto peer = peerFromMTP(dialogData.vpeer)) {
|
||||
list[--i].match([&](const MTPDdialog &data) {
|
||||
if (const auto peer = peerFromMTP(data.vpeer)) {
|
||||
setPinnedDialog(history(peer), true);
|
||||
}
|
||||
} break;
|
||||
|
||||
//case mtpc_dialogFeed: { // #feed
|
||||
// const auto &feedData = dialog.c_dialogFeed();
|
||||
// const auto feedId = feedData.vfeed_id.v;
|
||||
// setPinnedDialog(feed(feedId), true);
|
||||
//} break;
|
||||
|
||||
default: Unexpected("Type in ApiWrap::applyDialogsPinned.");
|
||||
}
|
||||
}, [&](const MTPDdialogFolder &data) { // #TODO archive
|
||||
//setPinnedDialog(processFolder(data.vfolder), true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void Session::applyPinnedDialogs(const QVector<MTPDialogPeer> &list) {
|
||||
clearPinnedDialogs();
|
||||
for (auto i = list.size(); i != 0;) {
|
||||
const auto &dialogPeer = list[--i];
|
||||
switch (dialogPeer.type()) {
|
||||
case mtpc_dialogPeer: {
|
||||
const auto &peerData = dialogPeer.c_dialogPeer();
|
||||
if (const auto peerId = peerFromMTP(peerData.vpeer)) {
|
||||
list[--i].match([&](const MTPDdialogPeer &data) {
|
||||
if (const auto peerId = peerFromMTP(data.vpeer)) {
|
||||
setPinnedDialog(history(peerId), true);
|
||||
}
|
||||
} break;
|
||||
//case mtpc_dialogPeerFeed: { // #feed
|
||||
// const auto &feedData = dialogPeer.c_dialogPeerFeed();
|
||||
// const auto feedId = feedData.vfeed_id.v;
|
||||
// setPinnedDialog(feed(feedId), true);
|
||||
//} break;
|
||||
}
|
||||
}, [&](const MTPDdialogPeerFolder &data) { // #TODO archive
|
||||
//const auto folderId = data.vfolder_id.v;
|
||||
//setPinnedDialog(folder(folderId), true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2803,32 +2787,32 @@ void Session::unregisterItemView(not_null<ViewElement*> view) {
|
|||
}
|
||||
}
|
||||
|
||||
not_null<Feed*> Session::feed(FeedId id) {
|
||||
if (const auto result = feedLoaded(id)) {
|
||||
not_null<Folder*> Session::folder(FolderId id) {
|
||||
if (const auto result = folderLoaded(id)) {
|
||||
return result;
|
||||
}
|
||||
const auto [it, ok] = _feeds.emplace(
|
||||
const auto [it, ok] = _folders.emplace(
|
||||
id,
|
||||
std::make_unique<Feed>(this, id));
|
||||
std::make_unique<Folder>(this, id));
|
||||
return it->second.get();
|
||||
}
|
||||
|
||||
Feed *Session::feedLoaded(FeedId id) {
|
||||
const auto it = _feeds.find(id);
|
||||
return (it == end(_feeds)) ? nullptr : it->second.get();
|
||||
}
|
||||
|
||||
void Session::setDefaultFeedId(FeedId id) {
|
||||
_defaultFeedId = id;
|
||||
}
|
||||
|
||||
FeedId Session::defaultFeedId() const {
|
||||
return _defaultFeedId.current();
|
||||
}
|
||||
|
||||
rpl::producer<FeedId> Session::defaultFeedIdValue() const {
|
||||
return _defaultFeedId.value();
|
||||
Folder *Session::folderLoaded(FolderId id) {
|
||||
const auto it = _folders.find(id);
|
||||
return (it == end(_folders)) ? nullptr : it->second.get();
|
||||
}
|
||||
// // #feed
|
||||
//void Session::setDefaultFeedId(FeedId id) {
|
||||
// _defaultFeedId = id;
|
||||
//}
|
||||
//
|
||||
//FeedId Session::defaultFeedId() const {
|
||||
// return _defaultFeedId.current();
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedId> Session::defaultFeedIdValue() const {
|
||||
// return _defaultFeedId.value();
|
||||
//}
|
||||
|
||||
void Session::requestNotifySettings(not_null<PeerData*> peer) {
|
||||
if (peer->notifySettingsUnknown()) {
|
||||
|
|
|
@ -48,9 +48,9 @@ struct SavedCredentials;
|
|||
|
||||
namespace Data {
|
||||
|
||||
class Feed;
|
||||
enum class FeedUpdateFlag;
|
||||
struct FeedUpdate;
|
||||
class Folder;
|
||||
enum class FolderUpdateFlag;
|
||||
struct FolderUpdate;
|
||||
|
||||
class WallPaper;
|
||||
|
||||
|
@ -203,8 +203,8 @@ public:
|
|||
[[nodiscard]] rpl::producer<not_null<UserData*>> megagroupParticipantAdded(
|
||||
not_null<ChannelData*> channel) const;
|
||||
|
||||
void notifyFeedUpdated(not_null<Feed*> feed, FeedUpdateFlag update);
|
||||
[[nodiscard]] rpl::producer<FeedUpdate> feedUpdated() const;
|
||||
void notifyFolderUpdated(not_null<Folder*> folder, FolderUpdateFlag update);
|
||||
[[nodiscard]] rpl::producer<FolderUpdate> folderUpdated() const;
|
||||
|
||||
void notifyStickersUpdated();
|
||||
[[nodiscard]] rpl::producer<> stickersUpdated() const;
|
||||
|
@ -500,11 +500,13 @@ public:
|
|||
void registerItemView(not_null<ViewElement*> view);
|
||||
void unregisterItemView(not_null<ViewElement*> view);
|
||||
|
||||
not_null<Feed*> feed(FeedId id);
|
||||
Feed *feedLoaded(FeedId id);
|
||||
void setDefaultFeedId(FeedId id);
|
||||
FeedId defaultFeedId() const;
|
||||
rpl::producer<FeedId> defaultFeedIdValue() const;
|
||||
[[nodiscard]] not_null<Folder*> folder(FolderId id);
|
||||
[[nodiscard]] Folder *folderLoaded(FolderId id);
|
||||
not_null<Folder*> processFolder(const MTPFolder &data);
|
||||
not_null<Folder*> processFolder(const MTPDfolder &data);
|
||||
//void setDefaultFeedId(FeedId id); // #feed
|
||||
//FeedId defaultFeedId() const;
|
||||
//rpl::producer<FeedId> defaultFeedIdValue() const;
|
||||
|
||||
void requestNotifySettings(not_null<PeerData*> peer);
|
||||
void applyNotifySetting(
|
||||
|
@ -644,6 +646,10 @@ private:
|
|||
PhotoData *photo,
|
||||
DocumentData *document);
|
||||
|
||||
void folderApplyFields(
|
||||
not_null<Folder*> folder,
|
||||
const MTPDfolder &data);
|
||||
|
||||
bool stickersUpdateNeeded(crl::time lastUpdate, crl::time now) const {
|
||||
constexpr auto kStickersUpdateTimeout = crl::time(3600'000);
|
||||
return (lastUpdate == 0)
|
||||
|
@ -708,7 +714,7 @@ private:
|
|||
rpl::event_stream<not_null<History*>> _historyChanged;
|
||||
rpl::event_stream<MegagroupParticipant> _megagroupParticipantRemoved;
|
||||
rpl::event_stream<MegagroupParticipant> _megagroupParticipantAdded;
|
||||
rpl::event_stream<FeedUpdate> _feedUpdates;
|
||||
rpl::event_stream<FolderUpdate> _folderUpdates;
|
||||
|
||||
rpl::event_stream<> _stickersUpdated;
|
||||
rpl::event_stream<> _savedGifsUpdated;
|
||||
|
@ -787,8 +793,8 @@ private:
|
|||
base::flat_set<not_null<PollData*>> _pollsUpdated;
|
||||
|
||||
std::deque<Dialogs::Key> _pinnedDialogs;
|
||||
base::flat_map<FeedId, std::unique_ptr<Feed>> _feeds;
|
||||
rpl::variable<FeedId> _defaultFeedId = FeedId();
|
||||
base::flat_map<FolderId, std::unique_ptr<Folder>> _folders;
|
||||
//rpl::variable<FeedId> _defaultFeedId = FeedId(); // #feed
|
||||
Groups _groups;
|
||||
std::unordered_map<
|
||||
not_null<const HistoryItem*>,
|
||||
|
|
|
@ -122,13 +122,13 @@ class BotCommand;
|
|||
struct BotInfo;
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
class Folder;
|
||||
} // namespace Data
|
||||
|
||||
using UserId = int32;
|
||||
using ChatId = int32;
|
||||
using ChannelId = int32;
|
||||
using FeedId = int32;
|
||||
using FolderId = int32;
|
||||
|
||||
constexpr auto NoChannel = ChannelId(0);
|
||||
|
||||
|
|
|
@ -151,9 +151,9 @@ dialogsChannelIconActive: icon {{ "dialogs_channel", dialogsChatIconFgActive, po
|
|||
dialogsBotIcon: icon {{ "dialogs_bot", dialogsChatIconFg, point(1px, 3px) }};
|
||||
dialogsBotIconOver: icon {{ "dialogs_bot", dialogsChatIconFgOver, point(1px, 3px) }};
|
||||
dialogsBotIconActive: icon {{ "dialogs_bot", dialogsChatIconFgActive, point(1px, 3px) }};
|
||||
dialogsFeedIcon: icon {{ "dialogs_feed", dialogsChatIconFg, point(4px, 4px) }};
|
||||
dialogsFeedIconOver: icon {{ "dialogs_feed", dialogsChatIconFgOver, point(4px, 4px) }};
|
||||
dialogsFeedIconActive: icon {{ "dialogs_feed", dialogsChatIconFgActive, point(4px, 4px) }};
|
||||
//dialogsFeedIcon: icon {{ "dialogs_feed", dialogsChatIconFg, point(4px, 4px) }}; // #feed
|
||||
//dialogsFeedIconOver: icon {{ "dialogs_feed", dialogsChatIconFgOver, point(4px, 4px) }};
|
||||
//dialogsFeedIconActive: icon {{ "dialogs_feed", dialogsChatIconFgActive, point(4px, 4px) }};
|
||||
|
||||
dialogsSendStateSkip: 20px;
|
||||
dialogsSendingIcon: icon {{ "dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }};
|
||||
|
|
|
@ -10,7 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "dialogs/dialogs_indexed_list.h"
|
||||
#include "dialogs/dialogs_layout.h"
|
||||
#include "dialogs/dialogs_search_from_controllers.h"
|
||||
#include "history/feed/history_feed_section.h"
|
||||
//#include "history/feed/history_feed_section.h" // #feed
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "core/shortcuts.h"
|
||||
|
@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/text_options.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
|
@ -108,11 +108,11 @@ DialogsInner::DialogsInner(QWidget *parent, not_null<Window::Controller*> contro
|
|||
if (history->textCachedFor == item) {
|
||||
history->updateChatListEntry();
|
||||
}
|
||||
if (const auto feed = history->peer->feed()) {
|
||||
if (feed->textCachedFor == item) {
|
||||
feed->updateChatListEntry();
|
||||
}
|
||||
}
|
||||
//if (const auto folder = history->peer->folder()) { // #TODO archive
|
||||
// if (folder->textCachedFor == item) {
|
||||
// folder->updateChatListEntry();
|
||||
// }
|
||||
//}
|
||||
}, lifetime());
|
||||
|
||||
Auth().data().sendActionAnimationUpdated(
|
||||
|
@ -165,9 +165,9 @@ DialogsInner::DialogsInner(QWidget *parent, not_null<Window::Controller*> contro
|
|||
}
|
||||
}
|
||||
}));
|
||||
Auth().data().feedUpdated(
|
||||
) | rpl::start_with_next([=](const Data::FeedUpdate &update) {
|
||||
updateDialogRow({ update.feed, FullMsgId() });
|
||||
Auth().data().folderUpdated(
|
||||
) | rpl::start_with_next([=](const Data::FolderUpdate &update) {
|
||||
updateDialogRow({ update.folder, FullMsgId() });
|
||||
}, lifetime());
|
||||
|
||||
_controller->activeChatEntryValue(
|
||||
|
@ -629,8 +629,8 @@ void DialogsInner::paintSearchInChat(
|
|||
} else {
|
||||
paintSearchInPeer(p, peer, top, fullWidth, _searchInChatText);
|
||||
}
|
||||
} else if (const auto feed = _searchInChat.feed()) {
|
||||
paintSearchInFeed(p, feed, top, fullWidth, _searchInChatText);
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// paintSearchInFeed(p, feed, top, fullWidth, _searchInChatText);
|
||||
} else {
|
||||
Unexpected("Empty Dialogs::Key in paintSearchInChat.");
|
||||
}
|
||||
|
@ -705,19 +705,19 @@ void DialogsInner::paintSearchInSaved(
|
|||
paintSearchInFilter(p, paintUserpic, top, fullWidth, nullptr, text);
|
||||
}
|
||||
|
||||
void DialogsInner::paintSearchInFeed(
|
||||
Painter &p,
|
||||
not_null<Data::Feed*> feed,
|
||||
int top,
|
||||
int fullWidth,
|
||||
const Text &text) const {
|
||||
const auto paintUserpic = [&](Painter &p, int x, int y, int size) {
|
||||
feed->paintUserpicLeft(p, x, y, fullWidth, size);
|
||||
};
|
||||
const auto icon = Dialogs::Layout::FeedTypeIcon(feed, false, false);
|
||||
paintSearchInFilter(p, paintUserpic, top, fullWidth, icon, text);
|
||||
}
|
||||
|
||||
//void DialogsInner::paintSearchInFeed( // #feed
|
||||
// Painter &p,
|
||||
// not_null<Data::Feed*> feed,
|
||||
// int top,
|
||||
// int fullWidth,
|
||||
// const Text &text) const {
|
||||
// const auto paintUserpic = [&](Painter &p, int x, int y, int size) {
|
||||
// feed->paintUserpicLeft(p, x, y, fullWidth, size);
|
||||
// };
|
||||
// const auto icon = Dialogs::Layout::FeedTypeIcon(feed, false, false);
|
||||
// paintSearchInFilter(p, paintUserpic, top, fullWidth, icon, text);
|
||||
//}
|
||||
//
|
||||
void DialogsInner::activate() {
|
||||
}
|
||||
|
||||
|
@ -1600,14 +1600,14 @@ void DialogsInner::contextMenuEvent(QContextMenuEvent *e) {
|
|||
return _menu->addAction(text, std::move(callback));
|
||||
},
|
||||
Window::PeerMenuSource::ChatsList);
|
||||
} else if (const auto feed = row.key.feed()) {
|
||||
Window::FillFeedMenu(
|
||||
_controller,
|
||||
feed,
|
||||
[&](const QString &text, Fn<void()> callback) {
|
||||
return _menu->addAction(text, std::move(callback));
|
||||
},
|
||||
Window::PeerMenuSource::ChatsList);
|
||||
} else if (const auto folder = row.key.folder()) {
|
||||
//Window::FillFolderMenu( // #TODO archive
|
||||
// _controller,
|
||||
// folder,
|
||||
// [&](const QString &text, Fn<void()> callback) {
|
||||
// return _menu->addAction(text, std::move(callback));
|
||||
// },
|
||||
// Window::PeerMenuSource::ChatsList);
|
||||
}
|
||||
connect(_menu.get(), &QObject::destroyed, [=] {
|
||||
if (_menuRow.key) {
|
||||
|
@ -1850,11 +1850,11 @@ void DialogsInner::itemRemoved(not_null<const HistoryItem*> item) {
|
|||
|
||||
void DialogsInner::dialogsReceived(const QVector<MTPDialog> &added) {
|
||||
for (const auto &dialog : added) {
|
||||
switch (dialog.type()) {
|
||||
case mtpc_dialog: applyDialog(dialog.c_dialog()); break;
|
||||
//case mtpc_dialogFeed: applyFeedDialog(dialog.c_dialogFeed()); break; // #feed
|
||||
default: Unexpected("Type in DialogsInner::dialogsReceived");
|
||||
}
|
||||
dialog.match([&](const MTPDdialog &data) {
|
||||
applyDialog(data);
|
||||
}, [&](const MTPDdialogFolder &data) {
|
||||
//applyFolderDialog(data); // #TODO archive
|
||||
});
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
|
@ -2241,8 +2241,8 @@ void DialogsInner::refreshSearchInChatLabel() {
|
|||
return lang(lng_saved_messages);
|
||||
}
|
||||
return peer->name;
|
||||
} else if (const auto feed = _searchInChat.feed()) {
|
||||
return feed->chatListName();
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// return feed->chatListName();
|
||||
}
|
||||
return QString();
|
||||
}();
|
||||
|
@ -2563,17 +2563,17 @@ DialogsInner::ChosenRow DialogsInner::computeChosenRow() const {
|
|||
};
|
||||
} else if (base::in_range(_searchedSelected, 0, _searchResults.size())) {
|
||||
const auto result = _searchResults[_searchedSelected].get();
|
||||
if (const auto feed = result->searchInChat().feed()) {
|
||||
return {
|
||||
feed,
|
||||
result->item()->position()
|
||||
};
|
||||
} else {
|
||||
//if (const auto feed = result->searchInChat().feed()) { // #feed
|
||||
// return {
|
||||
// feed,
|
||||
// result->item()->position()
|
||||
// };
|
||||
//} else {
|
||||
return {
|
||||
result->item()->history(),
|
||||
result->item()->position()
|
||||
};
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
return ChosenRow();
|
||||
|
@ -2599,10 +2599,11 @@ bool DialogsInner::chooseRow() {
|
|||
(uniqueSearchResults()
|
||||
? ShowAtUnreadMsgId
|
||||
: chosen.message.fullId.msg));
|
||||
} else if (const auto feed = chosen.key.feed()) {
|
||||
_controller->showSection(
|
||||
HistoryFeed::Memento(feed, chosen.message),
|
||||
Window::SectionShow::Way::ClearStack);
|
||||
} else if (const auto folder = chosen.key.folder()) {
|
||||
// #TODO archive
|
||||
//_controller->showSection(
|
||||
// HistoryFeed::Memento(feed, chosen.message),
|
||||
// Window::SectionShow::Way::ClearStack);
|
||||
}
|
||||
if (openSearchResult && !Auth().supportMode()) {
|
||||
emit clearSearchQuery();
|
||||
|
|
|
@ -252,12 +252,12 @@ private:
|
|||
int top,
|
||||
int fullWidth,
|
||||
const Text &text) const;
|
||||
void paintSearchInFeed(
|
||||
Painter &p,
|
||||
not_null<Data::Feed*> feed,
|
||||
int top,
|
||||
int fullWidth,
|
||||
const Text &text) const;
|
||||
//void paintSearchInFeed( // #feed
|
||||
// Painter &p,
|
||||
// not_null<Data::Feed*> feed,
|
||||
// int top,
|
||||
// int fullWidth,
|
||||
// const Text &text) const;
|
||||
template <typename PaintUserpic>
|
||||
void paintSearchInFilter(
|
||||
Painter &p,
|
||||
|
|
|
@ -7,15 +7,20 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "dialogs/dialogs_key.h"
|
||||
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "history/history.h"
|
||||
|
||||
namespace Dialogs {
|
||||
namespace {
|
||||
|
||||
using Folder = Data::Folder;
|
||||
|
||||
} // namespace
|
||||
|
||||
not_null<Entry*> Key::entry() const {
|
||||
if (const auto p = base::get_if<not_null<History*>>(&_value)) {
|
||||
return *p;
|
||||
} else if (const auto p = base::get_if<not_null<Data::Feed*>>(&_value)) {
|
||||
} else if (const auto p = base::get_if<not_null<Folder*>>(&_value)) {
|
||||
return *p;
|
||||
}
|
||||
Unexpected("Empty Dialogs::Key in Key::entry().");
|
||||
|
@ -28,8 +33,8 @@ History *Key::history() const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Data::Feed *Key::feed() const {
|
||||
if (const auto p = base::get_if<not_null<Data::Feed*>>(&_value)) {
|
||||
Folder *Key::folder() const {
|
||||
if (const auto p = base::get_if<not_null<Folder*>>(&_value)) {
|
||||
return *p;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
class History;
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
class Folder;
|
||||
} // namespace Data
|
||||
|
||||
namespace Dialogs {
|
||||
|
@ -26,9 +26,9 @@ public:
|
|||
}
|
||||
Key(not_null<History*> history) : _value(history) {
|
||||
}
|
||||
Key(Data::Feed *feed) : _value(feed) {
|
||||
Key(Data::Folder *folder) : _value(folder) {
|
||||
}
|
||||
Key(not_null<Data::Feed*> feed) : _value(feed) {
|
||||
Key(not_null<Data::Folder*> folder) : _value(folder) {
|
||||
}
|
||||
|
||||
explicit operator bool() const {
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
}
|
||||
not_null<Entry*> entry() const;
|
||||
History *history() const;
|
||||
Data::Feed *feed() const;
|
||||
Data::Folder *folder() const;
|
||||
PeerData *peer() const;
|
||||
|
||||
inline bool operator<(const Key &other) const {
|
||||
|
@ -60,7 +60,7 @@ public:
|
|||
|
||||
base::optional_variant<
|
||||
not_null<History*>,
|
||||
not_null<Data::Feed*>> raw() const {
|
||||
not_null<Data::Folder*>> raw() const {
|
||||
return _value;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,9 @@ public:
|
|||
//}
|
||||
|
||||
private:
|
||||
base::optional_variant<not_null<History*>, not_null<Data::Feed*>> _value;
|
||||
base::optional_variant<
|
||||
not_null<History*>,
|
||||
not_null<Data::Folder*>> _value;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ enum class Flag {
|
|||
OnlyBackground = 0x04,
|
||||
SearchResult = 0x08,
|
||||
SavedMessages = 0x10,
|
||||
FeedSearchResult = 0x20,
|
||||
//FeedSearchResult = 0x20, // #feed
|
||||
};
|
||||
inline constexpr bool is_flag_type(Flag) { return true; }
|
||||
|
||||
|
@ -257,20 +257,20 @@ void paintRow(
|
|||
st::msgNameFont->height);
|
||||
|
||||
const auto promoted = chat.entry()->useProxyPromotion()
|
||||
&& !(flags & (Flag::SearchResult | Flag::FeedSearchResult));
|
||||
&& !(flags & (Flag::SearchResult/* | Flag::FeedSearchResult*/)); // #feed
|
||||
if (promoted) {
|
||||
const auto text = lang(lng_proxy_sponsor);
|
||||
paintRowTopRight(p, text, rectForName, active, selected);
|
||||
} else if (from && !(flags & Flag::FeedSearchResult)) {
|
||||
} else if (from/* && !(flags & Flag::FeedSearchResult)*/) { // #feed
|
||||
if (const auto chatTypeIcon = ChatTypeIcon(from, active, selected)) {
|
||||
chatTypeIcon->paint(p, rectForName.topLeft(), fullWidth);
|
||||
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
|
||||
}
|
||||
} else if (const auto feed = chat.feed()) {
|
||||
if (const auto feedTypeIcon = FeedTypeIcon(feed, active, selected)) {
|
||||
feedTypeIcon->paint(p, rectForName.topLeft(), fullWidth);
|
||||
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
|
||||
}
|
||||
//} else if (const auto feed = chat.feed()) { // #feed
|
||||
// if (const auto feedTypeIcon = FeedTypeIcon(feed, active, selected)) {
|
||||
// feedTypeIcon->paint(p, rectForName.topLeft(), fullWidth);
|
||||
// rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
|
||||
// }
|
||||
}
|
||||
auto texttop = st::dialogsPadding.y()
|
||||
+ st::msgNameFont->height
|
||||
|
@ -462,14 +462,14 @@ const style::icon *ChatTypeIcon(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
const style::icon *FeedTypeIcon(
|
||||
not_null<Data::Feed*> feed,
|
||||
bool active,
|
||||
bool selected) {
|
||||
return &(active ? st::dialogsFeedIconActive
|
||||
: (selected ? st::dialogsFeedIconOver : st::dialogsFeedIcon));
|
||||
}
|
||||
|
||||
//const style::icon *FeedTypeIcon( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// bool active,
|
||||
// bool selected) {
|
||||
// return &(active ? st::dialogsFeedIconActive
|
||||
// : (selected ? st::dialogsFeedIconOver : st::dialogsFeedIcon));
|
||||
//}
|
||||
//
|
||||
void paintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st) {
|
||||
Assert(rect.height() == st.size);
|
||||
|
||||
|
@ -789,8 +789,8 @@ void RowPainter::paint(
|
|||
| (selected ? Flag::Selected : Flag(0))
|
||||
| (onlyBackground ? Flag::OnlyBackground : Flag(0))
|
||||
| Flag::SearchResult
|
||||
| (showSavedMessages ? Flag::SavedMessages : Flag(0))
|
||||
| (row->searchInChat().feed() ? Flag::FeedSearchResult : Flag(0));
|
||||
| (showSavedMessages ? Flag::SavedMessages : Flag(0))/* // #feed
|
||||
| (row->searchInChat().feed() ? Flag::FeedSearchResult : Flag(0))*/;
|
||||
paintRow(
|
||||
p,
|
||||
row,
|
||||
|
|
|
@ -7,10 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
} // namespace Data
|
||||
|
||||
namespace Dialogs {
|
||||
|
||||
class Row;
|
||||
|
@ -22,10 +18,10 @@ const style::icon *ChatTypeIcon(
|
|||
not_null<PeerData*> peer,
|
||||
bool active,
|
||||
bool selected);
|
||||
const style::icon *FeedTypeIcon(
|
||||
not_null<Data::Feed*> feed,
|
||||
bool active,
|
||||
bool selected);
|
||||
//const style::icon *FeedTypeIcon( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// bool active,
|
||||
// bool selected);
|
||||
|
||||
class RowPainter {
|
||||
public:
|
||||
|
|
|
@ -55,8 +55,8 @@ public:
|
|||
History *history() const {
|
||||
return _id.history();
|
||||
}
|
||||
Data::Feed *feed() const {
|
||||
return _id.feed();
|
||||
Data::Folder *folder() const {
|
||||
return _id.folder();
|
||||
}
|
||||
not_null<Entry*> entry() const {
|
||||
return _id.entry();
|
||||
|
|
|
@ -12,7 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "dialogs/dialogs_key.h"
|
||||
#include "dialogs/dialogs_entry.h"
|
||||
#include "history/history.h"
|
||||
#include "history/feed/history_feed_section.h"
|
||||
//#include "history/feed/history_feed_section.h" // #feed
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/wrap/fade_wrap.h"
|
||||
|
@ -752,17 +752,17 @@ bool DialogsWidget::onSearchMessages(bool searchCache) {
|
|||
MTP_int(0)),
|
||||
rpcDone(&DialogsWidget::searchReceived, DialogsSearchPeerFromStart),
|
||||
rpcFail(&DialogsWidget::searchFailed, DialogsSearchPeerFromStart));
|
||||
} else if (const auto feed = _searchInChat.feed()) {
|
||||
//_searchRequest = MTP::send( // #feed
|
||||
// MTPchannels_SearchFeed(
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_string(_searchQuery),
|
||||
// MTP_int(0),
|
||||
// MTP_inputPeerEmpty(),
|
||||
// MTP_int(0),
|
||||
// MTP_int(SearchPerPage)),
|
||||
// rpcDone(&DialogsWidget::searchReceived, DialogsSearchFromStart),
|
||||
// rpcFail(&DialogsWidget::searchFailed, DialogsSearchFromStart));
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// _searchRequest = MTP::send(
|
||||
// MTPchannels_SearchFeed(
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_string(_searchQuery),
|
||||
// MTP_int(0),
|
||||
// MTP_inputPeerEmpty(),
|
||||
// MTP_int(0),
|
||||
// MTP_int(SearchPerPage)),
|
||||
// rpcDone(&DialogsWidget::searchReceived, DialogsSearchFromStart),
|
||||
// rpcFail(&DialogsWidget::searchFailed, DialogsSearchFromStart));
|
||||
} else {
|
||||
_searchRequest = MTP::send(
|
||||
MTPmessages_SearchGlobal(
|
||||
|
@ -888,19 +888,19 @@ void DialogsWidget::onSearchMore() {
|
|||
MTP_int(0)),
|
||||
rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart),
|
||||
rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchPeerFromOffset : DialogsSearchPeerFromStart));
|
||||
} else if (const auto feed = _searchInChat.feed()) {
|
||||
//_searchRequest = MTP::send( // #feed
|
||||
// MTPchannels_SearchFeed(
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_string(_searchQuery),
|
||||
// MTP_int(offsetDate),
|
||||
// offsetPeer
|
||||
// ? offsetPeer->input
|
||||
// : MTP_inputPeerEmpty(),
|
||||
// MTP_int(offsetId),
|
||||
// MTP_int(SearchPerPage)),
|
||||
// rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart),
|
||||
// rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart));
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// _searchRequest = MTP::send(
|
||||
// MTPchannels_SearchFeed(
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_string(_searchQuery),
|
||||
// MTP_int(offsetDate),
|
||||
// offsetPeer
|
||||
// ? offsetPeer->input
|
||||
// : MTP_inputPeerEmpty(),
|
||||
// MTP_int(offsetId),
|
||||
// MTP_int(SearchPerPage)),
|
||||
// rpcDone(&DialogsWidget::searchReceived, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart),
|
||||
// rpcFail(&DialogsWidget::searchFailed, offsetId ? DialogsSearchFromOffset : DialogsSearchFromStart));
|
||||
} else {
|
||||
_searchRequest = MTP::send(
|
||||
MTPmessages_SearchGlobal(
|
||||
|
@ -1599,8 +1599,8 @@ bool DialogsWidget::onCancelSearch() {
|
|||
if (Adaptive::OneColumn()) {
|
||||
if (const auto peer = _searchInChat.peer()) {
|
||||
Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
|
||||
} else if (const auto feed = _searchInChat.feed()) {
|
||||
controller()->showSection(HistoryFeed::Memento(feed));
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// controller()->showSection(HistoryFeed::Memento(feed));
|
||||
} else {
|
||||
Unexpected("Empty key in onCancelSearch().");
|
||||
}
|
||||
|
@ -1624,8 +1624,8 @@ void DialogsWidget::onCancelSearchInChat() {
|
|||
if (Adaptive::OneColumn() && !App::main()->selectingPeer()) {
|
||||
if (const auto peer = _searchInChat.peer()) {
|
||||
Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
|
||||
} else if (const auto feed = _searchInChat.feed()) {
|
||||
controller()->showSection(HistoryFeed::Memento(feed));
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// controller()->showSection(HistoryFeed::Memento(feed));
|
||||
} else {
|
||||
Unexpected("Empty key in onCancelSearchInPeer().");
|
||||
}
|
||||
|
|
|
@ -1457,6 +1457,7 @@ DialogsInfo ParseDialogsInfo(const MTPmessages_Dialogs &data) {
|
|||
result.chats.reserve(result.chats.size() + data.vdialogs.v.size());
|
||||
for (const auto &dialog : data.vdialogs.v) {
|
||||
if (dialog.type() != mtpc_dialog) {
|
||||
LOG(("API Error: Unexpected dialog type in chats export."));
|
||||
continue;
|
||||
}
|
||||
const auto &fields = dialog.c_dialog();
|
||||
|
|
|
@ -28,10 +28,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/localstorage.h"
|
||||
#include "storage/storage_facade.h"
|
||||
#include "storage/storage_shared_media.h"
|
||||
#include "storage/storage_feed_messages.h"
|
||||
//#include "storage/storage_feed_messages.h" // #feed
|
||||
#include "support/support_helper.h"
|
||||
#include "data/data_channel_admins.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
|
@ -158,13 +158,13 @@ void History::checkChatListMessageRemoved(not_null<HistoryItem*> item) {
|
|||
}
|
||||
_chatListMessage = std::nullopt;
|
||||
refreshChatListMessage();
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
if (const auto feed = channel->feed()) {
|
||||
// Must be after history->chatListMessage() is updated.
|
||||
// Otherwise feed last message will be this value again.
|
||||
feed->messageRemoved(item);
|
||||
}
|
||||
}
|
||||
//if (const auto channel = peer->asChannel()) { // #feed
|
||||
// if (const auto feed = channel->feed()) {
|
||||
// // Must be after history->chatListMessage() is updated.
|
||||
// // Otherwise feed last message will be this value again.
|
||||
// feed->messageRemoved(item);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
void History::itemVanished(not_null<HistoryItem*> item) {
|
||||
|
@ -1711,12 +1711,12 @@ void History::changeUnreadCount(int delta) {
|
|||
if (_unreadCount) {
|
||||
setUnreadCount(std::max(*_unreadCount + delta, 0));
|
||||
}
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
if (const auto feed = channel->feed()) {
|
||||
const auto mutedCountDelta = mute() ? delta : 0;
|
||||
feed->unreadCountChanged(delta, mutedCountDelta);
|
||||
}
|
||||
}
|
||||
//if (const auto channel = peer->asChannel()) { // #feed
|
||||
// if (const auto feed = channel->feed()) {
|
||||
// const auto mutedCountDelta = mute() ? delta : 0;
|
||||
// feed->unreadCountChanged(delta, mutedCountDelta);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
bool History::mute() const {
|
||||
|
@ -1729,21 +1729,21 @@ bool History::changeMute(bool newMute) {
|
|||
}
|
||||
_mute = newMute;
|
||||
|
||||
const auto feed = peer->isChannel()
|
||||
? peer->asChannel()->feed()
|
||||
: nullptr;
|
||||
if (feed) {
|
||||
if (_unreadCount) {
|
||||
if (*_unreadCount) {
|
||||
const auto unreadCountDelta = 0;
|
||||
const auto mutedCountDelta = _mute ? *_unreadCount : -*_unreadCount;
|
||||
feed->unreadCountChanged(unreadCountDelta, mutedCountDelta);
|
||||
}
|
||||
} else {
|
||||
session().api().requestDialogEntry(this);
|
||||
session().api().requestDialogEntry(feed);
|
||||
}
|
||||
}
|
||||
//const auto feed = peer->isChannel() // #feed
|
||||
// ? peer->asChannel()->feed()
|
||||
// : nullptr;
|
||||
//if (feed) {
|
||||
// if (_unreadCount) {
|
||||
// if (*_unreadCount) {
|
||||
// const auto unreadCountDelta = 0;
|
||||
// const auto mutedCountDelta = _mute ? *_unreadCount : -*_unreadCount;
|
||||
// feed->unreadCountChanged(unreadCountDelta, mutedCountDelta);
|
||||
// }
|
||||
// } else {
|
||||
// session().api().requestDialogEntry(this);
|
||||
// session().api().requestDialogEntry(feed);
|
||||
// }
|
||||
//}
|
||||
if (inChatList(Dialogs::Mode::All)) {
|
||||
if (const auto count = historiesUnreadCount()) {
|
||||
_owner->unreadMuteChanged(count, _mute);
|
||||
|
@ -2135,26 +2135,26 @@ void History::setNotLoadedAtBottom() {
|
|||
|
||||
session().storage().invalidate(
|
||||
Storage::SharedMediaInvalidateBottom(peer->id));
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
if (const auto feed = channel->feed()) {
|
||||
session().storage().invalidate(
|
||||
Storage::FeedMessagesInvalidateBottom(
|
||||
feed->id()));
|
||||
}
|
||||
}
|
||||
//if (const auto channel = peer->asChannel()) { // #feed
|
||||
// if (const auto feed = channel->feed()) {
|
||||
// session().storage().invalidate(
|
||||
// Storage::FeedMessagesInvalidateBottom(
|
||||
// feed->id()));
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
void History::clearSharedMedia() {
|
||||
session().storage().remove(
|
||||
Storage::SharedMediaRemoveAll(peer->id));
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
if (const auto feed = channel->feed()) {
|
||||
session().storage().remove(
|
||||
Storage::FeedMessagesRemoveAll(
|
||||
feed->id(),
|
||||
channel->bareId()));
|
||||
}
|
||||
}
|
||||
//if (const auto channel = peer->asChannel()) { // #feed
|
||||
// if (const auto feed = channel->feed()) {
|
||||
// session().storage().remove(
|
||||
// Storage::FeedMessagesRemoveAll(
|
||||
// feed->id(),
|
||||
// channel->bareId()));
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
void History::setLastMessage(HistoryItem *item) {
|
||||
|
@ -2348,15 +2348,15 @@ bool History::lastMessageKnown() const {
|
|||
|
||||
void History::updateChatListExistence() {
|
||||
Entry::updateChatListExistence();
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
if (!channel->feed()) {
|
||||
// After ungrouping from a feed we need to load dialog.
|
||||
requestChatListMessage();
|
||||
if (!unreadCountKnown()) {
|
||||
session().api().requestDialogEntry(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
//if (const auto channel = peer->asChannel()) { // #feed
|
||||
// if (!channel->feed()) {
|
||||
// // After ungrouping from a feed we need to load dialog.
|
||||
// requestChatListMessage();
|
||||
// if (!unreadCountKnown()) {
|
||||
// session().api().requestDialogEntry(this);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
bool History::useProxyPromotion() const {
|
||||
|
@ -2376,8 +2376,8 @@ bool History::shouldBeInChatList() const {
|
|||
} else if (const auto channel = peer->asChannel()) {
|
||||
if (!channel->amIn()) {
|
||||
return isProxyPromoted();
|
||||
} else if (const auto feed = channel->feed()) {
|
||||
return !feed->needUpdateInChatList();
|
||||
//} else if (const auto feed = channel->feed()) { // #feed
|
||||
// return !feed->needUpdateInChatList();
|
||||
}
|
||||
} else if (const auto chat = peer->asChat()) {
|
||||
return chat->amIn()
|
||||
|
@ -2966,10 +2966,10 @@ void History::clear(ClearType type) {
|
|||
clearLastKeyboard();
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
channel->clearPinnedMessage();
|
||||
if (const auto feed = channel->feed()) {
|
||||
// Should be after resetting the _lastMessage.
|
||||
feed->historyCleared(this);
|
||||
}
|
||||
//if (const auto feed = channel->feed()) { // #feed
|
||||
// // Should be after resetting the _lastMessage.
|
||||
// feed->historyCleared(this);
|
||||
//}
|
||||
}
|
||||
}
|
||||
_owner->notifyHistoryChangeDelayed(this);
|
||||
|
|
|
@ -23,7 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/file_upload.h"
|
||||
#include "storage/storage_facade.h"
|
||||
#include "storage/storage_shared_media.h"
|
||||
#include "storage/storage_feed_messages.h"
|
||||
//#include "storage/storage_feed_messages.h" // #feed
|
||||
#include "auth_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
|
@ -34,7 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_session.h"
|
||||
#include "data/data_messages.h"
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_user.h"
|
||||
|
@ -229,12 +229,12 @@ void HistoryItem::invalidateChatListEntry() {
|
|||
if (history()->textCachedFor == this) {
|
||||
history()->textCachedFor = nullptr;
|
||||
}
|
||||
if (const auto feed = history()->peer->feed()) {
|
||||
if (feed->textCachedFor == this) {
|
||||
feed->textCachedFor = nullptr;
|
||||
feed->updateChatListEntry();
|
||||
}
|
||||
}
|
||||
//if (const auto feed = history()->peer->feed()) { // #TODO archive
|
||||
// if (feed->textCachedFor == this) {
|
||||
// feed->textCachedFor = nullptr;
|
||||
// feed->updateChatListEntry();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
void HistoryItem::finishEditionToEmpty() {
|
||||
|
@ -402,13 +402,13 @@ void HistoryItem::indexAsNewItem() {
|
|||
types,
|
||||
id));
|
||||
}
|
||||
if (const auto channel = history()->peer->asChannel()) {
|
||||
if (const auto feed = channel->feed()) {
|
||||
_history->session().storage().add(Storage::FeedMessagesAddNew(
|
||||
feed->id(),
|
||||
position()));
|
||||
}
|
||||
}
|
||||
//if (const auto channel = history()->peer->asChannel()) { // #feed
|
||||
// if (const auto feed = channel->feed()) {
|
||||
// _history->session().storage().add(Storage::FeedMessagesAddNew(
|
||||
// feed->id(),
|
||||
// position()));
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_message.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/view/history_view_service_message.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_game.h"
|
||||
|
@ -722,12 +722,12 @@ void HistoryService::updateDependentText() {
|
|||
if (history()->textCachedFor == this) {
|
||||
history()->textCachedFor = nullptr;
|
||||
}
|
||||
if (const auto feed = history()->peer->feed()) {
|
||||
if (feed->textCachedFor == this) {
|
||||
feed->textCachedFor = nullptr;
|
||||
feed->updateChatListEntry();
|
||||
}
|
||||
}
|
||||
//if (const auto feed = history()->peer->feed()) { // #TODO archive
|
||||
// if (feed->textCachedFor == this) {
|
||||
// feed->textCachedFor = nullptr;
|
||||
// feed->updateChatListEntry();
|
||||
// }
|
||||
//}
|
||||
if (const auto main = App::main()) {
|
||||
// #TODO feeds search results
|
||||
main->repaintDialogRow({ history(), fullId() });
|
||||
|
|
|
@ -40,7 +40,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_drag_area.h"
|
||||
#include "history/history_inner_widget.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/feed/history_feed_section.h"
|
||||
//#include "history/feed/history_feed_section.h" // #feed
|
||||
#include "history/view/history_view_service_message.h"
|
||||
#include "history/view/history_view_element.h"
|
||||
#include "profile/profile_block_group_members.h"
|
||||
|
|
|
@ -41,16 +41,16 @@ namespace {
|
|||
// If we can't cloud-export link for such time we export it locally.
|
||||
constexpr auto kExportLocalTimeout = crl::time(1000);
|
||||
|
||||
void AddToggleGroupingAction(
|
||||
not_null<Ui::PopupMenu*> menu,
|
||||
not_null<PeerData*> peer) {
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
const auto grouped = (channel->feed() != nullptr);
|
||||
//menu->addAction( // #feed
|
||||
// lang(grouped ? lng_feed_ungroup : lng_feed_group),
|
||||
// [=] { Window::ToggleChannelGrouping(channel, !grouped); });
|
||||
}
|
||||
}
|
||||
//void AddToggleGroupingAction( // #feed
|
||||
// not_null<Ui::PopupMenu*> menu,
|
||||
// not_null<PeerData*> peer) {
|
||||
// if (const auto channel = peer->asChannel()) {
|
||||
// const auto grouped = (channel->feed() != nullptr);
|
||||
// menu->addAction( // #feed
|
||||
// lang(grouped ? lng_feed_ungroup : lng_feed_group),
|
||||
// [=] { Window::ToggleChannelGrouping(channel, !grouped); });
|
||||
// }
|
||||
//}
|
||||
|
||||
void SavePhotoToFile(not_null<PhotoData*> photo) {
|
||||
if (photo->isNull() || !photo->loaded()) {
|
||||
|
@ -469,18 +469,18 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
|
|||
AddPhotoActions(result, photo);
|
||||
} else if (linkDocument) {
|
||||
AddDocumentActions(result, document, itemId);
|
||||
} else if (linkPeer) {
|
||||
const auto peer = linkPeer->peer();
|
||||
if (peer->isChannel()
|
||||
&& peer->asChannel()->feed() != nullptr
|
||||
&& (list->delegate()->listContext() == Context::Feed)) {
|
||||
Window::PeerMenuAddMuteAction(peer, [&](
|
||||
const QString &text,
|
||||
Fn<void()> handler) {
|
||||
return result->addAction(text, handler);
|
||||
});
|
||||
AddToggleGroupingAction(result, linkPeer->peer());
|
||||
}
|
||||
//} else if (linkPeer) { // #feed
|
||||
// const auto peer = linkPeer->peer();
|
||||
// if (peer->isChannel()
|
||||
// && peer->asChannel()->feed() != nullptr
|
||||
// && (list->delegate()->listContext() == Context::Feed)) {
|
||||
// Window::PeerMenuAddMuteAction(peer, [&](
|
||||
// const QString &text,
|
||||
// Fn<void()> handler) {
|
||||
// return result->addAction(text, handler);
|
||||
// });
|
||||
// AddToggleGroupingAction(result, linkPeer->peer());
|
||||
// }
|
||||
} else if (!request.overSelection && view && !hasSelection) {
|
||||
const auto media = view->media();
|
||||
const auto mediaHasTextForCopy = media && media->hasTextForCopy();
|
||||
|
|
|
@ -326,9 +326,10 @@ bool Element::computeIsAttachToPrevious(not_null<Element*> previous) {
|
|||
const auto prev = previous->data();
|
||||
const auto possible = !item->serviceMsg() && !prev->serviceMsg()
|
||||
&& !item->isEmpty() && !prev->isEmpty()
|
||||
&& (std::abs(prev->date() - item->date()) < kAttachMessageToPreviousSecondsDelta)
|
||||
&& (_context == Context::Feed
|
||||
|| (!item->isPost() && !prev->isPost()));
|
||||
&& (std::abs(prev->date() - item->date())
|
||||
< kAttachMessageToPreviousSecondsDelta)
|
||||
&& (/*_context == Context::Feed // #feed
|
||||
|| */(!item->isPost() && !prev->isPost()));
|
||||
if (possible) {
|
||||
if (item->history()->peer->isSelf()) {
|
||||
return IsAttachedToPreviousInSavedMessages(prev, item);
|
||||
|
|
|
@ -27,7 +27,7 @@ struct TextState;
|
|||
|
||||
enum class Context : char {
|
||||
History,
|
||||
Feed,
|
||||
//Feed, // #feed
|
||||
AdminLog,
|
||||
ContactPreview
|
||||
};
|
||||
|
|
|
@ -31,7 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "lang/lang_keys.h"
|
||||
#include "boxes/peers/edit_participant_box.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_peer.h"
|
||||
|
|
|
@ -704,7 +704,7 @@ bool Message::hasFromPhoto() const {
|
|||
}
|
||||
switch (context()) {
|
||||
case Context::AdminLog:
|
||||
case Context::Feed:
|
||||
//case Context::Feed: // #feed
|
||||
return true;
|
||||
case Context::History: {
|
||||
const auto item = message();
|
||||
|
@ -1311,7 +1311,7 @@ HistoryWebPage *Message::logEntryOriginal() const {
|
|||
bool Message::hasFromName() const {
|
||||
switch (context()) {
|
||||
case Context::AdminLog:
|
||||
case Context::Feed:
|
||||
//case Context::Feed: // #feed
|
||||
return true;
|
||||
case Context::History: {
|
||||
const auto item = message();
|
||||
|
|
|
@ -376,9 +376,9 @@ QSize Service::performCountOptimalSize() {
|
|||
}
|
||||
|
||||
bool Service::isHidden() const {
|
||||
if (context() == Context::Feed) {
|
||||
return true;
|
||||
}
|
||||
//if (context() == Context::Feed) { // #feed
|
||||
// return true;
|
||||
//}
|
||||
return Element::isHidden();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_peer_menu.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "data/data_peer_values.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
|
@ -219,10 +219,10 @@ void TopBarWidget::showMenu() {
|
|||
peer,
|
||||
addAction,
|
||||
Window::PeerMenuSource::History);
|
||||
} else if (const auto feed = _activeChat.feed()) {
|
||||
Window::FillFeedMenu(
|
||||
} else if (const auto folder = _activeChat.folder()) {
|
||||
Window::FillFolderMenu(
|
||||
_controller,
|
||||
feed,
|
||||
folder,
|
||||
addAction,
|
||||
Window::PeerMenuSource::History);
|
||||
} else {
|
||||
|
@ -237,13 +237,13 @@ void TopBarWidget::toggleInfoSection() {
|
|||
&& (Auth().settings().thirdSectionInfoEnabled()
|
||||
|| Auth().settings().tabbedReplacedWithInfo())) {
|
||||
_controller->closeThirdSection();
|
||||
} else if (_activeChat) {
|
||||
} else if (_activeChat.peer()) {
|
||||
if (_controller->canShowThirdSection()) {
|
||||
Auth().settings().setThirdSectionInfoEnabled(true);
|
||||
Auth().saveSettingsDelayed();
|
||||
if (Adaptive::ThreeColumn()) {
|
||||
_controller->showSection(
|
||||
Info::Memento::Default(_activeChat),
|
||||
Info::Memento::Default(_activeChat.peer()),
|
||||
Window::SectionShow().withThirdColumn());
|
||||
} else {
|
||||
_controller->resizeForThirdSection();
|
||||
|
@ -297,7 +297,7 @@ void TopBarWidget::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
|
||||
void TopBarWidget::paintTopBar(Painter &p) {
|
||||
if (!_activeChat) {
|
||||
if (!_activeChat.peer()) { // #feed
|
||||
return;
|
||||
}
|
||||
auto nameleft = _leftTaken;
|
||||
|
@ -308,7 +308,7 @@ void TopBarWidget::paintTopBar(Painter &p) {
|
|||
auto history = _activeChat.history();
|
||||
|
||||
p.setPen(st::dialogsNameFg);
|
||||
if (const auto feed = _activeChat.feed()) {
|
||||
/*if (const auto feed = _activeChat.feed()) { // #feed
|
||||
auto text = feed->chatListName(); // TODO feed name emoji
|
||||
auto textWidth = st::historySavedFont->width(text);
|
||||
if (namewidth < textWidth) {
|
||||
|
@ -320,7 +320,7 @@ void TopBarWidget::paintTopBar(Painter &p) {
|
|||
(height() - st::historySavedFont->height) / 2,
|
||||
width(),
|
||||
text);
|
||||
} else if (_activeChat.peer()->isSelf()) {
|
||||
} else */if (_activeChat.peer()->isSelf()) {
|
||||
auto text = lang(lng_saved_messages);
|
||||
auto textWidth = st::historySavedFont->width(text);
|
||||
if (namewidth < textWidth) {
|
||||
|
@ -411,12 +411,12 @@ void TopBarWidget::mousePressEvent(QMouseEvent *e) {
|
|||
}
|
||||
|
||||
void TopBarWidget::infoClicked() {
|
||||
if (!_activeChat) {
|
||||
if (!_activeChat.peer()) {
|
||||
return;
|
||||
} else if (const auto feed = _activeChat.feed()) {
|
||||
_controller->showSection(Info::Memento(
|
||||
feed,
|
||||
Info::Section(Info::Section::Type::Profile)));
|
||||
//} else if (const auto feed = _activeChat.feed()) { // #feed
|
||||
// _controller->showSection(Info::Memento(
|
||||
// feed,
|
||||
// Info::Section(Info::Section::Type::Profile)));
|
||||
} else if (_activeChat.peer()->isSelf()) {
|
||||
_controller->showSection(Info::Memento(
|
||||
_activeChat.peer()->id,
|
||||
|
@ -458,13 +458,13 @@ void TopBarWidget::refreshInfoButton() {
|
|||
info->showSavedMessagesOnSelf(true);
|
||||
_info.destroy();
|
||||
_info = std::move(info);
|
||||
} else if (const auto feed = _activeChat.feed()) {
|
||||
_info.destroy();
|
||||
_info = object_ptr<Ui::FeedUserpicButton>(
|
||||
this,
|
||||
_controller,
|
||||
feed,
|
||||
st::topBarFeedInfoButton);
|
||||
//} else if (const auto feed = _activeChat.feed()) { // #feed
|
||||
// _info.destroy();
|
||||
// _info = object_ptr<Ui::FeedUserpicButton>(
|
||||
// this,
|
||||
// _controller,
|
||||
// feed,
|
||||
// st::topBarFeedInfoButton);
|
||||
}
|
||||
if (_info) {
|
||||
_info->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
|
|
@ -297,25 +297,21 @@ void NotificationsController::applyFeedDialogs(
|
|||
auto channels = std::vector<not_null<ChannelData*>>();
|
||||
channels.reserve(dialogsList->size());
|
||||
for (const auto &dialog : *dialogsList) {
|
||||
switch (dialog.type()) {
|
||||
case mtpc_dialog: {
|
||||
if (const auto peerId = peerFromMTP(dialog.c_dialog().vpeer)) {
|
||||
if (peerIsChannel(peerId)) {
|
||||
dialog.match([&](const MTPDdialog &data) {
|
||||
if (const auto peerId = peerFromMTP(data.vpeer)) {
|
||||
if (peerIsChannel(peerId)) { // #TODO archive
|
||||
const auto history = Auth().data().history(peerId);
|
||||
const auto channel = history->peer->asChannel();
|
||||
history->applyDialog(dialog.c_dialog());
|
||||
history->applyDialog(data);
|
||||
channels.emplace_back(channel);
|
||||
} else {
|
||||
LOG(("API Error: "
|
||||
"Unexpected non-channel in feed dialogs list."));
|
||||
"Unexpected non-channel in folder dialogs list."));
|
||||
}
|
||||
}
|
||||
} break;
|
||||
//case mtpc_dialogFeed: { // #feed
|
||||
// LOG(("API Error: Unexpected dialogFeed in feed dialogs list."));
|
||||
//} break;
|
||||
default: Unexpected("Type in DialogsInner::dialogsReceived");
|
||||
}
|
||||
}, [&](const MTPDdialogFolder &data) {
|
||||
LOG(("API Error: Unexpected dialogFolder in folder dialogs list."));
|
||||
});
|
||||
}
|
||||
if (!channels.empty()) {
|
||||
auto notMutedChannels = ranges::view::all(
|
||||
|
|
|
@ -262,8 +262,8 @@ void ContentWidget::refreshSearchField(bool shown) {
|
|||
Key ContentMemento::key() const {
|
||||
if (const auto peerId = this->peerId()) {
|
||||
return Key(Auth().data().peer(peerId));
|
||||
} else if (const auto feed = this->feed()) {
|
||||
return Key(feed);
|
||||
//} else if (const auto feed = this->feed()) { // #feed
|
||||
// return Key(feed);
|
||||
} else {
|
||||
return Settings::Tag{ settingsSelf() };
|
||||
}
|
||||
|
|
|
@ -23,10 +23,6 @@ template <typename Widget>
|
|||
class PaddingWrap;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
} // namespace Data
|
||||
|
||||
namespace Info {
|
||||
namespace Settings {
|
||||
struct Tag;
|
||||
|
@ -124,8 +120,8 @@ public:
|
|||
: _peerId(peerId)
|
||||
, _migratedPeerId(migratedPeerId) {
|
||||
}
|
||||
explicit ContentMemento(not_null<Data::Feed*> feed) : _feed(feed) {
|
||||
}
|
||||
//explicit ContentMemento(not_null<Data::Feed*> feed) : _feed(feed) { // #feed
|
||||
//}
|
||||
explicit ContentMemento(Settings::Tag settings);
|
||||
|
||||
virtual object_ptr<ContentWidget> createWidget(
|
||||
|
@ -139,9 +135,9 @@ public:
|
|||
PeerId migratedPeerId() const {
|
||||
return _migratedPeerId;
|
||||
}
|
||||
Data::Feed *feed() const {
|
||||
return _feed;
|
||||
}
|
||||
//Data::Feed *feed() const { // #feed
|
||||
// return _feed;
|
||||
//}
|
||||
UserData *settingsSelf() const {
|
||||
return _settingsSelf;
|
||||
}
|
||||
|
@ -179,7 +175,7 @@ public:
|
|||
private:
|
||||
const PeerId _peerId = 0;
|
||||
const PeerId _migratedPeerId = 0;
|
||||
Data::Feed * const _feed = nullptr;
|
||||
//Data::Feed * const _feed = nullptr; // #feed
|
||||
UserData * const _settingsSelf = nullptr;
|
||||
int _scrollTop = 0;
|
||||
QString _searchFieldQuery;
|
||||
|
|
|
@ -40,8 +40,8 @@ not_null<PeerData*> CorrectPeer(PeerId peerId) {
|
|||
Key::Key(not_null<PeerData*> peer) : _value(peer) {
|
||||
}
|
||||
|
||||
Key::Key(not_null<Data::Feed*> feed) : _value(feed) {
|
||||
}
|
||||
//Key::Key(not_null<Data::Feed*> feed) : _value(feed) { // #feed
|
||||
//}
|
||||
|
||||
Key::Key(Settings::Tag settings) : _value(settings) {
|
||||
}
|
||||
|
@ -53,12 +53,12 @@ PeerData *Key::peer() const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Data::Feed *Key::feed() const {
|
||||
if (const auto feed = base::get_if<not_null<Data::Feed*>>(&_value)) {
|
||||
return *feed;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
//Data::Feed *Key::feed() const { // #feed
|
||||
// if (const auto feed = base::get_if<not_null<Data::Feed*>>(&_value)) {
|
||||
// return *feed;
|
||||
// }
|
||||
// return nullptr;
|
||||
//}
|
||||
|
||||
UserData *Key::settingsSelf() const {
|
||||
if (const auto tag = base::get_if<Settings::Tag>(&_value)) {
|
||||
|
@ -167,7 +167,7 @@ bool Controller::validateMementoPeer(
|
|||
not_null<ContentMemento*> memento) const {
|
||||
return memento->peerId() == peerId()
|
||||
&& memento->migratedPeerId() == migratedPeerId()
|
||||
&& memento->feed() == feed()
|
||||
//&& memento->feed() == feed() // #feed
|
||||
&& memento->settingsSelf() == settingsSelf();
|
||||
}
|
||||
|
||||
|
@ -190,8 +190,8 @@ void Controller::updateSearchControllers(
|
|||
= (type == Type::CommonGroups);
|
||||
auto hasMembersSearch
|
||||
= (type == Type::Members
|
||||
|| type == Type::Profile
|
||||
|| type == Type::Channels);
|
||||
|| type == Type::Profile/* // #feed
|
||||
|| type == Type::Channels*/);
|
||||
auto searchQuery = memento->searchFieldQuery();
|
||||
if (isMedia) {
|
||||
_searchController
|
||||
|
|
|
@ -31,17 +31,17 @@ struct Tag {
|
|||
class Key {
|
||||
public:
|
||||
Key(not_null<PeerData*> peer);
|
||||
Key(not_null<Data::Feed*> feed);
|
||||
//Key(not_null<Data::Feed*> feed); // #feed
|
||||
Key(Settings::Tag settings);
|
||||
|
||||
PeerData *peer() const;
|
||||
Data::Feed *feed() const;
|
||||
//Data::Feed *feed() const; // #feed
|
||||
UserData *settingsSelf() const;
|
||||
|
||||
private:
|
||||
base::variant<
|
||||
not_null<PeerData*>,
|
||||
not_null<Data::Feed*>,
|
||||
//not_null<Data::Feed*>, // #feed
|
||||
Settings::Tag> _value;
|
||||
|
||||
};
|
||||
|
@ -58,7 +58,7 @@ public:
|
|||
Media,
|
||||
CommonGroups,
|
||||
Members,
|
||||
Channels,
|
||||
//Channels, // #feed
|
||||
Settings,
|
||||
};
|
||||
using SettingsType = ::Settings::Type;
|
||||
|
@ -107,9 +107,9 @@ public:
|
|||
|
||||
PeerId peerId() const;
|
||||
PeerId migratedPeerId() const;
|
||||
Data::Feed *feed() const {
|
||||
return key().feed();
|
||||
}
|
||||
//Data::Feed *feed() const { // #feed
|
||||
// return key().feed();
|
||||
//}
|
||||
UserData *settingsSelf() const {
|
||||
return key().settingsSelf();
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "info/profile/info_profile_widget.h"
|
||||
#include "info/media/info_media_widget.h"
|
||||
#include "info/members/info_members_widget.h"
|
||||
#include "info/channels/info_channels_widget.h"
|
||||
//#include "info/channels/info_channels_widget.h" // #feed
|
||||
#include "info/common_groups/info_common_groups_widget.h"
|
||||
#include "info/feed/info_feed_profile_widget.h"
|
||||
//#include "info/feed/info_feed_profile_widget.h" // #feed
|
||||
#include "info/settings/info_settings_widget.h"
|
||||
#include "info/info_section_widget.h"
|
||||
#include "info/info_layer_widget.h"
|
||||
|
@ -33,10 +33,10 @@ Memento::Memento(PeerId peerId, Section section)
|
|||
: Memento(DefaultStack(peerId, section)) {
|
||||
}
|
||||
|
||||
Memento::Memento(not_null<Data::Feed*> feed, Section section)
|
||||
: Memento(DefaultStack(feed, section)) {
|
||||
}
|
||||
|
||||
//Memento::Memento(not_null<Data::Feed*> feed, Section section) // #feed
|
||||
//: Memento(DefaultStack(feed, section)) {
|
||||
//}
|
||||
//
|
||||
Memento::Memento(Settings::Tag settings, Section section)
|
||||
: Memento(DefaultStack(settings, section)) {
|
||||
}
|
||||
|
@ -53,14 +53,14 @@ std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack(
|
|||
return result;
|
||||
}
|
||||
|
||||
std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack(
|
||||
not_null<Data::Feed*> feed,
|
||||
Section section) {
|
||||
auto result = std::vector<std::unique_ptr<ContentMemento>>();
|
||||
result.push_back(DefaultContent(feed, section));
|
||||
return result;
|
||||
}
|
||||
|
||||
//std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section) {
|
||||
// auto result = std::vector<std::unique_ptr<ContentMemento>>();
|
||||
// result.push_back(DefaultContent(feed, section));
|
||||
// return result;
|
||||
//}
|
||||
//
|
||||
std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack(
|
||||
Settings::Tag settings,
|
||||
Section section) {
|
||||
|
@ -71,21 +71,32 @@ std::vector<std::unique_ptr<ContentMemento>> Memento::DefaultStack(
|
|||
return result;
|
||||
}
|
||||
|
||||
Section Memento::DefaultSection(Dialogs::Key key) {
|
||||
if (const auto peer = key.peer()) {
|
||||
if (peer->isSelf()) {
|
||||
return Section(Section::MediaType::Photo);
|
||||
}
|
||||
Section Memento::DefaultSection(not_null<PeerData*> peer) {
|
||||
if (peer->isSelf()) {
|
||||
return Section(Section::MediaType::Photo);
|
||||
}
|
||||
return Section(Section::Type::Profile);
|
||||
}
|
||||
// // #feed
|
||||
//Section Memento::DefaultSection(Dialogs::Key key) {
|
||||
// if (const auto peer = key.peer()) {
|
||||
// if (peer->isSelf()) {
|
||||
// return Section(Section::MediaType::Photo);
|
||||
// }
|
||||
// }
|
||||
// return Section(Section::Type::Profile);
|
||||
//}
|
||||
|
||||
Memento Memento::Default(Dialogs::Key key) {
|
||||
if (const auto peer = key.peer()) {
|
||||
return Memento(peer->id, DefaultSection(key));
|
||||
}
|
||||
return Memento(key.feed(), DefaultSection(key));
|
||||
Memento Memento::Default(not_null<PeerData*> peer) {
|
||||
return Memento(peer->id, DefaultSection(peer));
|
||||
}
|
||||
// // #feed
|
||||
//Memento Memento::Default(Dialogs::Key key) {
|
||||
// if (const auto peer = key.peer()) {
|
||||
// return Memento(peer->id, DefaultSection(key));
|
||||
// }
|
||||
// return Memento(key.feed(), DefaultSection(key));
|
||||
//}
|
||||
|
||||
std::unique_ptr<ContentMemento> Memento::DefaultContent(
|
||||
PeerId peerId,
|
||||
|
@ -121,18 +132,18 @@ std::unique_ptr<ContentMemento> Memento::DefaultContent(
|
|||
}
|
||||
Unexpected("Wrong section type in Info::Memento::DefaultContent()");
|
||||
}
|
||||
|
||||
std::unique_ptr<ContentMemento> Memento::DefaultContent(
|
||||
not_null<Data::Feed*> feed,
|
||||
Section section) {
|
||||
switch (section.type()) {
|
||||
case Section::Type::Profile:
|
||||
return std::make_unique<FeedProfile::Memento>(feed);
|
||||
case Section::Type::Channels:
|
||||
return std::make_unique<Channels::Memento>(feed);
|
||||
}
|
||||
Unexpected("Wrong feed section in Info::Memento::DefaultContent()");
|
||||
}
|
||||
//
|
||||
//std::unique_ptr<ContentMemento> Memento::DefaultContent( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section) {
|
||||
// switch (section.type()) {
|
||||
// case Section::Type::Profile:
|
||||
// return std::make_unique<FeedProfile::Memento>(feed);
|
||||
// case Section::Type::Channels:
|
||||
// return std::make_unique<Channels::Memento>(feed);
|
||||
// }
|
||||
// Unexpected("Wrong feed section in Info::Memento::DefaultContent()");
|
||||
//}
|
||||
|
||||
object_ptr<Window::SectionWidget> Memento::createWidget(
|
||||
QWidget *parent,
|
||||
|
|
|
@ -16,10 +16,6 @@ namespace Storage {
|
|||
enum class SharedMediaType : signed char;
|
||||
} // namespace Storage
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
} // namespace Data
|
||||
|
||||
namespace Ui {
|
||||
class ScrollArea;
|
||||
struct ScrollToRequest;
|
||||
|
@ -37,7 +33,7 @@ class Memento final : public Window::SectionMemento {
|
|||
public:
|
||||
explicit Memento(PeerId peerId);
|
||||
Memento(PeerId peerId, Section section);
|
||||
Memento(not_null<Data::Feed*> feed, Section section);
|
||||
//Memento(not_null<Data::Feed*> feed, Section section); // #feed
|
||||
Memento(Settings::Tag settings, Section section);
|
||||
explicit Memento(std::vector<std::unique_ptr<ContentMemento>> stack);
|
||||
|
||||
|
@ -62,8 +58,10 @@ public:
|
|||
return _stack.back().get();
|
||||
}
|
||||
|
||||
static Section DefaultSection(Dialogs::Key key);
|
||||
static Memento Default(Dialogs::Key key);
|
||||
static Section DefaultSection(not_null<PeerData*> peer);
|
||||
//static Section DefaultSection(Dialogs::Key key); // #feed
|
||||
static Memento Default(not_null<PeerData*> peer);
|
||||
//static Memento Default(Dialogs::Key key); // #feed
|
||||
|
||||
~Memento();
|
||||
|
||||
|
@ -71,15 +69,15 @@ private:
|
|||
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
||||
PeerId peerId,
|
||||
Section section);
|
||||
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
||||
not_null<Data::Feed*> feed,
|
||||
Section section);
|
||||
//static std::vector<std::unique_ptr<ContentMemento>> DefaultStack( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section);
|
||||
static std::vector<std::unique_ptr<ContentMemento>> DefaultStack(
|
||||
Settings::Tag settings,
|
||||
Section section);
|
||||
static std::unique_ptr<ContentMemento> DefaultContent(
|
||||
not_null<Data::Feed*> feed,
|
||||
Section section);
|
||||
//static std::unique_ptr<ContentMemento> DefaultContent( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section);
|
||||
|
||||
static std::unique_ptr<ContentMemento> DefaultContent(
|
||||
PeerId peerId,
|
||||
|
|
|
@ -554,9 +554,9 @@ rpl::producer<QString> TitleValue(
|
|||
|
||||
switch (section.type()) {
|
||||
case Section::Type::Profile:
|
||||
if (const auto feed = key.feed()) {
|
||||
/*if (const auto feed = key.feed()) {
|
||||
return lng_info_feed_title;
|
||||
} else if (const auto user = peer->asUser()) {
|
||||
} else */if (const auto user = peer->asUser()) {
|
||||
return (user->isBot() && !user->isSupport())
|
||||
? lng_info_bot_title
|
||||
: lng_info_user_title;
|
||||
|
@ -597,8 +597,8 @@ rpl::producer<QString> TitleValue(
|
|||
case Section::Type::Members:
|
||||
return lng_profile_participants_section;
|
||||
|
||||
case Section::Type::Channels:
|
||||
return lng_info_feed_channels;
|
||||
//case Section::Type::Channels: // #feed
|
||||
// return lng_info_feed_channels;
|
||||
|
||||
case Section::Type::Settings:
|
||||
switch (section.settingsType()) {
|
||||
|
|
|
@ -131,8 +131,8 @@ void WrapWidget::startInjectingActivePeerProfiles() {
|
|||
void WrapWidget::injectActiveProfile(Dialogs::Key key) {
|
||||
if (const auto peer = key.peer()) {
|
||||
injectActivePeerProfile(peer);
|
||||
} else if (const auto feed = key.feed()) {
|
||||
injectActiveFeedProfile(feed);
|
||||
//} else if (const auto feed = key.feed()) { // #feed
|
||||
// injectActiveFeedProfile(feed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -167,22 +167,22 @@ void WrapWidget::injectActivePeerProfile(not_null<PeerData*> peer) {
|
|||
Memento(peer->id, section).takeStack().front()));
|
||||
}
|
||||
}
|
||||
|
||||
void WrapWidget::injectActiveFeedProfile(not_null<Data::Feed*> feed) {
|
||||
const auto firstFeed = hasStackHistory()
|
||||
? _historyStack.front().section->feed()
|
||||
: _controller->feed();
|
||||
const auto firstSectionType = hasStackHistory()
|
||||
? _historyStack.front().section->section().type()
|
||||
: _controller->section().type();
|
||||
const auto expectedType = Section::Type::Profile;
|
||||
if (firstSectionType != expectedType
|
||||
|| firstFeed != feed) {
|
||||
auto section = Section(Section::Type::Profile);
|
||||
injectActiveProfileMemento(std::move(
|
||||
Memento(feed, section).takeStack().front()));
|
||||
}
|
||||
}
|
||||
// // #feed
|
||||
//void WrapWidget::injectActiveFeedProfile(not_null<Data::Feed*> feed) {
|
||||
// const auto firstFeed = hasStackHistory()
|
||||
// ? _historyStack.front().section->feed()
|
||||
// : _controller->feed();
|
||||
// const auto firstSectionType = hasStackHistory()
|
||||
// ? _historyStack.front().section->section().type()
|
||||
// : _controller->section().type();
|
||||
// const auto expectedType = Section::Type::Profile;
|
||||
// if (firstSectionType != expectedType
|
||||
// || firstFeed != feed) {
|
||||
// auto section = Section(Section::Type::Profile);
|
||||
// injectActiveProfileMemento(std::move(
|
||||
// Memento(feed, section).takeStack().front()));
|
||||
// }
|
||||
//}
|
||||
|
||||
void WrapWidget::injectActiveProfileMemento(
|
||||
std::unique_ptr<ContentMemento> memento) {
|
||||
|
@ -214,8 +214,8 @@ Key WrapWidget::key() const {
|
|||
Dialogs::RowDescriptor WrapWidget::activeChat() const {
|
||||
if (const auto peer = key().peer()) {
|
||||
return Dialogs::RowDescriptor(peer->owner().history(peer), FullMsgId());
|
||||
} else if (const auto feed = key().feed()) {
|
||||
return Dialogs::RowDescriptor(feed, FullMsgId());
|
||||
//} else if (const auto feed = key().feed()) { // #feed
|
||||
// return Dialogs::RowDescriptor(feed, FullMsgId());
|
||||
} else if (key().settingsSelf()) {
|
||||
return Dialogs::RowDescriptor();
|
||||
}
|
||||
|
@ -570,12 +570,12 @@ void WrapWidget::showTopBarMenu() {
|
|||
peer,
|
||||
addAction,
|
||||
Window::PeerMenuSource::Profile);
|
||||
} else if (const auto feed = key().feed()) {
|
||||
Window::FillFeedMenu(
|
||||
_controller->parentController(),
|
||||
feed,
|
||||
addAction,
|
||||
Window::PeerMenuSource::Profile);
|
||||
//} else if (const auto feed = key().feed()) { // #feed
|
||||
// Window::FillFeedMenu(
|
||||
// _controller->parentController(),
|
||||
// feed,
|
||||
// addAction,
|
||||
// Window::PeerMenuSource::Profile);
|
||||
} else if (const auto self = key().settingsSelf()) {
|
||||
const auto showOther = [=](::Settings::Type type) {
|
||||
const auto controller = _controller.get();
|
||||
|
|
|
@ -14,10 +14,6 @@ namespace Storage {
|
|||
enum class SharedMediaType : signed char;
|
||||
} // namespace Storage
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
} // namespace Data
|
||||
|
||||
namespace Ui {
|
||||
class SettingsSlider;
|
||||
class FadeShadow;
|
||||
|
@ -148,7 +144,7 @@ private:
|
|||
void startInjectingActivePeerProfiles();
|
||||
void injectActiveProfile(Dialogs::Key key);
|
||||
void injectActivePeerProfile(not_null<PeerData*> peer);
|
||||
void injectActiveFeedProfile(not_null<Data::Feed*> feed);
|
||||
//void injectActiveFeedProfile(not_null<Data::Feed*> feed); // #feed
|
||||
void injectActiveProfileMemento(
|
||||
std::unique_ptr<ContentMemento> memento);
|
||||
void checkBeforeClose(Fn<void()> close);
|
||||
|
|
|
@ -7,11 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "info/profile/info_profile_actions.h"
|
||||
|
||||
#include <rpl/flatten_latest.h>
|
||||
#include <rpl/combine.h>
|
||||
#include "data/data_peer_values.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_user.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
|
@ -167,37 +165,37 @@ private:
|
|||
object_ptr<Ui::VerticalLayout> _wrap = { nullptr };
|
||||
|
||||
};
|
||||
|
||||
class FeedDetailsFiller {
|
||||
public:
|
||||
FeedDetailsFiller(
|
||||
not_null<Controller*> controller,
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<Data::Feed*> feed);
|
||||
|
||||
object_ptr<Ui::RpWidget> fill();
|
||||
|
||||
private:
|
||||
object_ptr<Ui::RpWidget> setupDefaultToggle();
|
||||
|
||||
template <
|
||||
typename Widget,
|
||||
typename = std::enable_if_t<
|
||||
std::is_base_of_v<Ui::RpWidget, Widget>>>
|
||||
Widget *add(
|
||||
object_ptr<Widget> &&child,
|
||||
const style::margins &margin = style::margins()) {
|
||||
return _wrap->add(
|
||||
std::move(child),
|
||||
margin);
|
||||
}
|
||||
|
||||
not_null<Controller*> _controller;
|
||||
not_null<Ui::RpWidget*> _parent;
|
||||
not_null<Data::Feed*> _feed;
|
||||
object_ptr<Ui::VerticalLayout> _wrap;
|
||||
|
||||
};
|
||||
// // #feed
|
||||
//class FeedDetailsFiller {
|
||||
//public:
|
||||
// FeedDetailsFiller(
|
||||
// not_null<Controller*> controller,
|
||||
// not_null<Ui::RpWidget*> parent,
|
||||
// not_null<Data::Feed*> feed);
|
||||
//
|
||||
// object_ptr<Ui::RpWidget> fill();
|
||||
//
|
||||
//private:
|
||||
// object_ptr<Ui::RpWidget> setupDefaultToggle();
|
||||
//
|
||||
// template <
|
||||
// typename Widget,
|
||||
// typename = std::enable_if_t<
|
||||
// std::is_base_of_v<Ui::RpWidget, Widget>>>
|
||||
// Widget *add(
|
||||
// object_ptr<Widget> &&child,
|
||||
// const style::margins &margin = style::margins()) {
|
||||
// return _wrap->add(
|
||||
// std::move(child),
|
||||
// margin);
|
||||
// }
|
||||
//
|
||||
// not_null<Controller*> _controller;
|
||||
// not_null<Ui::RpWidget*> _parent;
|
||||
// not_null<Data::Feed*> _feed;
|
||||
// object_ptr<Ui::VerticalLayout> _wrap;
|
||||
//
|
||||
//};
|
||||
|
||||
DetailsFiller::DetailsFiller(
|
||||
not_null<Controller*> controller,
|
||||
|
@ -703,47 +701,47 @@ object_ptr<Ui::RpWidget> ActionsFiller::fill() {
|
|||
}
|
||||
return { nullptr };
|
||||
}
|
||||
|
||||
FeedDetailsFiller::FeedDetailsFiller(
|
||||
not_null<Controller*> controller,
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<Data::Feed*> feed)
|
||||
: _controller(controller)
|
||||
, _parent(parent)
|
||||
, _feed(feed)
|
||||
, _wrap(_parent) {
|
||||
}
|
||||
|
||||
object_ptr<Ui::RpWidget> FeedDetailsFiller::fill() {
|
||||
add(object_ptr<BoxContentDivider>(_wrap));
|
||||
add(CreateSkipWidget(_wrap));
|
||||
add(setupDefaultToggle());
|
||||
add(CreateSkipWidget(_wrap));
|
||||
return std::move(_wrap);
|
||||
}
|
||||
|
||||
object_ptr<Ui::RpWidget> FeedDetailsFiller::setupDefaultToggle() {
|
||||
using namespace rpl::mappers;
|
||||
const auto feedId = _feed->id();
|
||||
auto result = object_ptr<Button>(
|
||||
_wrap,
|
||||
Lang::Viewer(lng_info_feed_is_default),
|
||||
st::infoNotificationsButton);
|
||||
result->toggleOn(
|
||||
Auth().data().defaultFeedIdValue(
|
||||
) | rpl::map(_1 == feedId)
|
||||
)->addClickHandler([=] {
|
||||
const auto makeDefault = (Auth().data().defaultFeedId() != feedId);
|
||||
const auto defaultFeedId = makeDefault ? feedId : 0;
|
||||
Auth().data().setDefaultFeedId(defaultFeedId);
|
||||
// Auth().api().saveDefaultFeedId(feedId, makeDefault); // #feed
|
||||
});
|
||||
object_ptr<FloatingIcon>(
|
||||
result,
|
||||
st::infoIconNotifications,
|
||||
st::infoNotificationsIconPosition);
|
||||
return std::move(result);
|
||||
}
|
||||
// // #feed
|
||||
//FeedDetailsFiller::FeedDetailsFiller(
|
||||
// not_null<Controller*> controller,
|
||||
// not_null<Ui::RpWidget*> parent,
|
||||
// not_null<Data::Feed*> feed)
|
||||
//: _controller(controller)
|
||||
//, _parent(parent)
|
||||
//, _feed(feed)
|
||||
//, _wrap(_parent) {
|
||||
//}
|
||||
//
|
||||
//object_ptr<Ui::RpWidget> FeedDetailsFiller::fill() {
|
||||
// add(object_ptr<BoxContentDivider>(_wrap));
|
||||
// add(CreateSkipWidget(_wrap));
|
||||
// add(setupDefaultToggle());
|
||||
// add(CreateSkipWidget(_wrap));
|
||||
// return std::move(_wrap);
|
||||
//}
|
||||
//
|
||||
//object_ptr<Ui::RpWidget> FeedDetailsFiller::setupDefaultToggle() {
|
||||
// using namespace rpl::mappers;
|
||||
// const auto feedId = _feed->id();
|
||||
// auto result = object_ptr<Button>(
|
||||
// _wrap,
|
||||
// Lang::Viewer(lng_info_feed_is_default),
|
||||
// st::infoNotificationsButton);
|
||||
// result->toggleOn(
|
||||
// Auth().data().defaultFeedIdValue(
|
||||
// ) | rpl::map(_1 == feedId)
|
||||
// )->addClickHandler([=] {
|
||||
// const auto makeDefault = (Auth().data().defaultFeedId() != feedId);
|
||||
// const auto defaultFeedId = makeDefault ? feedId : 0;
|
||||
// Auth().data().setDefaultFeedId(defaultFeedId);
|
||||
//// Auth().api().saveDefaultFeedId(feedId, makeDefault); // #feed
|
||||
// });
|
||||
// object_ptr<FloatingIcon>(
|
||||
// result,
|
||||
// st::infoIconNotifications,
|
||||
// st::infoNotificationsIconPosition);
|
||||
// return std::move(result);
|
||||
//}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -840,14 +838,14 @@ object_ptr<Ui::RpWidget> SetupChannelMembers(
|
|||
|
||||
return std::move(result);
|
||||
}
|
||||
|
||||
object_ptr<Ui::RpWidget> SetupFeedDetails(
|
||||
not_null<Controller*> controller,
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<Data::Feed*> feed) {
|
||||
FeedDetailsFiller filler(controller, parent, feed);
|
||||
return filler.fill();
|
||||
}
|
||||
// // #feed
|
||||
//object_ptr<Ui::RpWidget> SetupFeedDetails(
|
||||
// not_null<Controller*> controller,
|
||||
// not_null<Ui::RpWidget*> parent,
|
||||
// not_null<Data::Feed*> feed) {
|
||||
// FeedDetailsFiller filler(controller, parent, feed);
|
||||
// return filler.fill();
|
||||
//}
|
||||
|
||||
} // namespace Profile
|
||||
} // namespace Info
|
||||
|
|
|
@ -7,10 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
} // namespace Data
|
||||
|
||||
namespace Ui {
|
||||
class RpWidget;
|
||||
} // namespace Ui
|
||||
|
@ -35,11 +31,11 @@ object_ptr<Ui::RpWidget> SetupChannelMembers(
|
|||
not_null<Controller*> controller,
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<PeerData*> peer);
|
||||
|
||||
object_ptr<Ui::RpWidget> SetupFeedDetails(
|
||||
not_null<Controller*> controller,
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<Data::Feed*> feed);
|
||||
// // #feed
|
||||
//object_ptr<Ui::RpWidget> SetupFeedDetails(
|
||||
// not_null<Controller*> controller,
|
||||
// not_null<Ui::RpWidget*> parent,
|
||||
// not_null<Data::Feed*> feed);
|
||||
|
||||
} // namespace Profile
|
||||
} // namespace Info
|
||||
|
|
|
@ -7,17 +7,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "info/profile/info_profile_values.h"
|
||||
|
||||
#include <rpl/filter.h>
|
||||
#include <rpl/range.h>
|
||||
#include <rpl/then.h>
|
||||
#include <rpl/combine.h>
|
||||
#include "observer_peer.h"
|
||||
#include "core/application.h"
|
||||
#include "auth_session.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "data/data_peer_values.h"
|
||||
#include "data/data_shared_media.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_user.h"
|
||||
|
@ -329,21 +325,21 @@ rpl::producer<bool> VerifiedValue(not_null<PeerData*> peer) {
|
|||
}
|
||||
return rpl::single(false);
|
||||
}
|
||||
|
||||
rpl::producer<int> FeedChannelsCountValue(not_null<Data::Feed*> feed) {
|
||||
using Flag = Data::FeedUpdateFlag;
|
||||
return rpl::single(
|
||||
Data::FeedUpdate{ feed, Flag::Channels }
|
||||
) | rpl::then(
|
||||
Auth().data().feedUpdated()
|
||||
) | rpl::filter([=](const Data::FeedUpdate &update) {
|
||||
return (update.feed == feed) && (update.flag == Flag::Channels);
|
||||
}) | rpl::filter([=] {
|
||||
return feed->channelsLoaded();
|
||||
}) | rpl::map([=] {
|
||||
return int(feed->channels().size());
|
||||
}) | rpl::distinct_until_changed();
|
||||
}
|
||||
// // #feed
|
||||
//rpl::producer<int> FeedChannelsCountValue(not_null<Data::Feed*> feed) {
|
||||
// using Flag = Data::FeedUpdateFlag;
|
||||
// return rpl::single(
|
||||
// Data::FeedUpdate{ feed, Flag::Channels }
|
||||
// ) | rpl::then(
|
||||
// Auth().data().feedUpdated()
|
||||
// ) | rpl::filter([=](const Data::FeedUpdate &update) {
|
||||
// return (update.feed == feed) && (update.flag == Flag::Channels);
|
||||
// }) | rpl::filter([=] {
|
||||
// return feed->channelsLoaded();
|
||||
// }) | rpl::map([=] {
|
||||
// return int(feed->channels().size());
|
||||
// }) | rpl::distinct_until_changed();
|
||||
//}
|
||||
|
||||
} // namespace Profile
|
||||
} // namespace Info
|
||||
|
|
|
@ -67,7 +67,7 @@ rpl::producer<int> CommonGroupsCountValue(not_null<UserData*> user);
|
|||
rpl::producer<bool> CanAddMemberValue(not_null<PeerData*> peer);
|
||||
rpl::producer<bool> VerifiedValue(not_null<PeerData*> peer);
|
||||
|
||||
rpl::producer<int> FeedChannelsCountValue(not_null<Data::Feed*> feed);
|
||||
//rpl::producer<int> FeedChannelsCountValue(not_null<Data::Feed*> feed); // #feed
|
||||
|
||||
} // namespace Profile
|
||||
} // namespace Info
|
||||
|
|
|
@ -18,7 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_drafts.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_user.h"
|
||||
|
@ -2395,9 +2395,10 @@ void MainWidget::updateControlsGeometry() {
|
|||
if (session().settings().tabbedSelectorSectionEnabled()) {
|
||||
_history->pushTabbedSelectorToThirdSection(params);
|
||||
} else if (session().settings().thirdSectionInfoEnabled()) {
|
||||
if (const auto key = _controller->activeChatCurrent()) {
|
||||
const auto active = _controller->activeChatCurrent();
|
||||
if (const auto peer = active.peer()) {
|
||||
_controller->showSection(
|
||||
Info::Memento::Default(key),
|
||||
Info::Memento::Default(peer),
|
||||
params.withThirdColumn());
|
||||
}
|
||||
}
|
||||
|
@ -2605,11 +2606,11 @@ auto MainWidget::thirdSectionForCurrentMainSection(
|
|||
} else if (const auto peer = key.peer()) {
|
||||
return std::make_unique<Info::Memento>(
|
||||
peer->id,
|
||||
Info::Memento::DefaultSection(key));
|
||||
} else if (const auto feed = key.feed()) {
|
||||
return std::make_unique<Info::Memento>(
|
||||
feed,
|
||||
Info::Memento::DefaultSection(key));
|
||||
Info::Memento::DefaultSection(peer));
|
||||
//} else if (const auto feed = key.feed()) { // #feed
|
||||
// return std::make_unique<Info::Memento>(
|
||||
// feed,
|
||||
// Info::Memento::DefaultSection(key));
|
||||
}
|
||||
Unexpected("Key in MainWidget::thirdSectionForCurrentMainSection().");
|
||||
}
|
||||
|
@ -4281,35 +4282,17 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
|||
const auto &d = update.c_updatePinnedDialogs();
|
||||
if (d.has_order()) {
|
||||
const auto &order = d.vorder.v;
|
||||
const auto allLoaded = [&] {
|
||||
for (const auto &dialogPeer : order) {
|
||||
switch (dialogPeer.type()) {
|
||||
case mtpc_dialogPeer: {
|
||||
const auto &peer = dialogPeer.c_dialogPeer();
|
||||
const auto peerId = peerFromMTP(peer.vpeer);
|
||||
if (!session().data().historyLoaded(peerId)) {
|
||||
DEBUG_LOG(("API Error: "
|
||||
"pinned chat not loaded for peer %1"
|
||||
).arg(peerId
|
||||
));
|
||||
return false;
|
||||
}
|
||||
} break;
|
||||
//case mtpc_dialogPeerFeed: { // #feed
|
||||
// const auto &feed = dialogPeer.c_dialogPeerFeed();
|
||||
// const auto feedId = feed.vfeed_id.v;
|
||||
// if (!session().data().feedLoaded(feedId)) {
|
||||
// DEBUG_LOG(("API Error: "
|
||||
// "pinned feed not loaded for feedId %1"
|
||||
// ).arg(feedId
|
||||
// ));
|
||||
// return false;
|
||||
// }
|
||||
//} break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}();
|
||||
const auto notLoaded = [&](const MTPDialogPeer &peer) {
|
||||
return peer.match([&](const MTPDdialogPeer &data) {
|
||||
return !session().data().historyLoaded(
|
||||
peerFromMTP(data.vpeer));
|
||||
}, [&](const MTPDdialogPeerFolder &data) {
|
||||
//return !session().data().folderLoaded(data.vfolder_id.v);
|
||||
return true; // #TODO archive
|
||||
});
|
||||
};
|
||||
const auto allLoaded = ranges::find_if(order, notLoaded)
|
||||
== order.end();
|
||||
if (allLoaded) {
|
||||
session().data().applyPinnedDialogs(order);
|
||||
} else {
|
||||
|
@ -4322,32 +4305,30 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
|||
|
||||
case mtpc_updateDialogPinned: {
|
||||
const auto &d = update.c_updateDialogPinned();
|
||||
switch (d.vpeer.type()) {
|
||||
case mtpc_dialogPeer: {
|
||||
const auto peerId = peerFromMTP(d.vpeer.c_dialogPeer().vpeer);
|
||||
if (const auto history = session().data().historyLoaded(peerId)) {
|
||||
d.vpeer.match([&](const MTPDdialogPeer &data) {
|
||||
const auto id = peerFromMTP(data.vpeer);
|
||||
if (const auto history = session().data().historyLoaded(id)) {
|
||||
session().data().setPinnedDialog(history, d.is_pinned());
|
||||
} else {
|
||||
DEBUG_LOG(("API Error: "
|
||||
"pinned chat not loaded for peer %1"
|
||||
).arg(peerId
|
||||
).arg(id
|
||||
));
|
||||
_dialogs->loadPinnedDialogs();
|
||||
}
|
||||
} break;
|
||||
//case mtpc_dialogPeerFeed: { // #feed
|
||||
// const auto feedId = d.vpeer.c_dialogPeerFeed().vfeed_id.v;
|
||||
// if (const auto feed = session().data().feedLoaded(feedId)) {
|
||||
// session().data().setPinnedDialog(feed, d.is_pinned());
|
||||
// } else {
|
||||
// DEBUG_LOG(("API Error: "
|
||||
// "pinned feed not loaded for feedId %1"
|
||||
// ).arg(feedId
|
||||
// ));
|
||||
// _dialogs->loadPinnedDialogs();
|
||||
// }
|
||||
//} break;
|
||||
}
|
||||
}, [&](const MTPDdialogPeerFolder &data) {
|
||||
// #TODO archive
|
||||
//const auto id = data.vfolder_id.v;
|
||||
//if (const auto folder = session().data().folderLoaded(id)) {
|
||||
// session().data().setPinnedDialog(folder, d.is_pinned());
|
||||
//} else {
|
||||
// DEBUG_LOG(("API Error: "
|
||||
// "pinned folder not loaded for feedId %1"
|
||||
// ).arg(folderId
|
||||
// ));
|
||||
// _dialogs->loadPinnedDialogs();
|
||||
//}
|
||||
});
|
||||
} break;
|
||||
|
||||
case mtpc_updateChannel: {
|
||||
|
@ -4356,17 +4337,17 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
|
|||
channel->inviter = UserId(0);
|
||||
if (channel->amIn()) {
|
||||
const auto history = channel->owner().history(channel);
|
||||
if (const auto feed = channel->feed()) {
|
||||
feed->requestChatListMessage();
|
||||
if (!feed->unreadCountKnown()) {
|
||||
feed->session().api().requestDialogEntry(feed);
|
||||
}
|
||||
} else {
|
||||
//if (const auto feed = channel->feed()) { // #feed
|
||||
// feed->requestChatListMessage();
|
||||
// if (!feed->unreadCountKnown()) {
|
||||
// feed->session().api().requestDialogEntry(feed);
|
||||
// }
|
||||
//} else {
|
||||
history->requestChatListMessage();
|
||||
if (!history->unreadCountKnown()) {
|
||||
history->session().api().requestDialogEntry(history);
|
||||
}
|
||||
}
|
||||
//}
|
||||
if (!channel->amCreator()) {
|
||||
session().api().requestSelfParticipant(channel);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "storage/storage_shared_media.h"
|
||||
#include "storage/storage_user_photos.h"
|
||||
#include "storage/storage_feed_messages.h"
|
||||
//#include "storage/storage_feed_messages.h" // #feed
|
||||
|
||||
namespace Storage {
|
||||
|
||||
|
@ -34,24 +34,24 @@ public:
|
|||
rpl::producer<UserPhotosResult> query(UserPhotosQuery &&query) const;
|
||||
rpl::producer<UserPhotosSliceUpdate> userPhotosSliceUpdated() const;
|
||||
|
||||
void add(FeedMessagesAddNew &&query);
|
||||
void add(FeedMessagesAddSlice &&query);
|
||||
void remove(FeedMessagesRemoveOne &&query);
|
||||
void remove(FeedMessagesRemoveAll &&query);
|
||||
void invalidate(FeedMessagesInvalidate &&query);
|
||||
void invalidate(FeedMessagesInvalidateBottom &&query);
|
||||
rpl::producer<FeedMessagesResult> query(
|
||||
FeedMessagesQuery &&query) const;
|
||||
rpl::producer<FeedMessagesSliceUpdate> feedMessagesSliceUpdated() const;
|
||||
rpl::producer<FeedMessagesRemoveOne> feedMessagesOneRemoved() const;
|
||||
rpl::producer<FeedMessagesRemoveAll> feedMessagesAllRemoved() const;
|
||||
rpl::producer<FeedMessagesInvalidate> feedMessagesInvalidated() const;
|
||||
rpl::producer<FeedMessagesInvalidateBottom> feedMessagesBottomInvalidated() const;
|
||||
//void add(FeedMessagesAddNew &&query); // #feed
|
||||
//void add(FeedMessagesAddSlice &&query);
|
||||
//void remove(FeedMessagesRemoveOne &&query);
|
||||
//void remove(FeedMessagesRemoveAll &&query);
|
||||
//void invalidate(FeedMessagesInvalidate &&query);
|
||||
//void invalidate(FeedMessagesInvalidateBottom &&query);
|
||||
//rpl::producer<FeedMessagesResult> query(
|
||||
// FeedMessagesQuery &&query) const;
|
||||
//rpl::producer<FeedMessagesSliceUpdate> feedMessagesSliceUpdated() const;
|
||||
//rpl::producer<FeedMessagesRemoveOne> feedMessagesOneRemoved() const;
|
||||
//rpl::producer<FeedMessagesRemoveAll> feedMessagesAllRemoved() const;
|
||||
//rpl::producer<FeedMessagesInvalidate> feedMessagesInvalidated() const;
|
||||
//rpl::producer<FeedMessagesInvalidateBottom> feedMessagesBottomInvalidated() const;
|
||||
|
||||
private:
|
||||
SharedMedia _sharedMedia;
|
||||
UserPhotos _userPhotos;
|
||||
FeedMessages _feedMessages;
|
||||
//FeedMessages _feedMessages; // #feed
|
||||
|
||||
};
|
||||
|
||||
|
@ -122,55 +122,55 @@ rpl::producer<UserPhotosResult> Facade::Impl::query(UserPhotosQuery &&query) con
|
|||
rpl::producer<UserPhotosSliceUpdate> Facade::Impl::userPhotosSliceUpdated() const {
|
||||
return _userPhotos.sliceUpdated();
|
||||
}
|
||||
|
||||
void Facade::Impl::add(FeedMessagesAddNew &&query) {
|
||||
return _feedMessages.add(std::move(query));
|
||||
}
|
||||
|
||||
void Facade::Impl::add(FeedMessagesAddSlice &&query) {
|
||||
return _feedMessages.add(std::move(query));
|
||||
}
|
||||
|
||||
void Facade::Impl::remove(FeedMessagesRemoveOne &&query) {
|
||||
return _feedMessages.remove(std::move(query));
|
||||
}
|
||||
|
||||
void Facade::Impl::remove(FeedMessagesRemoveAll &&query) {
|
||||
return _feedMessages.remove(std::move(query));
|
||||
}
|
||||
|
||||
void Facade::Impl::invalidate(FeedMessagesInvalidate &&query) {
|
||||
return _feedMessages.invalidate(std::move(query));
|
||||
}
|
||||
|
||||
void Facade::Impl::invalidate(FeedMessagesInvalidateBottom &&query) {
|
||||
return _feedMessages.invalidate(std::move(query));
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesResult> Facade::Impl::query(
|
||||
FeedMessagesQuery &&query) const {
|
||||
return _feedMessages.query(std::move(query));
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesSliceUpdate> Facade::Impl::feedMessagesSliceUpdated() const {
|
||||
return _feedMessages.sliceUpdated();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesRemoveOne> Facade::Impl::feedMessagesOneRemoved() const {
|
||||
return _feedMessages.oneRemoved();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesRemoveAll> Facade::Impl::feedMessagesAllRemoved() const {
|
||||
return _feedMessages.allRemoved();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesInvalidate> Facade::Impl::feedMessagesInvalidated() const {
|
||||
return _feedMessages.invalidated();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesInvalidateBottom> Facade::Impl::feedMessagesBottomInvalidated() const {
|
||||
return _feedMessages.bottomInvalidated();
|
||||
}
|
||||
// // #feed
|
||||
//void Facade::Impl::add(FeedMessagesAddNew &&query) {
|
||||
// return _feedMessages.add(std::move(query));
|
||||
//}
|
||||
//
|
||||
//void Facade::Impl::add(FeedMessagesAddSlice &&query) {
|
||||
// return _feedMessages.add(std::move(query));
|
||||
//}
|
||||
//
|
||||
//void Facade::Impl::remove(FeedMessagesRemoveOne &&query) {
|
||||
// return _feedMessages.remove(std::move(query));
|
||||
//}
|
||||
//
|
||||
//void Facade::Impl::remove(FeedMessagesRemoveAll &&query) {
|
||||
// return _feedMessages.remove(std::move(query));
|
||||
//}
|
||||
//
|
||||
//void Facade::Impl::invalidate(FeedMessagesInvalidate &&query) {
|
||||
// return _feedMessages.invalidate(std::move(query));
|
||||
//}
|
||||
//
|
||||
//void Facade::Impl::invalidate(FeedMessagesInvalidateBottom &&query) {
|
||||
// return _feedMessages.invalidate(std::move(query));
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesResult> Facade::Impl::query(
|
||||
// FeedMessagesQuery &&query) const {
|
||||
// return _feedMessages.query(std::move(query));
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesSliceUpdate> Facade::Impl::feedMessagesSliceUpdated() const {
|
||||
// return _feedMessages.sliceUpdated();
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesRemoveOne> Facade::Impl::feedMessagesOneRemoved() const {
|
||||
// return _feedMessages.oneRemoved();
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesRemoveAll> Facade::Impl::feedMessagesAllRemoved() const {
|
||||
// return _feedMessages.allRemoved();
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesInvalidate> Facade::Impl::feedMessagesInvalidated() const {
|
||||
// return _feedMessages.invalidated();
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesInvalidateBottom> Facade::Impl::feedMessagesBottomInvalidated() const {
|
||||
// return _feedMessages.bottomInvalidated();
|
||||
//}
|
||||
|
||||
Facade::Facade() : _impl(std::make_unique<Impl>()) {
|
||||
}
|
||||
|
@ -242,55 +242,55 @@ rpl::producer<UserPhotosResult> Facade::query(UserPhotosQuery &&query) const {
|
|||
rpl::producer<UserPhotosSliceUpdate> Facade::userPhotosSliceUpdated() const {
|
||||
return _impl->userPhotosSliceUpdated();
|
||||
}
|
||||
|
||||
void Facade::add(FeedMessagesAddNew &&query) {
|
||||
return _impl->add(std::move(query));
|
||||
}
|
||||
|
||||
void Facade::add(FeedMessagesAddSlice &&query) {
|
||||
return _impl->add(std::move(query));
|
||||
}
|
||||
|
||||
void Facade::remove(FeedMessagesRemoveOne &&query) {
|
||||
return _impl->remove(std::move(query));
|
||||
}
|
||||
|
||||
void Facade::remove(FeedMessagesRemoveAll &&query) {
|
||||
return _impl->remove(std::move(query));
|
||||
}
|
||||
|
||||
void Facade::invalidate(FeedMessagesInvalidate &&query) {
|
||||
return _impl->invalidate(std::move(query));
|
||||
}
|
||||
|
||||
void Facade::invalidate(FeedMessagesInvalidateBottom &&query) {
|
||||
return _impl->invalidate(std::move(query));
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesResult> Facade::query(
|
||||
FeedMessagesQuery &&query) const {
|
||||
return _impl->query(std::move(query));
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesSliceUpdate> Facade::feedMessagesSliceUpdated() const {
|
||||
return _impl->feedMessagesSliceUpdated();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesRemoveOne> Facade::feedMessagesOneRemoved() const {
|
||||
return _impl->feedMessagesOneRemoved();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesRemoveAll> Facade::feedMessagesAllRemoved() const {
|
||||
return _impl->feedMessagesAllRemoved();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesInvalidate> Facade::feedMessagesInvalidated() const {
|
||||
return _impl->feedMessagesInvalidated();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesInvalidateBottom> Facade::feedMessagesBottomInvalidated() const {
|
||||
return _impl->feedMessagesBottomInvalidated();
|
||||
}
|
||||
// // #feed
|
||||
//void Facade::add(FeedMessagesAddNew &&query) {
|
||||
// return _impl->add(std::move(query));
|
||||
//}
|
||||
//
|
||||
//void Facade::add(FeedMessagesAddSlice &&query) {
|
||||
// return _impl->add(std::move(query));
|
||||
//}
|
||||
//
|
||||
//void Facade::remove(FeedMessagesRemoveOne &&query) {
|
||||
// return _impl->remove(std::move(query));
|
||||
//}
|
||||
//
|
||||
//void Facade::remove(FeedMessagesRemoveAll &&query) {
|
||||
// return _impl->remove(std::move(query));
|
||||
//}
|
||||
//
|
||||
//void Facade::invalidate(FeedMessagesInvalidate &&query) {
|
||||
// return _impl->invalidate(std::move(query));
|
||||
//}
|
||||
//
|
||||
//void Facade::invalidate(FeedMessagesInvalidateBottom &&query) {
|
||||
// return _impl->invalidate(std::move(query));
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesResult> Facade::query(
|
||||
// FeedMessagesQuery &&query) const {
|
||||
// return _impl->query(std::move(query));
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesSliceUpdate> Facade::feedMessagesSliceUpdated() const {
|
||||
// return _impl->feedMessagesSliceUpdated();
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesRemoveOne> Facade::feedMessagesOneRemoved() const {
|
||||
// return _impl->feedMessagesOneRemoved();
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesRemoveAll> Facade::feedMessagesAllRemoved() const {
|
||||
// return _impl->feedMessagesAllRemoved();
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesInvalidate> Facade::feedMessagesInvalidated() const {
|
||||
// return _impl->feedMessagesInvalidated();
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedMessagesInvalidateBottom> Facade::feedMessagesBottomInvalidated() const {
|
||||
// return _impl->feedMessagesBottomInvalidated();
|
||||
//}
|
||||
|
||||
Facade::~Facade() = default;
|
||||
|
||||
|
|
|
@ -36,15 +36,15 @@ struct UserPhotosQuery;
|
|||
struct UserPhotosResult;
|
||||
struct UserPhotosSliceUpdate;
|
||||
|
||||
struct FeedMessagesAddNew;
|
||||
struct FeedMessagesAddSlice;
|
||||
struct FeedMessagesRemoveOne;
|
||||
struct FeedMessagesRemoveAll;
|
||||
struct FeedMessagesInvalidate;
|
||||
struct FeedMessagesInvalidateBottom;
|
||||
struct FeedMessagesQuery;
|
||||
using FeedMessagesResult = Data::MessagesResult;
|
||||
struct FeedMessagesSliceUpdate;
|
||||
//struct FeedMessagesAddNew; // #feed
|
||||
//struct FeedMessagesAddSlice;
|
||||
//struct FeedMessagesRemoveOne;
|
||||
//struct FeedMessagesRemoveAll;
|
||||
//struct FeedMessagesInvalidate;
|
||||
//struct FeedMessagesInvalidateBottom;
|
||||
//struct FeedMessagesQuery;
|
||||
//using FeedMessagesResult = Data::MessagesResult;
|
||||
//struct FeedMessagesSliceUpdate;
|
||||
|
||||
class Facade {
|
||||
public:
|
||||
|
@ -71,20 +71,20 @@ public:
|
|||
rpl::producer<UserPhotosResult> query(UserPhotosQuery &&query) const;
|
||||
rpl::producer<UserPhotosSliceUpdate> userPhotosSliceUpdated() const;
|
||||
|
||||
void add(FeedMessagesAddNew &&query);
|
||||
void add(FeedMessagesAddSlice &&query);
|
||||
void remove(FeedMessagesRemoveOne &&query);
|
||||
void remove(FeedMessagesRemoveAll &&query);
|
||||
void invalidate(FeedMessagesInvalidate &&query);
|
||||
void invalidate(FeedMessagesInvalidateBottom &&query);
|
||||
//void add(FeedMessagesAddNew &&query); // #feed
|
||||
//void add(FeedMessagesAddSlice &&query);
|
||||
//void remove(FeedMessagesRemoveOne &&query);
|
||||
//void remove(FeedMessagesRemoveAll &&query);
|
||||
//void invalidate(FeedMessagesInvalidate &&query);
|
||||
//void invalidate(FeedMessagesInvalidateBottom &&query);
|
||||
|
||||
rpl::producer<FeedMessagesResult> query(
|
||||
FeedMessagesQuery &&query) const;
|
||||
rpl::producer<FeedMessagesSliceUpdate> feedMessagesSliceUpdated() const;
|
||||
rpl::producer<FeedMessagesRemoveOne> feedMessagesOneRemoved() const;
|
||||
rpl::producer<FeedMessagesRemoveAll> feedMessagesAllRemoved() const;
|
||||
rpl::producer<FeedMessagesInvalidate> feedMessagesInvalidated() const;
|
||||
rpl::producer<FeedMessagesInvalidateBottom> feedMessagesBottomInvalidated() const;
|
||||
//rpl::producer<FeedMessagesResult> query(
|
||||
// FeedMessagesQuery &&query) const;
|
||||
//rpl::producer<FeedMessagesSliceUpdate> feedMessagesSliceUpdated() const;
|
||||
//rpl::producer<FeedMessagesRemoveOne> feedMessagesOneRemoved() const;
|
||||
//rpl::producer<FeedMessagesRemoveAll> feedMessagesAllRemoved() const;
|
||||
//rpl::producer<FeedMessagesInvalidate> feedMessagesInvalidated() const;
|
||||
//rpl::producer<FeedMessagesInvalidateBottom> feedMessagesBottomInvalidated() const;
|
||||
|
||||
~Facade();
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/empty_userpic.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "history/history.h"
|
||||
#include "core/file_utilities.h"
|
||||
|
@ -880,95 +880,95 @@ void UserpicButton::prepareUserpicPixmap() {
|
|||
? _peer->userpicUniqueKey()
|
||||
: InMemoryKey();
|
||||
}
|
||||
|
||||
FeedUserpicButton::FeedUserpicButton(
|
||||
QWidget *parent,
|
||||
not_null<Window::Controller*> controller,
|
||||
not_null<Data::Feed*> feed,
|
||||
const style::FeedUserpicButton &st)
|
||||
: AbstractButton(parent)
|
||||
, _st(st)
|
||||
, _controller(controller)
|
||||
, _feed(feed) {
|
||||
prepare();
|
||||
}
|
||||
|
||||
void FeedUserpicButton::prepare() {
|
||||
resize(_st.size);
|
||||
|
||||
Auth().data().feedUpdated(
|
||||
) | rpl::filter([=](const Data::FeedUpdate &update) {
|
||||
return (update.feed == _feed)
|
||||
&& (update.flag == Data::FeedUpdateFlag::Channels);
|
||||
}) | rpl::start_with_next([=] {
|
||||
crl::on_main(this, [=] { checkParts(); });
|
||||
}, lifetime());
|
||||
|
||||
refreshParts();
|
||||
}
|
||||
|
||||
void FeedUserpicButton::checkParts() {
|
||||
if (!partsAreValid()) {
|
||||
refreshParts();
|
||||
}
|
||||
}
|
||||
|
||||
bool FeedUserpicButton::partsAreValid() const {
|
||||
const auto &channels = _feed->channels();
|
||||
const auto count = std::min(int(channels.size()), 4);
|
||||
if (count != _parts.size()) {
|
||||
return false;
|
||||
}
|
||||
for (auto i = 0; i != count; ++i) {
|
||||
if (channels[i]->peer != _parts[i].channel) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void FeedUserpicButton::refreshParts() {
|
||||
const auto &channels = _feed->channels();
|
||||
const auto count = std::min(int(channels.size()), 4);
|
||||
|
||||
const auto createButton = [&](not_null<ChannelData*> channel) {
|
||||
auto result = base::make_unique_q<Ui::UserpicButton>(
|
||||
this,
|
||||
_controller,
|
||||
channel,
|
||||
Ui::UserpicButton::Role::Custom,
|
||||
_st.innerPart);
|
||||
result->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
result->show();
|
||||
return result;
|
||||
};
|
||||
|
||||
const auto position = countInnerPosition();
|
||||
auto x = position.x();
|
||||
auto y = position.y();
|
||||
const auto delta = _st.innerSize - _st.innerPart.photoSize;
|
||||
_parts.clear();
|
||||
for (auto i = 0; i != count; ++i) {
|
||||
const auto channel = channels[i]->peer->asChannel();
|
||||
_parts.push_back({ channel, createButton(channel) });
|
||||
_parts.back().button->moveToLeft(x, y);
|
||||
switch (i) {
|
||||
case 0:
|
||||
case 2: x += delta; break;
|
||||
case 1: x -= delta; y += delta; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QPoint FeedUserpicButton::countInnerPosition() const {
|
||||
auto innerLeft = (_st.innerPosition.x() < 0)
|
||||
? (width() - _st.innerSize) / 2
|
||||
: _st.innerPosition.x();
|
||||
auto innerTop = (_st.innerPosition.y() < 0)
|
||||
? (height() - _st.innerSize) / 2
|
||||
: _st.innerPosition.y();
|
||||
return { innerLeft, innerTop };
|
||||
}
|
||||
// // #feed
|
||||
//FeedUserpicButton::FeedUserpicButton(
|
||||
// QWidget *parent,
|
||||
// not_null<Window::Controller*> controller,
|
||||
// not_null<Data::Feed*> feed,
|
||||
// const style::FeedUserpicButton &st)
|
||||
//: AbstractButton(parent)
|
||||
//, _st(st)
|
||||
//, _controller(controller)
|
||||
//, _feed(feed) {
|
||||
// prepare();
|
||||
//}
|
||||
//
|
||||
//void FeedUserpicButton::prepare() {
|
||||
// resize(_st.size);
|
||||
//
|
||||
// Auth().data().feedUpdated(
|
||||
// ) | rpl::filter([=](const Data::FeedUpdate &update) {
|
||||
// return (update.feed == _feed)
|
||||
// && (update.flag == Data::FeedUpdateFlag::Channels);
|
||||
// }) | rpl::start_with_next([=] {
|
||||
// crl::on_main(this, [=] { checkParts(); });
|
||||
// }, lifetime());
|
||||
//
|
||||
// refreshParts();
|
||||
//}
|
||||
//
|
||||
//void FeedUserpicButton::checkParts() {
|
||||
// if (!partsAreValid()) {
|
||||
// refreshParts();
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//bool FeedUserpicButton::partsAreValid() const {
|
||||
// const auto &channels = _feed->channels();
|
||||
// const auto count = std::min(int(channels.size()), 4);
|
||||
// if (count != _parts.size()) {
|
||||
// return false;
|
||||
// }
|
||||
// for (auto i = 0; i != count; ++i) {
|
||||
// if (channels[i]->peer != _parts[i].channel) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
//
|
||||
//void FeedUserpicButton::refreshParts() {
|
||||
// const auto &channels = _feed->channels();
|
||||
// const auto count = std::min(int(channels.size()), 4);
|
||||
//
|
||||
// const auto createButton = [&](not_null<ChannelData*> channel) {
|
||||
// auto result = base::make_unique_q<Ui::UserpicButton>(
|
||||
// this,
|
||||
// _controller,
|
||||
// channel,
|
||||
// Ui::UserpicButton::Role::Custom,
|
||||
// _st.innerPart);
|
||||
// result->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
// result->show();
|
||||
// return result;
|
||||
// };
|
||||
//
|
||||
// const auto position = countInnerPosition();
|
||||
// auto x = position.x();
|
||||
// auto y = position.y();
|
||||
// const auto delta = _st.innerSize - _st.innerPart.photoSize;
|
||||
// _parts.clear();
|
||||
// for (auto i = 0; i != count; ++i) {
|
||||
// const auto channel = channels[i]->peer->asChannel();
|
||||
// _parts.push_back({ channel, createButton(channel) });
|
||||
// _parts.back().button->moveToLeft(x, y);
|
||||
// switch (i) {
|
||||
// case 0:
|
||||
// case 2: x += delta; break;
|
||||
// case 1: x -= delta; y += delta; break;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//QPoint FeedUserpicButton::countInnerPosition() const {
|
||||
// auto innerLeft = (_st.innerPosition.x() < 0)
|
||||
// ? (width() - _st.innerSize) / 2
|
||||
// : _st.innerPosition.x();
|
||||
// auto innerTop = (_st.innerPosition.y() < 0)
|
||||
// ? (height() - _st.innerSize) / 2
|
||||
// : _st.innerPosition.y();
|
||||
// return { innerLeft, innerTop };
|
||||
//}
|
||||
|
||||
SilentToggle::SilentToggle(QWidget *parent, not_null<ChannelData*> channel)
|
||||
: IconButton(parent, st::historySilentToggle)
|
||||
|
|
|
@ -19,10 +19,6 @@ namespace Ui {
|
|||
class InfiniteRadialAnimation;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
} // namespace Data
|
||||
|
||||
namespace Window {
|
||||
class Controller;
|
||||
} // namespace Window
|
||||
|
@ -225,33 +221,33 @@ private:
|
|||
Ui::Animations::Simple _changeOverlayShown;
|
||||
|
||||
};
|
||||
|
||||
class FeedUserpicButton : public AbstractButton {
|
||||
public:
|
||||
FeedUserpicButton(
|
||||
QWidget *parent,
|
||||
not_null<Window::Controller*> controller,
|
||||
not_null<Data::Feed*> feed,
|
||||
const style::FeedUserpicButton &st);
|
||||
|
||||
private:
|
||||
struct Part {
|
||||
not_null<ChannelData*> channel;
|
||||
base::unique_qptr<UserpicButton> button;
|
||||
};
|
||||
|
||||
void prepare();
|
||||
void checkParts();
|
||||
bool partsAreValid() const;
|
||||
void refreshParts();
|
||||
QPoint countInnerPosition() const;
|
||||
|
||||
const style::FeedUserpicButton &_st;
|
||||
not_null<Window::Controller*> _controller;
|
||||
not_null<Data::Feed*> _feed;
|
||||
std::vector<Part> _parts;
|
||||
|
||||
};
|
||||
// // #feed
|
||||
//class FeedUserpicButton : public AbstractButton {
|
||||
//public:
|
||||
// FeedUserpicButton(
|
||||
// QWidget *parent,
|
||||
// not_null<Window::Controller*> controller,
|
||||
// not_null<Data::Feed*> feed,
|
||||
// const style::FeedUserpicButton &st);
|
||||
//
|
||||
//private:
|
||||
// struct Part {
|
||||
// not_null<ChannelData*> channel;
|
||||
// base::unique_qptr<UserpicButton> button;
|
||||
// };
|
||||
//
|
||||
// void prepare();
|
||||
// void checkParts();
|
||||
// bool partsAreValid() const;
|
||||
// void refreshParts();
|
||||
// QPoint countInnerPosition() const;
|
||||
//
|
||||
// const style::FeedUserpicButton &_st;
|
||||
// not_null<Window::Controller*> _controller;
|
||||
// not_null<Data::Feed*> _feed;
|
||||
// std::vector<Part> _parts;
|
||||
//
|
||||
//};
|
||||
|
||||
class SilentToggle : public Ui::IconButton, public Ui::AbstractTooltipShower {
|
||||
public:
|
||||
|
|
|
@ -13,7 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "media/audio/media_audio.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item_components.h"
|
||||
#include "history/feed/history_feed_section.h"
|
||||
//#include "history/feed/history_feed_section.h" // #feed
|
||||
#include "lang/lang_keys.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_channel.h"
|
||||
|
@ -480,17 +480,17 @@ void Manager::openNotificationMessage(
|
|||
}
|
||||
return true;
|
||||
}();
|
||||
const auto messageFeed = [&] {
|
||||
if (const auto channel = history->peer->asChannel()) {
|
||||
return channel->feed();
|
||||
}
|
||||
return (Data::Feed*)nullptr;
|
||||
}();
|
||||
//const auto messageFeed = [&] { // #feed
|
||||
// if (const auto channel = history->peer->asChannel()) {
|
||||
// return channel->feed();
|
||||
// }
|
||||
// return (Data::Feed*)nullptr;
|
||||
//}();
|
||||
if (openExactlyMessage) {
|
||||
Ui::showPeerHistory(history, messageId);
|
||||
} else if (messageFeed) {
|
||||
App::wnd()->controller()->showSection(
|
||||
HistoryFeed::Memento(messageFeed));
|
||||
//} else if (messageFeed) { // #feed
|
||||
// App::wnd()->controller()->showSection(
|
||||
// HistoryFeed::Memento(messageFeed));
|
||||
} else {
|
||||
Ui::showPeerHistory(history, ShowAtUnreadMsgId);
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/view/history_view_element.h"
|
||||
#include "history/feed/history_feed_section.h"
|
||||
//#include "history/feed/history_feed_section.h" // #feed
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "passport/passport_form_controller.h"
|
||||
|
@ -160,12 +160,12 @@ bool Controller::jumpToChatListEntry(Dialogs::RowDescriptor row) {
|
|||
if (const auto history = row.key.history()) {
|
||||
Ui::showPeerHistory(history, row.fullId.msg);
|
||||
return true;
|
||||
} else if (const auto feed = row.key.feed()) {
|
||||
if (const auto item = App::histItemById(row.fullId)) {
|
||||
showSection(HistoryFeed::Memento(feed, item->position()));
|
||||
} else {
|
||||
showSection(HistoryFeed::Memento(feed));
|
||||
}
|
||||
//} else if (const auto feed = row.key.feed()) { // #feed
|
||||
// if (const auto item = App::histItemById(row.fullId)) {
|
||||
// showSection(HistoryFeed::Memento(feed, item->position()));
|
||||
// } else {
|
||||
// showSection(HistoryFeed::Memento(feed));
|
||||
// }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -465,12 +465,12 @@ void Controller::showJumpToDate(Dialogs::Key chat, QDate requestedDate) {
|
|||
} else if (history->chatListTimeId() != 0) {
|
||||
return ParseDateTime(history->chatListTimeId()).date();
|
||||
}
|
||||
} else if (const auto feed = chat.feed()) {
|
||||
/*if (chatScrollPosition(feed)) { // #TODO feeds save position
|
||||
//} else if (const auto feed = chat.feed()) { // #feed
|
||||
// if (chatScrollPosition(feed)) { // #TODO feeds save position
|
||||
|
||||
} else */if (feed->chatListTimeId() != 0) {
|
||||
return ParseDateTime(feed->chatListTimeId()).date();
|
||||
}
|
||||
// } else if (feed->chatListTimeId() != 0) {
|
||||
// return ParseDateTime(feed->chatListTimeId()).date();
|
||||
// }
|
||||
}
|
||||
return QDate::currentDate();
|
||||
};
|
||||
|
@ -482,10 +482,10 @@ void Controller::showJumpToDate(Dialogs::Key chat, QDate requestedDate) {
|
|||
if (history && history->chatListTimeId() != 0) {
|
||||
return ParseDateTime(history->chatListTimeId()).date();
|
||||
}
|
||||
} else if (const auto feed = chat.feed()) {
|
||||
if (feed->chatListTimeId() != 0) {
|
||||
return ParseDateTime(feed->chatListTimeId()).date();
|
||||
}
|
||||
//} else if (const auto feed = chat.feed()) { // #feed
|
||||
// if (feed->chatListTimeId() != 0) {
|
||||
// return ParseDateTime(feed->chatListTimeId()).date();
|
||||
// }
|
||||
}
|
||||
return QDate::currentDate();
|
||||
};
|
||||
|
@ -512,8 +512,8 @@ void Controller::showJumpToDate(Dialogs::Key chat, QDate requestedDate) {
|
|||
}
|
||||
return QDate::currentDate();
|
||||
}
|
||||
} else if (const auto feed = chat.feed()) {
|
||||
return startDate();
|
||||
//} else if (const auto feed = chat.feed()) { // #feed
|
||||
// return startDate();
|
||||
}
|
||||
return startDate();
|
||||
};
|
||||
|
|
|
@ -26,10 +26,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "support/support_helper.h"
|
||||
#include "info/info_memento.h"
|
||||
#include "info/info_controller.h"
|
||||
#include "info/feed/info_feed_channels_controllers.h"
|
||||
//#include "info/feed/info_feed_channels_controllers.h" // #feed
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_folder.h"
|
||||
#include "data/data_poll.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
|
@ -68,11 +68,11 @@ private:
|
|||
|
||||
};
|
||||
|
||||
class FeedFiller {
|
||||
class FolderFiller {
|
||||
public:
|
||||
FeedFiller(
|
||||
FolderFiller(
|
||||
not_null<Controller*> controller,
|
||||
not_null<Data::Feed*> feed,
|
||||
not_null<Data::Folder*> folder,
|
||||
const PeerMenuCallback &addAction,
|
||||
PeerMenuSource source);
|
||||
void fill();
|
||||
|
@ -86,7 +86,7 @@ private:
|
|||
void addUngroup();
|
||||
|
||||
not_null<Controller*> _controller;
|
||||
not_null<Data::Feed*> _feed;
|
||||
not_null<Data::Folder*> _folder;
|
||||
const PeerMenuCallback &_addAction;
|
||||
PeerMenuSource _source;
|
||||
|
||||
|
@ -386,15 +386,15 @@ void Filler::addChatActions(not_null<ChatData*> chat) {
|
|||
|
||||
void Filler::addChannelActions(not_null<ChannelData*> channel) {
|
||||
auto isGroup = channel->isMegagroup();
|
||||
if (!isGroup) {
|
||||
const auto feed = channel->feed();
|
||||
const auto grouped = (feed != nullptr);
|
||||
if (!grouped || feed->channels().size() > 1) {
|
||||
//_addAction( // #feed
|
||||
// lang(grouped ? lng_feed_ungroup : lng_feed_group),
|
||||
// [=] { ToggleChannelGrouping(channel, !grouped); });
|
||||
}
|
||||
}
|
||||
//if (!isGroup) { // #feed
|
||||
// const auto feed = channel->feed();
|
||||
// const auto grouped = (feed != nullptr);
|
||||
// if (!grouped || feed->channels().size() > 1) {
|
||||
// _addAction( // #feed
|
||||
// lang(grouped ? lng_feed_ungroup : lng_feed_group),
|
||||
// [=] { ToggleChannelGrouping(channel, !grouped); });
|
||||
// }
|
||||
//}
|
||||
if (_source != PeerMenuSource::ChatsList) {
|
||||
if (EditPeerInfoBox::Available(channel)) {
|
||||
const auto text = lang(isGroup
|
||||
|
@ -479,89 +479,89 @@ void Filler::fill() {
|
|||
}
|
||||
}
|
||||
|
||||
FeedFiller::FeedFiller(
|
||||
FolderFiller::FolderFiller(
|
||||
not_null<Controller*> controller,
|
||||
not_null<Data::Feed*> feed,
|
||||
not_null<Data::Folder*> folder,
|
||||
const PeerMenuCallback &addAction,
|
||||
PeerMenuSource source)
|
||||
: _controller(controller)
|
||||
, _feed(feed)
|
||||
, _addAction(addAction)
|
||||
, _source(source) {
|
||||
: _controller(controller)
|
||||
, _folder(folder)
|
||||
, _addAction(addAction)
|
||||
, _source(source) {
|
||||
}
|
||||
|
||||
void FeedFiller::fill() {
|
||||
if (_source == PeerMenuSource::ChatsList) {
|
||||
addPinToggle();
|
||||
}
|
||||
if (showInfo()) {
|
||||
addInfo();
|
||||
}
|
||||
addNotifications();
|
||||
if (_source == PeerMenuSource::ChatsList) {
|
||||
addSearch();
|
||||
}
|
||||
addUngroup();
|
||||
}
|
||||
|
||||
bool FeedFiller::showInfo() {
|
||||
if (_source == PeerMenuSource::Profile) {
|
||||
return false;
|
||||
} else if (_controller->activeChatCurrent().feed() != _feed) {
|
||||
return true;
|
||||
} else if (!Adaptive::ThreeColumn()) {
|
||||
return true;
|
||||
} else if (
|
||||
!Auth().settings().thirdSectionInfoEnabled() &&
|
||||
!Auth().settings().tabbedReplacedWithInfo()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void FeedFiller::addPinToggle() {
|
||||
const auto feed = _feed;
|
||||
const auto isPinned = feed->isPinnedDialog();
|
||||
const auto pinText = [](bool isPinned) {
|
||||
return lang(isPinned
|
||||
? lng_context_unpin_from_top
|
||||
: lng_context_pin_to_top);
|
||||
};
|
||||
_addAction(pinText(isPinned), [=] {
|
||||
TogglePinnedDialog(feed);
|
||||
});
|
||||
}
|
||||
|
||||
void FeedFiller::addInfo() {
|
||||
auto controller = _controller;
|
||||
auto feed = _feed;
|
||||
_addAction(lang(lng_context_view_feed_info), [=] {
|
||||
controller->showSection(Info::Memento(
|
||||
feed,
|
||||
Info::Section(Info::Section::Type::Profile)));
|
||||
});
|
||||
}
|
||||
|
||||
void FeedFiller::addNotifications() {
|
||||
const auto feed = _feed;
|
||||
_addAction(lang(lng_feed_notifications), [=] {
|
||||
Info::FeedProfile::NotificationsController::Start(feed);
|
||||
});
|
||||
}
|
||||
|
||||
void FeedFiller::addSearch() {
|
||||
const auto feed = _feed;
|
||||
_addAction(lang(lng_profile_search_messages), [=] {
|
||||
App::main()->searchInChat(feed);
|
||||
});
|
||||
}
|
||||
|
||||
void FeedFiller::addUngroup() {
|
||||
const auto feed = _feed;
|
||||
//_addAction(lang(lng_feed_ungroup_all), [=] { // #feed
|
||||
// PeerMenuUngroupFeed(feed);
|
||||
//});
|
||||
void FolderFiller::fill() { // #TODO archive
|
||||
//if (_source == PeerMenuSource::ChatsList) {
|
||||
// addPinToggle();
|
||||
//}
|
||||
//if (showInfo()) {
|
||||
// addInfo();
|
||||
//}
|
||||
//addNotifications();
|
||||
//if (_source == PeerMenuSource::ChatsList) {
|
||||
// addSearch();
|
||||
//}
|
||||
//addUngroup();
|
||||
}
|
||||
//
|
||||
//bool FolderFiller::showInfo() {
|
||||
// if (_source == PeerMenuSource::Profile) {
|
||||
// return false;
|
||||
// } else if (_controller->activeChatCurrent().feed() != _feed) {
|
||||
// return true;
|
||||
// } else if (!Adaptive::ThreeColumn()) {
|
||||
// return true;
|
||||
// } else if (
|
||||
// !Auth().settings().thirdSectionInfoEnabled() &&
|
||||
// !Auth().settings().tabbedReplacedWithInfo()) {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
//
|
||||
//void FolderFiller::addPinToggle() {
|
||||
// const auto feed = _feed;
|
||||
// const auto isPinned = feed->isPinnedDialog();
|
||||
// const auto pinText = [](bool isPinned) {
|
||||
// return lang(isPinned
|
||||
// ? lng_context_unpin_from_top
|
||||
// : lng_context_pin_to_top);
|
||||
// };
|
||||
// _addAction(pinText(isPinned), [=] {
|
||||
// TogglePinnedDialog(feed);
|
||||
// });
|
||||
//}
|
||||
//
|
||||
//void FolderFiller::addInfo() {
|
||||
// auto controller = _controller;
|
||||
// auto feed = _feed;
|
||||
// _addAction(lang(lng_context_view_feed_info), [=] {
|
||||
// controller->showSection(Info::Memento(
|
||||
// feed,
|
||||
// Info::Section(Info::Section::Type::Profile)));
|
||||
// });
|
||||
//}
|
||||
//
|
||||
//void FolderFiller::addNotifications() {
|
||||
// const auto feed = _feed;
|
||||
// _addAction(lang(lng_feed_notifications), [=] {
|
||||
// Info::FeedProfile::NotificationsController::Start(feed);
|
||||
// });
|
||||
//}
|
||||
//
|
||||
//void FolderFiller::addSearch() {
|
||||
// const auto feed = _feed;
|
||||
// _addAction(lang(lng_profile_search_messages), [=] {
|
||||
// App::main()->searchInChat(feed);
|
||||
// });
|
||||
//}
|
||||
//
|
||||
//void FolderFiller::addUngroup() {
|
||||
// const auto feed = _feed;
|
||||
// //_addAction(lang(lng_feed_ungroup_all), [=] { // #feed
|
||||
// // PeerMenuUngroupFeed(feed);
|
||||
// //});
|
||||
//}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -807,12 +807,12 @@ void FillPeerMenu(
|
|||
filler.fill();
|
||||
}
|
||||
|
||||
void FillFeedMenu(
|
||||
void FillFolderMenu(
|
||||
not_null<Controller*> controller,
|
||||
not_null<Data::Feed*> feed,
|
||||
not_null<Data::Folder*> folder,
|
||||
const PeerMenuCallback &callback,
|
||||
PeerMenuSource source) {
|
||||
FeedFiller filler(controller, feed, callback, source);
|
||||
FolderFiller filler(controller, folder, callback, source);
|
||||
filler.fill();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class RpWidget;
|
|||
} // namespace Ui
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
class Folder;
|
||||
} // namespace Data
|
||||
|
||||
namespace Window {
|
||||
|
@ -34,9 +34,9 @@ void FillPeerMenu(
|
|||
not_null<PeerData*> peer,
|
||||
const PeerMenuCallback &addAction,
|
||||
PeerMenuSource source);
|
||||
void FillFeedMenu(
|
||||
void FillFolderMenu(
|
||||
not_null<Controller*> controller,
|
||||
not_null<Data::Feed*> feed,
|
||||
not_null<Data::Folder*> folder,
|
||||
const PeerMenuCallback &addAction,
|
||||
PeerMenuSource source);
|
||||
|
||||
|
|
|
@ -172,10 +172,10 @@
|
|||
<(src_loc)/data/data_document_good_thumbnail.h
|
||||
<(src_loc)/data/data_drafts.cpp
|
||||
<(src_loc)/data/data_drafts.h
|
||||
<(src_loc)/data/data_feed.cpp
|
||||
<(src_loc)/data/data_feed.h
|
||||
<(src_loc)/data/data_feed_messages.cpp
|
||||
<(src_loc)/data/data_feed_messages.h
|
||||
<(src_loc)/data/data_folder.cpp
|
||||
<(src_loc)/data/data_folder.h
|
||||
//<(src_loc)/data/data_feed_messages.cpp
|
||||
//<(src_loc)/data/data_feed_messages.h
|
||||
<(src_loc)/data/data_file_origin.cpp
|
||||
<(src_loc)/data/data_file_origin.h
|
||||
<(src_loc)/data/data_flags.h
|
||||
|
@ -252,8 +252,8 @@
|
|||
<(src_loc)/history/admin_log/history_admin_log_item.h
|
||||
<(src_loc)/history/admin_log/history_admin_log_section.cpp
|
||||
<(src_loc)/history/admin_log/history_admin_log_section.h
|
||||
<(src_loc)/history/feed/history_feed_section.cpp
|
||||
<(src_loc)/history/feed/history_feed_section.h
|
||||
//<(src_loc)/history/feed/history_feed_section.cpp
|
||||
//<(src_loc)/history/feed/history_feed_section.h
|
||||
<(src_loc)/history/media/history_media.h
|
||||
<(src_loc)/history/media/history_media.cpp
|
||||
<(src_loc)/history/media/history_media_call.h
|
||||
|
@ -337,22 +337,22 @@
|
|||
<(src_loc)/info/info_top_bar.h
|
||||
<(src_loc)/info/info_wrap_widget.cpp
|
||||
<(src_loc)/info/info_wrap_widget.h
|
||||
<(src_loc)/info/channels/info_channels_widget.cpp
|
||||
<(src_loc)/info/channels/info_channels_widget.h
|
||||
//<(src_loc)/info/channels/info_channels_widget.cpp
|
||||
//<(src_loc)/info/channels/info_channels_widget.h
|
||||
<(src_loc)/info/common_groups/info_common_groups_inner_widget.cpp
|
||||
<(src_loc)/info/common_groups/info_common_groups_inner_widget.h
|
||||
<(src_loc)/info/common_groups/info_common_groups_widget.cpp
|
||||
<(src_loc)/info/common_groups/info_common_groups_widget.h
|
||||
<(src_loc)/info/feed/info_feed_channels.cpp
|
||||
<(src_loc)/info/feed/info_feed_channels.h
|
||||
<(src_loc)/info/feed/info_feed_channels_controllers.cpp
|
||||
<(src_loc)/info/feed/info_feed_channels_controllers.h
|
||||
<(src_loc)/info/feed/info_feed_cover.cpp
|
||||
<(src_loc)/info/feed/info_feed_cover.h
|
||||
<(src_loc)/info/feed/info_feed_profile_inner_widget.cpp
|
||||
<(src_loc)/info/feed/info_feed_profile_inner_widget.h
|
||||
<(src_loc)/info/feed/info_feed_profile_widget.cpp
|
||||
<(src_loc)/info/feed/info_feed_profile_widget.h
|
||||
//<(src_loc)/info/feed/info_feed_channels.cpp
|
||||
//<(src_loc)/info/feed/info_feed_channels.h
|
||||
//<(src_loc)/info/feed/info_feed_channels_controllers.cpp
|
||||
//<(src_loc)/info/feed/info_feed_channels_controllers.h
|
||||
//<(src_loc)/info/feed/info_feed_cover.cpp
|
||||
//<(src_loc)/info/feed/info_feed_cover.h
|
||||
//<(src_loc)/info/feed/info_feed_profile_inner_widget.cpp
|
||||
//<(src_loc)/info/feed/info_feed_profile_inner_widget.h
|
||||
//<(src_loc)/info/feed/info_feed_profile_widget.cpp
|
||||
//<(src_loc)/info/feed/info_feed_profile_widget.h
|
||||
<(src_loc)/info/media/info_media_buttons.h
|
||||
<(src_loc)/info/media/info_media_empty_widget.cpp
|
||||
<(src_loc)/info/media/info_media_empty_widget.h
|
||||
|
@ -656,8 +656,8 @@
|
|||
<(src_loc)/storage/serialize_document.h
|
||||
<(src_loc)/storage/storage_facade.cpp
|
||||
<(src_loc)/storage/storage_facade.h
|
||||
<(src_loc)/storage/storage_feed_messages.cpp
|
||||
<(src_loc)/storage/storage_feed_messages.h
|
||||
//<(src_loc)/storage/storage_feed_messages.cpp
|
||||
//<(src_loc)/storage/storage_feed_messages.h
|
||||
<(src_loc)/storage/storage_media_prepare.cpp
|
||||
<(src_loc)/storage/storage_media_prepare.h
|
||||
<(src_loc)/storage/storage_shared_media.cpp
|
||||
|
|
Loading…
Add table
Reference in a new issue