mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Remove legacy #feed code.
This commit is contained in:
parent
df70fd3081
commit
8142acc709
71 changed files with 16 additions and 4139 deletions
|
@ -388,8 +388,6 @@ PRIVATE
|
|||
data/data_drafts.h
|
||||
data/data_folder.cpp
|
||||
data/data_folder.h
|
||||
# data/data_feed_messages.cpp
|
||||
# data/data_feed_messages.h
|
||||
data/data_file_origin.cpp
|
||||
data/data_file_origin.h
|
||||
data/data_flags.h
|
||||
|
@ -490,8 +488,6 @@ PRIVATE
|
|||
history/admin_log/history_admin_log_item.h
|
||||
history/admin_log/history_admin_log_section.cpp
|
||||
history/admin_log/history_admin_log_section.h
|
||||
# history/feed/history_feed_section.cpp
|
||||
# history/feed/history_feed_section.h
|
||||
history/view/controls/compose_controls_common.h
|
||||
history/view/controls/history_view_compose_controls.cpp
|
||||
history/view/controls/history_view_compose_controls.h
|
||||
|
@ -610,22 +606,10 @@ PRIVATE
|
|||
info/info_top_bar.h
|
||||
info/info_wrap_widget.cpp
|
||||
info/info_wrap_widget.h
|
||||
# info/channels/info_channels_widget.cpp
|
||||
# info/channels/info_channels_widget.h
|
||||
info/common_groups/info_common_groups_inner_widget.cpp
|
||||
info/common_groups/info_common_groups_inner_widget.h
|
||||
info/common_groups/info_common_groups_widget.cpp
|
||||
info/common_groups/info_common_groups_widget.h
|
||||
# info/feed/info_feed_channels.cpp
|
||||
# info/feed/info_feed_channels.h
|
||||
# info/feed/info_feed_channels_controllers.cpp
|
||||
# info/feed/info_feed_channels_controllers.h
|
||||
# info/feed/info_feed_cover.cpp
|
||||
# info/feed/info_feed_cover.h
|
||||
# info/feed/info_feed_profile_inner_widget.cpp
|
||||
# info/feed/info_feed_profile_inner_widget.h
|
||||
# info/feed/info_feed_profile_widget.cpp
|
||||
# info/feed/info_feed_profile_widget.h
|
||||
info/media/info_media_buttons.h
|
||||
info/media/info_media_empty_widget.cpp
|
||||
info/media/info_media_empty_widget.h
|
||||
|
@ -976,8 +960,6 @@ PRIVATE
|
|||
storage/storage_domain.h
|
||||
storage/storage_facade.cpp
|
||||
storage/storage_facade.h
|
||||
# storage/storage_feed_messages.cpp
|
||||
# storage/storage_feed_messages.h
|
||||
storage/storage_media_prepare.cpp
|
||||
storage/storage_media_prepare.h
|
||||
storage/storage_shared_media.cpp
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 328 B |
Binary file not shown.
Before Width: | Height: | Size: 626 B |
Binary file not shown.
Before Width: | Height: | Size: 841 B |
Binary file not shown.
Before Width: | Height: | Size: 748 B |
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
|
@ -2238,34 +2238,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"lng_admin_log_admin_manage_calls" = "Manage voice chats";
|
||||
"lng_admin_log_admin_add_admins" = "Add new admins";
|
||||
|
||||
// #feed
|
||||
//"lng_feed_name" = "Feed";
|
||||
//"lng_feed_show_next" = "Show Next";
|
||||
|
||||
//"lng_feed_group" = "Group in feed";
|
||||
//"lng_feed_ungroup" = "Ungroup from feed";
|
||||
//"lng_feed_channel_added" = "Channel added to your feed.";
|
||||
//"lng_feed_channel_removed" = "Channel removed from your feed.";
|
||||
//"lng_feed_no_messages" = "No messages in this feed yet";
|
||||
//"lng_feed_channels#one" = "{count} channel";
|
||||
//"lng_feed_channels#other" = "{count} channels";
|
||||
//"lng_feed_notifications" = "Feed notifications";
|
||||
//"lng_feed_ungroup_all" = "Ungroup all channels";
|
||||
//"lng_feed_sure_ungroup_all" = "Are you sure you want to ungroup all channels from this feed?";
|
||||
//"lng_feed_ungroup_sure" = "Ungroup";
|
||||
//"lng_feed_create_new" = "New feed";
|
||||
//"lng_feed_too_few_channels#one" = "You need at least {count} channel to create a feed.";
|
||||
//"lng_feed_too_few_channels#other" = "You need at least {count} channels to create a feed.";
|
||||
//"lng_feed_select_more_channels#one" = "Select {count} channel or more.";
|
||||
//"lng_feed_select_more_channels#other" = "Select {count} channels or more.";
|
||||
//"lng_feed_create" = "Create";
|
||||
//"lng_feed_edit_title" = "Edit feed";
|
||||
//"lng_feed_channels_not_found" = "No channels found";
|
||||
|
||||
//"lng_info_feed_title" = "Feed Info";
|
||||
//"lng_info_feed_is_default" = "Group new channels";
|
||||
//"lng_info_feed_channels" = "Channels";
|
||||
|
||||
"lng_terms_signup" = "By signing up,\nyou agree to the {link}.";
|
||||
"lng_terms_signup_link" = "Terms of Service";
|
||||
"lng_terms_header" = "Terms of Service";
|
||||
|
|
|
@ -1539,22 +1539,6 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
|||
}
|
||||
} break;
|
||||
|
||||
//case mtpc_updateReadFeed: { // #feed
|
||||
// const auto &d = update.c_updateReadFeed();
|
||||
// const auto feedId = d.vfeed_id().v;
|
||||
// if (const auto feed = session().data().feedLoaded(feedId)) {
|
||||
// feed->setUnreadPosition(
|
||||
// Data::FeedPositionFromMTP(d.vmax_position()));
|
||||
// if (d.vunread_count() && d.vunread_muted_count()) {
|
||||
// feed->setUnreadCounts(
|
||||
// d.vunread_count()->v,
|
||||
// d.vunread_muted_count()->v);
|
||||
// } else {
|
||||
// session().data().histories().requestDialogEntry(feed);
|
||||
// }
|
||||
// }
|
||||
//} break;
|
||||
|
||||
case mtpc_updateDialogUnreadMark: {
|
||||
const auto &data = update.c_updateDialogUnreadMark();
|
||||
data.vpeer().match(
|
||||
|
@ -2003,17 +1987,10 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
|||
channel->updateFullForced();
|
||||
}
|
||||
const auto history = channel->owner().history(channel);
|
||||
//if (const auto feed = channel->feed()) { // #feed
|
||||
// feed->requestChatListMessage();
|
||||
// if (!feed->unreadCountKnown()) {
|
||||
// feed->owner().histories().requestDialogEntry(feed);
|
||||
// }
|
||||
//} else {
|
||||
history->requestChatListMessage();
|
||||
if (!history->unreadCountKnown()) {
|
||||
history->owner().histories().requestDialogEntry(history);
|
||||
}
|
||||
//}
|
||||
history->requestChatListMessage();
|
||||
if (!history->unreadCountKnown()) {
|
||||
history->owner().histories().requestDialogEntry(history);
|
||||
}
|
||||
if (!channel->amCreator()) {
|
||||
session().api().requestSelfParticipant(channel);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ 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" // #feed
|
||||
#include "main/main_session.h"
|
||||
#include "main/main_session_settings.h"
|
||||
#include "main/main_account.h"
|
||||
|
@ -80,7 +79,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/storage_account.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
//#include "storage/storage_feed_messages.h" // #feed
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -104,10 +102,8 @@ constexpr auto kUnreadMentionsPreloadIfLess = 5;
|
|||
constexpr auto kUnreadMentionsFirstRequestLimit = 10;
|
||||
constexpr auto kUnreadMentionsNextRequestLimit = 100;
|
||||
constexpr auto kSharedMediaLimit = 100;
|
||||
//constexpr auto kFeedMessagesLimit = 50; // #feed
|
||||
constexpr auto kReadFeaturedSetsTimeout = crl::time(1000);
|
||||
constexpr auto kFileLoaderQueueStopTimeout = crl::time(5000);
|
||||
//constexpr auto kFeedReadTimeout = crl::time(1000); // #feed
|
||||
constexpr auto kStickersByEmojiInvalidateTimeout = crl::time(60 * 60 * 1000);
|
||||
constexpr auto kNotifySettingSaveTimeout = crl::time(1000);
|
||||
constexpr auto kDialogsFirstLoad = 20;
|
||||
|
@ -188,7 +184,6 @@ ApiWrap::ApiWrap(not_null<Main::Session*> session)
|
|||
, _featuredSetsReadTimer([=] { readFeaturedSets(); })
|
||||
, _dialogsLoadState(std::make_unique<DialogsLoadState>())
|
||||
, _fileLoader(std::make_unique<TaskQueue>(kFileLoaderQueueStopTimeout))
|
||||
//, _feedReadTimer([=] { readFeeds(); }) // #feed
|
||||
, _topPromotionTimer([=] { refreshTopPromotion(); })
|
||||
, _updateNotifySettingsTimer([=] { sendNotifySettingsUpdates(); })
|
||||
, _authorizations(std::make_unique<Api::Authorizations>(this))
|
||||
|
@ -507,19 +502,6 @@ void ApiWrap::toggleHistoryArchived(
|
|||
}).send();
|
||||
_historyArchivedRequests.emplace(history, requestId, callback);
|
||||
}
|
||||
// #feed
|
||||
//void ApiWrap::ungroupAllFromFeed(not_null<Data::Feed*> feed) {
|
||||
// const auto flags = MTPchannels_SetFeedBroadcasts::Flag::f_channels
|
||||
// | MTPchannels_SetFeedBroadcasts::Flag::f_also_newly_joined;
|
||||
// request(MTPchannels_SetFeedBroadcasts(
|
||||
// MTP_flags(flags),
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_vector<MTPInputChannel>(0),
|
||||
// MTP_bool(false)
|
||||
// )).done([=](const MTPUpdates &result) {
|
||||
// applyUpdates(result);
|
||||
// }).send();
|
||||
//}
|
||||
|
||||
void ApiWrap::sendMessageFail(
|
||||
const RPCError &error,
|
||||
|
@ -3239,8 +3221,6 @@ void ApiWrap::parseRecentChannelParticipants(
|
|||
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()) { // #feed
|
||||
// jumpToFeedDate(feed, date);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3334,64 +3314,6 @@ void ApiWrap::jumpToHistoryDate(not_null<PeerData*> peer, const QDate &date) {
|
|||
jumpToDateInPeer();
|
||||
}
|
||||
}
|
||||
// // #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>(base::QDateToDateTime(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()->sessionController()->showSection(
|
||||
// std::make_shared<HistoryFeed::Memento>(feed, result));
|
||||
// });
|
||||
//}
|
||||
|
||||
void ApiWrap::preloadEnoughUnreadMentions(not_null<History*> history) {
|
||||
auto fullCount = history->getUnreadMentionsCount();
|
||||
|
@ -3617,270 +3539,6 @@ void ApiWrap::userPhotosDone(
|
|||
fullCount
|
||||
));
|
||||
}
|
||||
// #feed
|
||||
//void ApiWrap::requestFeedChannels(not_null<Data::Feed*> feed) {
|
||||
// if (_feedChannelsGetRequests.contains(feed)) {
|
||||
// return;
|
||||
// }
|
||||
// const auto hash = feed->channelsHash();
|
||||
// request(MTPchannels_GetFeedSources(
|
||||
// MTP_flags(MTPchannels_GetFeedSources::Flag::f_feed_id),
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_int(hash)
|
||||
// )).done([=](const MTPchannels_FeedSources &result) {
|
||||
// _feedChannelsGetRequests.remove(feed);
|
||||
//
|
||||
// switch (result.type()) {
|
||||
// case mtpc_channels_feedSourcesNotModified:
|
||||
// if (feed->channelsHash() == hash) {
|
||||
// feedChannelsDone(feed);
|
||||
// } else {
|
||||
// requestFeedChannels(feed);
|
||||
// }
|
||||
// break;
|
||||
//
|
||||
// case mtpc_channels_feedSources: {
|
||||
// const auto &data = result.c_channels_feedSources();
|
||||
// applyFeedSources(data);
|
||||
// if (feed->channelsLoaded()) {
|
||||
// feedChannelsDone(feed);
|
||||
// } else {
|
||||
// LOG(("API Error: feed channels not received for "
|
||||
// ).arg(feed->id()));
|
||||
// }
|
||||
// } break;
|
||||
//
|
||||
// default: Unexpected("Type in channels.getFeedSources response.");
|
||||
// }
|
||||
// }).fail([=](const RPCError &error) {
|
||||
// _feedChannelsGetRequests.remove(feed);
|
||||
// }).send();
|
||||
// _feedChannelsGetRequests.emplace(feed);
|
||||
//}
|
||||
//
|
||||
//void ApiWrap::applyFeedSources(const MTPDchannels_feedSources &data) {
|
||||
// // First we set channels without reading them from data.
|
||||
// // This allows us to apply them all at once without registering
|
||||
// // them one by one.
|
||||
// for (const auto &broadcasts : data.vfeeds().v) {
|
||||
// if (broadcasts.type() == mtpc_feedBroadcasts) {
|
||||
// const auto &list = broadcasts.c_feedBroadcasts();
|
||||
// const auto feedId = list.vfeed_id().v;
|
||||
// const auto feed = _session->data().feed(feedId);
|
||||
// auto channels = std::vector<not_null<ChannelData*>>();
|
||||
// for (const auto &channelId : list.vchannels().v) {
|
||||
// channels.push_back(_session->data().channel(channelId.v));
|
||||
// }
|
||||
// feed->setChannels(std::move(channels));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// _session->data().processUsers(data.vusers());
|
||||
// _session->data().processChats(data.vchats());
|
||||
//
|
||||
// if (const auto id = data.vnewly_joined_feed()) {
|
||||
// _session->data().setDefaultFeedId(id->v);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void ApiWrap::setFeedChannels(
|
||||
// not_null<Data::Feed*> feed,
|
||||
// const std::vector<not_null<ChannelData*>> &channels) {
|
||||
// if (const auto already = _feedChannelsSetRequests.take(feed)) {
|
||||
// request(*already).cancel();
|
||||
// }
|
||||
// auto inputs = QVector<MTPInputChannel>();
|
||||
// inputs.reserve(channels.size());
|
||||
// for (const auto channel : channels) {
|
||||
// inputs.push_back(channel->inputChannel);
|
||||
// }
|
||||
// const auto requestId = request(MTPchannels_SetFeedBroadcasts(
|
||||
// MTP_flags(MTPchannels_SetFeedBroadcasts::Flag::f_channels),
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_vector<MTPInputChannel>(inputs),
|
||||
// MTPbool()
|
||||
// )).done([=](const MTPUpdates &result) {
|
||||
// applyUpdates(result);
|
||||
//
|
||||
// _feedChannelsSetRequests.remove(feed);
|
||||
// }).fail([=](const RPCError &error) {
|
||||
// _feedChannelsSetRequests.remove(feed);
|
||||
// }).send();
|
||||
//
|
||||
//}
|
||||
//
|
||||
//void ApiWrap::feedChannelsDone(not_null<Data::Feed*> feed) {
|
||||
// feed->setChannelsLoaded(true);
|
||||
// for (const auto key : base::take(_feedMessagesRequestsPending)) {
|
||||
// std::apply(
|
||||
// [=](auto&&...args) { requestFeedMessages(args...); },
|
||||
// key);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void ApiWrap::requestFeedMessages(
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Data::MessagePosition messageId,
|
||||
// SliceType slice) {
|
||||
// const auto key = std::make_tuple(feed, messageId, slice);
|
||||
// if (_feedMessagesRequests.contains(key)
|
||||
// || _feedMessagesRequestsPending.contains(key)) {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (!feed->channelsLoaded()) {
|
||||
// _feedMessagesRequestsPending.emplace(key);
|
||||
// requestFeedChannels(feed);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // We request messages with overlapping and skip overlapped in response.
|
||||
// const auto limit = kFeedMessagesLimit;
|
||||
// const auto addOffset = [&] {
|
||||
// switch (slice) {
|
||||
// case SliceType::Before: return -2;
|
||||
// case SliceType::Around: return -limit / 2;
|
||||
// case SliceType::After: return 1 - limit;
|
||||
// }
|
||||
// Unexpected("Direction in PrepareSearchRequest");
|
||||
// }();
|
||||
// const auto hash = int32(0);
|
||||
// const auto flags = (messageId && messageId.fullId.channel)
|
||||
// ? MTPchannels_GetFeed::Flag::f_offset_position
|
||||
// : MTPchannels_GetFeed::Flag::f_offset_to_max_read;
|
||||
// const auto requestId = request(MTPchannels_GetFeed(
|
||||
// MTP_flags(flags),
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_feedPosition(
|
||||
// MTP_int(messageId.date),
|
||||
// MTP_peerChannel(MTP_int(messageId.fullId.channel)),
|
||||
// MTP_int(messageId.fullId.msg)),
|
||||
// MTP_int(addOffset),
|
||||
// MTP_int(limit),
|
||||
// MTPFeedPosition(),
|
||||
// MTPFeedPosition(),
|
||||
// MTP_int(hash)
|
||||
// )).done([=](const MTPmessages_FeedMessages &result) {
|
||||
// const auto key = std::make_tuple(feed, messageId, slice);
|
||||
// _feedMessagesRequests.remove(key);
|
||||
// feedMessagesDone(feed, messageId, slice, result);
|
||||
// }).fail([=](const RPCError &error) {
|
||||
// _feedMessagesRequests.remove(key);
|
||||
// if (error.type() == qstr("SOURCES_HASH_INVALID")) {
|
||||
// _feedMessagesRequestsPending.emplace(key);
|
||||
// requestFeedChannels(feed);
|
||||
// }
|
||||
// }).send();
|
||||
// _feedMessagesRequests.emplace(key);
|
||||
//}
|
||||
//
|
||||
//void ApiWrap::feedMessagesDone(
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Data::MessagePosition messageId,
|
||||
// SliceType slice,
|
||||
// const MTPmessages_FeedMessages &result) {
|
||||
// if (result.type() == mtpc_messages_feedMessagesNotModified) {
|
||||
// LOG(("API Error: Unexpected messages.feedMessagesNotModified."));
|
||||
// _session->storage().add(Storage::FeedMessagesAddSlice(
|
||||
// feed->id(),
|
||||
// std::vector<Data::MessagePosition>(),
|
||||
// Data::FullMessagesRange));
|
||||
// return;
|
||||
// }
|
||||
// Assert(result.type() == mtpc_messages_feedMessages);
|
||||
// const auto &data = result.c_messages_feedMessages();
|
||||
// const auto &messages = data.vmessages().v;
|
||||
// const auto type = NewMessageExisting;
|
||||
//
|
||||
// auto ids = std::vector<Data::MessagePosition>();
|
||||
// auto noSkipRange = Data::MessagesRange(messageId, messageId);
|
||||
// const auto accumulateFrom = [](auto &from, const auto &candidate) {
|
||||
// if (!from || from > candidate) {
|
||||
// from = candidate;
|
||||
// }
|
||||
// };
|
||||
// const auto accumulateTill = [](auto &till, const auto &candidate) {
|
||||
// if (!till || till < candidate) {
|
||||
// till = candidate;
|
||||
// }
|
||||
// };
|
||||
// const auto tooLargePosition = [&](const auto &position) {
|
||||
// return (slice == SliceType::Before) && !(position < messageId);
|
||||
// };
|
||||
// const auto tooSmallPosition = [&](const auto &position) {
|
||||
// return (slice == SliceType::After) && !(messageId < position);
|
||||
// };
|
||||
// _session->data().processUsers(data.vusers());
|
||||
// _session->data().processChats(data.vchats());
|
||||
// if (!messages.empty()) {
|
||||
// ids.reserve(messages.size());
|
||||
// for (const auto &msg : messages) {
|
||||
// if (const auto item = _session->data().addNewMessage(msg, type)) {
|
||||
// const auto position = item->position();
|
||||
// if (tooLargePosition(position)) {
|
||||
// accumulateTill(noSkipRange.till, position);
|
||||
// continue;
|
||||
// } else if (tooSmallPosition(position)) {
|
||||
// accumulateFrom(noSkipRange.from, position);
|
||||
// continue;
|
||||
// }
|
||||
// ids.push_back(position);
|
||||
// accumulateFrom(noSkipRange.from, position);
|
||||
// accumulateTill(noSkipRange.till, position);
|
||||
// }
|
||||
// }
|
||||
// ranges::reverse(ids);
|
||||
// }
|
||||
// if (data.vmin_position() && !ids.empty()) {
|
||||
// accumulateFrom(
|
||||
// noSkipRange.from,
|
||||
// Data::FeedPositionFromMTP(*data.vmin_position()));
|
||||
// } else if (slice == SliceType::Before) {
|
||||
// noSkipRange.from = Data::MinMessagePosition;
|
||||
// }
|
||||
// if (data.vmax_position() && !ids.empty()) {
|
||||
// accumulateTill(
|
||||
// noSkipRange.till,
|
||||
// Data::FeedPositionFromMTP(*data.vmax_position()));
|
||||
// } else if (slice == SliceType::After) {
|
||||
// noSkipRange.till = Data::MaxMessagePosition;
|
||||
// }
|
||||
//
|
||||
// const auto unreadPosition = [&] {
|
||||
// if (data.vread_max_position()) {
|
||||
// return Data::FeedPositionFromMTP(*data.vread_max_position());
|
||||
// } else if (!messageId) {
|
||||
// const auto result = ids.empty()
|
||||
// ? noSkipRange.till
|
||||
// : ids.back();
|
||||
// return Data::MessagePosition(
|
||||
// result.date,
|
||||
// FullMsgId(result.fullId.channel, result.fullId.msg - 1));
|
||||
// }
|
||||
// return Data::MessagePosition();
|
||||
// }();
|
||||
//
|
||||
// _session->storage().add(Storage::FeedMessagesAddSlice(
|
||||
// feed->id(),
|
||||
// std::move(ids),
|
||||
// noSkipRange));
|
||||
//
|
||||
// if (unreadPosition) {
|
||||
// feed->setUnreadPosition(unreadPosition);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
//void ApiWrap::saveDefaultFeedId(FeedId id, bool isDefaultFeedId) {
|
||||
// if (const auto already = base::take(_saveDefaultFeedIdRequest)) {
|
||||
// request(already).cancel();
|
||||
// }
|
||||
// _saveDefaultFeedIdRequest = request(MTPchannels_SetFeedBroadcasts(
|
||||
// MTP_flags(MTPchannels_SetFeedBroadcasts::Flag::f_also_newly_joined),
|
||||
// MTP_int(id),
|
||||
// MTPVector<MTPInputChannel>(),
|
||||
// MTP_bool(isDefaultFeedId)
|
||||
// )).send();
|
||||
//}
|
||||
|
||||
void ApiWrap::sendAction(const SendAction &action) {
|
||||
if (!action.options.scheduled) {
|
||||
|
@ -5373,57 +5031,3 @@ void ApiWrap::reloadPollResults(not_null<HistoryItem*> item) {
|
|||
}).send();
|
||||
_pollReloadRequestIds.emplace(itemId, requestId);
|
||||
}
|
||||
|
||||
// // #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);
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -171,7 +171,6 @@ public:
|
|||
not_null<History*> history,
|
||||
bool archived,
|
||||
Fn<void()> callback);
|
||||
//void ungroupAllFromFeed(not_null<Data::Feed*> feed); // #feed
|
||||
|
||||
using RequestMessageDataCallback = Fn<void(ChannelData*, MsgId)>;
|
||||
void requestMessageData(
|
||||
|
@ -190,11 +189,6 @@ public:
|
|||
rpl::producer<bool> dialogsLoadMayBlockByDate() const;
|
||||
rpl::producer<bool> dialogsLoadBlockedByDate() const;
|
||||
|
||||
//void applyFeedSources(const MTPDchannels_feedSources &data); // #feed
|
||||
//void setFeedChannels(
|
||||
// not_null<Data::Feed*> feed,
|
||||
// const std::vector<not_null<ChannelData*>> &channels);
|
||||
|
||||
void requestWallPaper(
|
||||
const QString &slug,
|
||||
Fn<void(const Data::WallPaper &)> done,
|
||||
|
@ -334,14 +328,6 @@ public:
|
|||
not_null<UserData*> user,
|
||||
PhotoId afterId);
|
||||
|
||||
//void requestFeedChannels( // #feed
|
||||
// not_null<Data::Feed*> feed);
|
||||
//void requestFeedMessages(
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Data::MessagePosition messageId,
|
||||
// SliceType slice);
|
||||
//void saveDefaultFeedId(FeedId id, bool isDefaultFeedId);
|
||||
|
||||
void stickerSetInstalled(uint64 setId) {
|
||||
_stickerSetInstalled.fire_copy(setId);
|
||||
}
|
||||
|
@ -384,9 +370,6 @@ public:
|
|||
const QString &lastName,
|
||||
const SendAction &action);
|
||||
void shareContact(not_null<UserData*> user, const SendAction &action);
|
||||
//void readFeed( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Data::MessagePosition position);
|
||||
void applyAffectedMessages(
|
||||
not_null<PeerData*> peer,
|
||||
const MTPmessages_AffectedMessages &result);
|
||||
|
@ -565,17 +548,11 @@ private:
|
|||
const QVector<MTPChannelParticipant> &participants);
|
||||
|
||||
void jumpToHistoryDate(not_null<PeerData*> peer, 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> // #feed
|
||||
//void requestMessageAfterDate(
|
||||
// not_null<Data::Feed*> feed,
|
||||
// const QDate &date,
|
||||
// Callback &&callback);
|
||||
|
||||
void sharedMediaDone(
|
||||
not_null<PeerData*> peer,
|
||||
|
@ -589,13 +566,6 @@ private:
|
|||
PhotoId photoId,
|
||||
const MTPphotos_Photos &result);
|
||||
|
||||
//void feedChannelsDone(not_null<Data::Feed*> feed); // #feed
|
||||
//void feedMessagesDone(
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Data::MessagePosition messageId,
|
||||
// SliceType slice,
|
||||
// const MTPmessages_FeedMessages &result);
|
||||
|
||||
void sendSharedContact(
|
||||
const QString &phone,
|
||||
const QString &firstName,
|
||||
|
@ -636,8 +606,6 @@ private:
|
|||
uint64 randomId);
|
||||
FileLoadTo fileLoadTaskOptions(const SendAction &action) const;
|
||||
|
||||
//void readFeeds(); // #feed
|
||||
|
||||
void getTopPromotionDelayed(TimeId now, TimeId next);
|
||||
void topPromotionDone(const MTPhelp_PromoData &proxy);
|
||||
|
||||
|
@ -737,20 +705,6 @@ private:
|
|||
|
||||
base::flat_map<not_null<UserData*>, mtpRequestId> _userPhotosRequests;
|
||||
|
||||
//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;
|
||||
|
||||
std::unique_ptr<DialogsLoadState> _dialogsLoadState;
|
||||
TimeId _dialogsLoadTill = 0;
|
||||
rpl::variable<bool> _dialogsLoadMayBlockByDate = false;
|
||||
|
@ -769,11 +723,6 @@ private:
|
|||
|
||||
rpl::event_stream<uint64> _stickerSetInstalled;
|
||||
|
||||
// #feed
|
||||
//base::flat_map<not_null<Data::Feed*>, crl::time> _feedReadsDelayed;
|
||||
//base::flat_map<not_null<Data::Feed*>, mtpRequestId> _feedReadRequests;
|
||||
//base::Timer _feedReadTimer;
|
||||
|
||||
mtpRequestId _topPromotionRequestId = 0;
|
||||
std::pair<QString, uint32> _topPromotionKey;
|
||||
TimeId _topPromotionNextRequestTime = TimeId(0);
|
||||
|
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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 "apiwrap.h"
|
||||
#include "auth_session.h"
|
||||
#include "data/data_session.h"
|
||||
#include "storage/storage_feed_messages.h"
|
||||
|
||||
namespace Data {
|
||||
|
||||
rpl::producer<MessagesSlice> FeedMessagesViewer(
|
||||
Storage::FeedMessagesKey key,
|
||||
int limitBefore,
|
||||
int limitAfter) {
|
||||
Expects(IsServerMsgId(key.position.fullId.msg)
|
||||
|| (key.position.fullId.msg == 0));
|
||||
|
||||
return [=](auto consumer) {
|
||||
auto lifetime = rpl::lifetime();
|
||||
const auto builder = lifetime.make_state<MessagesSliceBuilder>(
|
||||
key.position,
|
||||
limitBefore,
|
||||
limitAfter);
|
||||
const auto feed = Auth().data().feed(key.feedId);
|
||||
using AroundData = MessagesSliceBuilder::AroundData;
|
||||
const auto requestMediaAround = [=](const AroundData &data) {
|
||||
if (data.aroundId || !key.position) {
|
||||
//Auth().api().requestFeedMessages( // #feed
|
||||
// feed,
|
||||
// data.aroundId,
|
||||
// data.direction);
|
||||
}
|
||||
};
|
||||
builder->insufficientAround(
|
||||
) | rpl::start_with_next(requestMediaAround, lifetime);
|
||||
|
||||
const auto pushNextSnapshot = [=] {
|
||||
consumer.put_next(builder->snapshot());
|
||||
};
|
||||
|
||||
using SliceUpdate = Storage::FeedMessagesSliceUpdate;
|
||||
Auth().storage().feedMessagesSliceUpdated(
|
||||
) | rpl::filter([=](const SliceUpdate &update) {
|
||||
return (update.feedId == key.feedId);
|
||||
}) | rpl::filter([=](const SliceUpdate &update) {
|
||||
return builder->applyUpdate(update.data);
|
||||
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
|
||||
|
||||
using OneRemoved = Storage::FeedMessagesRemoveOne;
|
||||
Auth().storage().feedMessagesOneRemoved(
|
||||
) | rpl::filter([=](const OneRemoved &update) {
|
||||
return (update.feedId == key.feedId);
|
||||
}) | rpl::filter([=](const OneRemoved &update) {
|
||||
return builder->removeOne(update.messageId);
|
||||
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
|
||||
|
||||
using AllRemoved = Storage::FeedMessagesRemoveAll;
|
||||
Auth().storage().feedMessagesAllRemoved(
|
||||
) | rpl::filter([=](const AllRemoved &update) {
|
||||
return (update.feedId == key.feedId);
|
||||
}) | rpl::filter([=](const AllRemoved &update) {
|
||||
return builder->removeFromChannel(update.channelId);
|
||||
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
|
||||
|
||||
using Invalidate = Storage::FeedMessagesInvalidate;
|
||||
Auth().storage().feedMessagesInvalidated(
|
||||
) | rpl::filter([=](const Invalidate &update) {
|
||||
return (update.feedId == key.feedId);
|
||||
}) | rpl::filter([=] {
|
||||
return builder->invalidated();
|
||||
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
|
||||
|
||||
using InvalidateBottom = Storage::FeedMessagesInvalidateBottom;
|
||||
Auth().storage().feedMessagesBottomInvalidated(
|
||||
) | rpl::filter([=](const InvalidateBottom &update) {
|
||||
return (update.feedId == key.feedId);
|
||||
}) | rpl::filter([=] {
|
||||
return builder->bottomInvalidated();
|
||||
}) | rpl::start_with_next(pushNextSnapshot, lifetime);
|
||||
|
||||
using Result = Storage::FeedMessagesResult;
|
||||
Auth().storage().query(Storage::FeedMessagesQuery(
|
||||
key,
|
||||
limitBefore,
|
||||
limitAfter
|
||||
)) | rpl::filter([=](const Result &result) {
|
||||
return builder->applyInitial(result);
|
||||
}) | rpl::start_with_next_done(
|
||||
pushNextSnapshot,
|
||||
[=] { builder->checkInsufficient(); },
|
||||
lifetime);
|
||||
|
||||
return lifetime;
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace Data
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_messages.h"
|
||||
|
||||
namespace Storage {
|
||||
struct FeedMessagesKey;
|
||||
} // namespace Storage
|
||||
|
||||
namespace Data {
|
||||
|
||||
rpl::producer<MessagesSlice> FeedMessagesViewer(
|
||||
Storage::FeedMessagesKey key,
|
||||
int limitBefore,
|
||||
int limitAfter);
|
||||
|
||||
} // namespace Data
|
|
@ -18,7 +18,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/storage_facade.h"
|
||||
#include "core/application.h"
|
||||
#include "main/main_account.h"
|
||||
//#include "storage/storage_feed_messages.h" // #feed
|
||||
#include "main/main_session.h"
|
||||
#include "mtproto/mtproto_config.h"
|
||||
#include "apiwrap.h"
|
||||
|
@ -33,16 +32,6 @@ constexpr auto kShowChatNamesCount = 8;
|
|||
|
||||
} // namespace
|
||||
|
||||
// #feed
|
||||
//MessagePosition FeedPositionFromMTP(const MTPFeedPosition &position) {
|
||||
// Expects(position.type() == mtpc_feedPosition);
|
||||
//
|
||||
// const auto &data = position.c_feedPosition();
|
||||
// return MessagePosition(data.vdate().v, FullMsgId(
|
||||
// peerToChannel(peerFromMTP(data.vpeer())),
|
||||
// data.vid().v));
|
||||
//}
|
||||
|
||||
Folder::Folder(not_null<Data::Session*> owner, FolderId id)
|
||||
: Entry(owner, Type::Folder)
|
||||
, _id(id)
|
||||
|
@ -226,14 +215,6 @@ not_null<Dialogs::MainList*> Folder::chatsList() {
|
|||
}
|
||||
|
||||
void Folder::loadUserpic() {
|
||||
//constexpr auto kPaintUserpicsCount = 4; // #feed
|
||||
//auto load = kPaintUserpicsCount;
|
||||
//for (const auto history : _histories) {
|
||||
// history->peer->loadUserpic();
|
||||
// if (!--load) {
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
void Folder::paintUserpic(
|
||||
|
@ -295,18 +276,6 @@ void Folder::paintUserpic(
|
|||
}
|
||||
p.restore();
|
||||
}
|
||||
//const auto small = (size - st::lineWidth) / 2; // #feed
|
||||
//const auto delta = size - small;
|
||||
//auto index = 0;
|
||||
//for (const auto history : _histories) {
|
||||
// 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*>> &Folder::lastHistories() const {
|
||||
|
@ -352,15 +321,6 @@ void Folder::applyPinnedUpdate(const MTPDupdateDialogPinned &data) {
|
|||
owner().setChatPinned(this, FilterId(), data.is_pinned());
|
||||
}
|
||||
|
||||
// #feed
|
||||
//MessagePosition Folder::unreadPosition() const {
|
||||
// return _unreadPosition.current();
|
||||
//}
|
||||
//
|
||||
//rpl::producer<MessagePosition> Folder::unreadPositionChanges() const {
|
||||
// return _unreadPosition.changes();
|
||||
//}
|
||||
|
||||
int Folder::fixedOnTopIndex() const {
|
||||
return kArchiveFixOnTopIndex;
|
||||
}
|
||||
|
@ -382,7 +342,7 @@ Dialogs::UnreadState Folder::chatListUnreadState() const {
|
|||
}
|
||||
|
||||
bool Folder::chatListUnreadMark() const {
|
||||
return false; // #feed unread mark
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Folder::chatListMutedBadge() const {
|
||||
|
|
|
@ -23,8 +23,6 @@ namespace Data {
|
|||
class Session;
|
||||
class Folder;
|
||||
|
||||
//MessagePosition FeedPositionFromMTP(const MTPFeedPosition &position); // #feed
|
||||
|
||||
class Folder final : public Dialogs::Entry, public base::has_weak_ptr {
|
||||
public:
|
||||
static constexpr auto kId = 1;
|
||||
|
@ -43,9 +41,6 @@ public:
|
|||
void applyDialog(const MTPDdialogFolder &data);
|
||||
void applyPinnedUpdate(const MTPDupdateDialogPinned &data);
|
||||
|
||||
//MessagePosition unreadPosition() const; // #feed
|
||||
//rpl::producer<MessagePosition> unreadPositionChanges() const; // #feed
|
||||
|
||||
TimeId adjustedChatListTimeId() const override;
|
||||
|
||||
int fixedOnTopIndex() const override;
|
||||
|
|
|
@ -57,7 +57,6 @@ public:
|
|||
Fn<void()> callback = nullptr);
|
||||
void dialogEntryApplied(not_null<History*> history);
|
||||
void changeDialogUnreadMark(not_null<History*> history, bool unread);
|
||||
//void changeDialogUnreadMark(not_null<Data::Feed*> feed, bool unread); // #feed
|
||||
void requestFakeChatListMessage(not_null<History*> history);
|
||||
|
||||
void deleteMessages(
|
||||
|
|
|
@ -407,13 +407,6 @@ void PeerData::setUserpicChecked(
|
|||
if (_userpicPhotoId != photoId || _userpic.location() != location) {
|
||||
setUserpic(photoId, location);
|
||||
session().changes().peerUpdated(this, UpdateFlag::Photo);
|
||||
//if (const auto channel = asChannel()) { // #feed
|
||||
// if (const auto feed = channel->feed()) {
|
||||
// owner().notifyFeedUpdated(
|
||||
// feed,
|
||||
// Data::FeedUpdateFlag::ChannelPhoto);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -703,11 +703,6 @@ not_null<PeerData*> Session::processChat(const MTPChat &data) {
|
|||
}
|
||||
channel->setFlags(data.vflags().v
|
||||
| (callNotEmpty ? callFlag : MTPDchannel::Flag(0)));
|
||||
//if (const auto feedId = data.vfeed_id()) { // #feed
|
||||
// channel->setFeed(feed(feedId->v));
|
||||
//} else {
|
||||
// channel->clearFeed();
|
||||
//}
|
||||
}
|
||||
|
||||
channel->setName(
|
||||
|
@ -1193,7 +1188,6 @@ void Session::setupChannelLeavingViewer() {
|
|||
if (channel->amIn()) {
|
||||
channel->clearInvitePeek();
|
||||
} else {
|
||||
// channel->clearFeed(); // #feed
|
||||
if (const auto history = historyLoaded(channel->id)) {
|
||||
history->removeJoinedMessage();
|
||||
history->updateChatListExistence();
|
||||
|
@ -3667,23 +3661,8 @@ not_null<Folder*> Session::processFolder(const MTPFolder &data) {
|
|||
}
|
||||
|
||||
not_null<Folder*> Session::processFolder(const MTPDfolder &data) {
|
||||
const auto result = folder(data.vid().v);
|
||||
//data.vphoto();
|
||||
//data.vtitle();
|
||||
return result;
|
||||
return folder(data.vid().v);
|
||||
}
|
||||
// // #feed
|
||||
//void Session::setDefaultFeedId(FeedId id) {
|
||||
// _defaultFeedId = id;
|
||||
//}
|
||||
//
|
||||
//FeedId Session::defaultFeedId() const {
|
||||
// return _defaultFeedId.current();
|
||||
//}
|
||||
//
|
||||
//rpl::producer<FeedId> Session::defaultFeedIdValue() const {
|
||||
// return _defaultFeedId.value();
|
||||
//}
|
||||
|
||||
not_null<Dialogs::MainList*> Session::chatsList(Data::Folder *folder) {
|
||||
return folder ? folder->chatsList().get() : &_chatsList;
|
||||
|
|
|
@ -609,9 +609,6 @@ public:
|
|||
[[nodiscard]] Folder *folderLoaded(FolderId id) const;
|
||||
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;
|
||||
|
||||
[[nodiscard]] not_null<Dialogs::MainList*> chatsList(
|
||||
Data::Folder *folder = nullptr);
|
||||
|
@ -940,7 +937,6 @@ private:
|
|||
base::Timer _pollsClosingTimer;
|
||||
|
||||
base::flat_map<FolderId, std::unique_ptr<Folder>> _folders;
|
||||
//rpl::variable<FeedId> _defaultFeedId = FeedId(); // #feed
|
||||
|
||||
std::unordered_map<
|
||||
not_null<const HistoryItem*>,
|
||||
|
|
|
@ -193,9 +193,6 @@ 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) }}; // #feed
|
||||
//dialogsFeedIconOver: icon {{ "dialogs_feed", dialogsChatIconFgOver, point(4px, 4px) }};
|
||||
//dialogsFeedIconActive: icon {{ "dialogs_feed", dialogsChatIconFgActive, point(4px, 4px) }};
|
||||
dialogsArchiveUserpic: icon {{ "archive_userpic", historyPeerUserpicFg }};
|
||||
dialogsRepliesUserpic: icon {{ "replies_userpic", historyPeerUserpicFg }};
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "dialogs/dialogs_layout.h"
|
||||
#include "dialogs/dialogs_widget.h"
|
||||
#include "dialogs/dialogs_search_from_controllers.h"
|
||||
//#include "history/feed/history_feed_section.h" // #feed
|
||||
#include "history/history.h"
|
||||
#include "history/history_item.h"
|
||||
#include "core/shortcuts.h"
|
||||
|
@ -829,8 +828,6 @@ void InnerWidget::paintSearchInChat(Painter &p) const {
|
|||
} else {
|
||||
paintSearchInPeer(p, peer, _searchInChatUserpic, top, _searchInChatText);
|
||||
}
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// paintSearchInFeed(p, feed, top, fullWidth, _searchInChatText);
|
||||
} else {
|
||||
Unexpected("Empty Key in paintSearchInChat.");
|
||||
}
|
||||
|
@ -913,19 +910,6 @@ void InnerWidget::paintSearchInReplies(
|
|||
paintSearchInFilter(p, paintUserpic, top, nullptr, text);
|
||||
}
|
||||
|
||||
//void InnerWidget::paintSearchInFeed( // #feed
|
||||
// Painter &p,
|
||||
// not_null<Data::Feed*> feed,
|
||||
// int top,
|
||||
// const Ui::Text::String &text) const {
|
||||
// const auto paintUserpic = [&](Painter &p, int x, int y, int size) {
|
||||
// feed->paintUserpicLeft(p, x, y, width(), size);
|
||||
// };
|
||||
// const auto icon = Layout::FeedTypeIcon(feed, false, false);
|
||||
// paintSearchInFilter(p, paintUserpic, top, icon, text);
|
||||
//}
|
||||
//
|
||||
|
||||
void InnerWidget::mouseMoveEvent(QMouseEvent *e) {
|
||||
const auto globalPosition = e->globalPos();
|
||||
if (!_lastMousePosition) {
|
||||
|
@ -2374,8 +2358,6 @@ void InnerWidget::refreshSearchInChatLabel() {
|
|||
return tr::lng_replies_messages(tr::now);
|
||||
}
|
||||
return peer->name;
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// return feed->chatListName();
|
||||
}
|
||||
return QString();
|
||||
}();
|
||||
|
@ -2724,17 +2706,10 @@ ChosenRow InnerWidget::computeChosenRow() const {
|
|||
};
|
||||
} else if (base::in_range(_searchedSelected, 0, _searchResults.size())) {
|
||||
const auto result = _searchResults[_searchedSelected].get();
|
||||
//if (const auto feed = result->searchInChat().feed()) { // #feed
|
||||
// return {
|
||||
// feed,
|
||||
// result->item()->position()
|
||||
// };
|
||||
//} else {
|
||||
return {
|
||||
result->item()->history(),
|
||||
result->item()->position()
|
||||
};
|
||||
//}
|
||||
return {
|
||||
result->item()->history(),
|
||||
result->item()->position()
|
||||
};
|
||||
}
|
||||
}
|
||||
return ChosenRow();
|
||||
|
|
|
@ -297,11 +297,6 @@ private:
|
|||
Painter &p,
|
||||
int top,
|
||||
const Ui::Text::String &text) const;
|
||||
//void paintSearchInFeed( // #feed
|
||||
// Painter &p,
|
||||
// not_null<Data::Feed*> feed,
|
||||
// int top,
|
||||
// const Ui::Text::String &text) const;
|
||||
template <typename PaintUserpic>
|
||||
void paintSearchInFilter(
|
||||
Painter &p,
|
||||
|
|
|
@ -218,7 +218,6 @@ enum class Flag {
|
|||
SavedMessages = 0x08,
|
||||
RepliesMessages = 0x10,
|
||||
AllowUserOnline = 0x20,
|
||||
//FeedSearchResult = 0x10, // #feed
|
||||
};
|
||||
inline constexpr bool is_flag_type(Flag) { return true; }
|
||||
|
||||
|
@ -317,7 +316,7 @@ void paintRow(
|
|||
st::msgNameFont->height);
|
||||
|
||||
const auto promoted = (history && history->useTopPromotion())
|
||||
&& !(flags & (Flag::SearchResult/* | Flag::FeedSearchResult*/)); // #feed
|
||||
&& !(flags & Flag::SearchResult);
|
||||
if (promoted) {
|
||||
const auto type = history->topPromotionType();
|
||||
const auto custom = type.isEmpty()
|
||||
|
@ -329,16 +328,11 @@ void paintRow(
|
|||
? tr::lng_badge_psa_default(tr::now)
|
||||
: custom;
|
||||
PaintRowTopRight(p, text, rectForName, active, selected);
|
||||
} else if (from/* && !(flags & Flag::FeedSearchResult)*/) { // #feed
|
||||
} else if (from) {
|
||||
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()) { // #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
|
||||
|
@ -574,14 +568,6 @@ const style::icon *ChatTypeIcon(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
//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);
|
||||
|
||||
|
@ -915,8 +901,7 @@ void RowPainter::paint(
|
|||
| (selected ? Flag::Selected : Flag(0))
|
||||
| Flag::SearchResult
|
||||
| (showSavedMessages ? Flag::SavedMessages : Flag(0))
|
||||
| (showRepliesMessages ? Flag::RepliesMessages : Flag(0))/* // #feed
|
||||
| (row->searchInChat().feed() ? Flag::FeedSearchResult : Flag(0))*/;
|
||||
| (showRepliesMessages ? Flag::RepliesMessages : Flag(0));
|
||||
paintRow(
|
||||
p,
|
||||
row,
|
||||
|
|
|
@ -19,10 +19,6 @@ const style::icon *ChatTypeIcon(
|
|||
not_null<PeerData*> peer,
|
||||
bool active,
|
||||
bool selected);
|
||||
//const style::icon *FeedTypeIcon( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// bool active,
|
||||
// bool selected);
|
||||
|
||||
class RowPainter {
|
||||
public:
|
||||
|
|
|
@ -12,7 +12,6 @@ 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" // #feed
|
||||
#include "history/view/history_view_top_bar_widget.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
|
@ -862,21 +861,6 @@ bool Widget::onSearchMessages(bool searchCache) {
|
|||
_searchQueries.emplace(_searchRequest, _searchQuery);
|
||||
return _searchRequest;
|
||||
});
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// const auto type = SearchRequestType::FromStart;
|
||||
// _searchRequest = session().api().request(MTPchannels_SearchFeed(
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_string(_searchQuery),
|
||||
// MTP_int(0),
|
||||
// MTP_inputPeerEmpty(),
|
||||
// MTP_int(0),
|
||||
// MTP_int(SearchPerPage)
|
||||
// )).done([=](const MTPmessages_Messages &result) {
|
||||
// searchReceived(type, result, _searchRequest);
|
||||
// }).fail([=](const RPCError &error) {
|
||||
// searchFailed(type, error, _searchRequest);
|
||||
// }).send();
|
||||
// _searchQueries.emplace(_searchRequest, _searchQuery);
|
||||
} else {
|
||||
const auto type = SearchRequestType::FromStart;
|
||||
const auto flags = session().settings().skipArchiveInSearch()
|
||||
|
@ -1037,27 +1021,6 @@ void Widget::onSearchMore() {
|
|||
}
|
||||
return _searchRequest;
|
||||
});
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// const auto type = offsetId
|
||||
// ? SearchRequestType::FromOffset
|
||||
// : SearchRequestType::FromStart;
|
||||
// _searchRequest = session().api().request(MTPchannels_SearchFeed(
|
||||
// MTP_int(feed->id()),
|
||||
// MTP_string(_searchQuery),
|
||||
// MTP_int(offsetDate),
|
||||
// offsetPeer
|
||||
// ? offsetPeer->input
|
||||
// : MTP_inputPeerEmpty(),
|
||||
// MTP_int(offsetId),
|
||||
// MTP_int(SearchPerPage)),
|
||||
// )).done([=](const MTPmessages_Messages &result) {
|
||||
// searchReceived(type, result, _searchRequest);
|
||||
// }).fail([=](const RPCError &error) {
|
||||
// searchFailed(type, error, _searchRequest);
|
||||
// }).send();
|
||||
// if (!offsetId) {
|
||||
// _searchQueries.emplace(_searchRequest, _searchQuery);
|
||||
// }
|
||||
} else {
|
||||
const auto type = offsetId
|
||||
? SearchRequestType::FromOffset
|
||||
|
@ -1777,8 +1740,6 @@ bool Widget::onCancelSearch() {
|
|||
if (Adaptive::OneColumn()) {
|
||||
if (const auto peer = _searchInChat.peer()) {
|
||||
Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// controller()->showSection(std::make_shared<HistoryFeed::Memento>(feed));
|
||||
} else {
|
||||
Unexpected("Empty key in onCancelSearch().");
|
||||
}
|
||||
|
@ -1801,8 +1762,6 @@ void Widget::onCancelSearchInChat() {
|
|||
&& _filter->getLastText().trimmed().isEmpty()) {
|
||||
if (const auto peer = _searchInChat.peer()) {
|
||||
Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
|
||||
//} else if (const auto feed = _searchInChat.feed()) { // #feed
|
||||
// controller()->showSection(std::make_shared<HistoryFeed::Memento>(feed));
|
||||
} else {
|
||||
Unexpected("Empty key in onCancelSearchInPeer().");
|
||||
}
|
||||
|
|
|
@ -1,627 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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 "history/feed/history_feed_section.h"
|
||||
|
||||
#include "history/view/history_view_top_bar_widget.h"
|
||||
#include "history/view/history_view_list_widget.h"
|
||||
#include "history/view/history_view_element.h"
|
||||
#include "history/view/history_view_message.h"
|
||||
#include "history/view/history_view_service_message.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/history_service.h"
|
||||
#include "history/history_inner_widget.h"
|
||||
#include "core/event_filter.h"
|
||||
#include "core/shortcuts.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/window_peer_menu.h"
|
||||
#include "data/data_feed_messages.h"
|
||||
#include "data/data_photo.h"
|
||||
#include "data/data_document.h"
|
||||
#include "data/data_session.h"
|
||||
#include "storage/storage_feed_messages.h"
|
||||
#include "mainwidget.h"
|
||||
#include "apiwrap.h"
|
||||
#include "auth_session.h"
|
||||
#include "styles/style_widgets.h"
|
||||
#include "styles/style_history.h"
|
||||
|
||||
namespace HistoryFeed {
|
||||
|
||||
Memento::Memento(
|
||||
not_null<Data::Feed*> feed,
|
||||
Data::MessagePosition position)
|
||||
: _feed(feed)
|
||||
, _position(position)
|
||||
, _list(std::make_unique<HistoryView::ListMemento>(position)) {
|
||||
}
|
||||
|
||||
Memento::~Memento() = default;
|
||||
|
||||
object_ptr<Window::SectionWidget> Memento::createWidget(
|
||||
QWidget *parent,
|
||||
not_null<Window::Controller*> controller,
|
||||
Window::Column column,
|
||||
const QRect &geometry) {
|
||||
if (column == Window::Column::Third) {
|
||||
return nullptr;
|
||||
}
|
||||
auto result = object_ptr<Widget>(parent, controller, _feed);
|
||||
result->setInternalState(geometry, this);
|
||||
return result;
|
||||
}
|
||||
|
||||
Widget::Widget(
|
||||
QWidget *parent,
|
||||
not_null<Window::Controller*> controller,
|
||||
not_null<Data::Feed*> feed)
|
||||
: Window::SectionWidget(parent, controller)
|
||||
, _feed(feed)
|
||||
, _scroll(this, st::historyScroll, false)
|
||||
, _topBar(this, controller)
|
||||
, _topBarShadow(this)
|
||||
, _showNext(nullptr)
|
||||
//, _showNext(
|
||||
// this,
|
||||
// lang(lng_feed_show_next).toUpper(),
|
||||
// st::historyComposeButton)
|
||||
, _scrollDown(_scroll, st::historyToDown) {
|
||||
_topBar->setActiveChat(_feed);
|
||||
|
||||
_topBar->move(0, 0);
|
||||
_topBar->resizeToWidth(width());
|
||||
_topBar->show();
|
||||
|
||||
_topBar->forwardSelectionRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
forwardSelected();
|
||||
}, _topBar->lifetime());
|
||||
_topBar->deleteSelectionRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
confirmDeleteSelected();
|
||||
}, _topBar->lifetime());
|
||||
_topBar->clearSelectionRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
clearSelected();
|
||||
}, _topBar->lifetime());
|
||||
|
||||
_topBarShadow->raise();
|
||||
updateAdaptiveLayout();
|
||||
subscribe(Adaptive::Changed(), [this] { updateAdaptiveLayout(); });
|
||||
|
||||
_inner = _scroll->setOwnedWidget(
|
||||
object_ptr<HistoryView::ListWidget>(this, controller, this));
|
||||
_scroll->move(0, _topBar->height());
|
||||
_scroll->show();
|
||||
|
||||
connect(
|
||||
_scroll,
|
||||
&Ui::ScrollArea::scrolled,
|
||||
this,
|
||||
[this] { onScroll(); });
|
||||
|
||||
//_showNext->setClickedCallback([this] {
|
||||
// // TODO feeds show next
|
||||
//});
|
||||
|
||||
_feed->unreadPositionChanges(
|
||||
) | rpl::filter([=](const Data::MessagePosition &position) {
|
||||
return _undefinedAroundPosition && position;
|
||||
}) | rpl::start_with_next([=](const Data::MessagePosition &position) {
|
||||
auto memento = HistoryView::ListMemento(position);
|
||||
_inner->restoreState(&memento);
|
||||
}, lifetime());
|
||||
|
||||
rpl::single(
|
||||
Data::FeedUpdate{ _feed, Data::FeedUpdateFlag::Channels }
|
||||
) | rpl::then(
|
||||
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, [=] { checkForSingleChannelFeed(); });
|
||||
}, lifetime());
|
||||
|
||||
setupScrollDownButton();
|
||||
setupShortcuts();
|
||||
}
|
||||
|
||||
void Widget::setupScrollDownButton() {
|
||||
_scrollDown->setClickedCallback([=] {
|
||||
scrollDownClicked();
|
||||
});
|
||||
Core::InstallEventFilter(_scrollDown, [=](not_null<QEvent*> event) {
|
||||
if (event->type() == QEvent::Wheel) {
|
||||
return _scroll->viewportEvent(event);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
updateScrollDownVisibility();
|
||||
_feed->unreadCountValue(
|
||||
) | rpl::start_with_next([=](int count) {
|
||||
_scrollDown->setUnreadCount(count);
|
||||
}, _scrollDown->lifetime());
|
||||
}
|
||||
|
||||
void Widget::scrollDownClicked() {
|
||||
_currentMessageId = Data::MaxMessagePosition.fullId;
|
||||
showAtPosition(Data::MaxMessagePosition);
|
||||
}
|
||||
|
||||
void Widget::showAtPosition(Data::MessagePosition position) {
|
||||
if (showAtPositionNow(position)) {
|
||||
if (const auto highlight = base::take(_highlightMessageId)) {
|
||||
_inner->highlightMessage(highlight);
|
||||
}
|
||||
} else {
|
||||
_nextAnimatedScrollPosition = position;
|
||||
_nextAnimatedScrollDelta = _inner->isBelowPosition(position)
|
||||
? -_scroll->height()
|
||||
: _inner->isAbovePosition(position)
|
||||
? _scroll->height()
|
||||
: 0;
|
||||
auto memento = HistoryView::ListMemento(position);
|
||||
_inner->restoreState(&memento);
|
||||
}
|
||||
}
|
||||
|
||||
bool Widget::showAtPositionNow(Data::MessagePosition position) {
|
||||
if (const auto scrollTop = _inner->scrollTopForPosition(position)) {
|
||||
const auto currentScrollTop = _scroll->scrollTop();
|
||||
const auto wanted = std::clamp(
|
||||
*scrollTop,
|
||||
0,
|
||||
_scroll->scrollTopMax());
|
||||
const auto fullDelta = (wanted - currentScrollTop);
|
||||
const auto limit = _scroll->height();
|
||||
const auto scrollDelta = std::clamp(fullDelta, -limit, limit);
|
||||
_inner->animatedScrollTo(
|
||||
wanted,
|
||||
position,
|
||||
scrollDelta,
|
||||
(std::abs(fullDelta) > limit
|
||||
? HistoryView::ListWidget::AnimatedScroll::Part
|
||||
: HistoryView::ListWidget::AnimatedScroll::Full));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Widget::updateScrollDownVisibility() {
|
||||
if (animating()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto scrollDownIsVisible = [&]() -> std::optional<bool> {
|
||||
const auto top = _scroll->scrollTop() + st::historyToDownShownAfter;
|
||||
if (top < _scroll->scrollTopMax()) {
|
||||
return true;
|
||||
}
|
||||
if (_inner->loadedAtBottomKnown()) {
|
||||
return !_inner->loadedAtBottom();
|
||||
}
|
||||
return std::nullopt;
|
||||
};
|
||||
const auto scrollDownIsShown = scrollDownIsVisible();
|
||||
if (!scrollDownIsShown) {
|
||||
return;
|
||||
}
|
||||
if (_scrollDownIsShown != *scrollDownIsShown) {
|
||||
_scrollDownIsShown = *scrollDownIsShown;
|
||||
_scrollDownShown.start(
|
||||
[=] { updateScrollDownPosition(); },
|
||||
_scrollDownIsShown ? 0. : 1.,
|
||||
_scrollDownIsShown ? 1. : 0.,
|
||||
st::historyToDownDuration);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::updateScrollDownPosition() {
|
||||
// _scrollDown is a child widget of _scroll, not me.
|
||||
auto top = anim::interpolate(
|
||||
0,
|
||||
_scrollDown->height() + st::historyToDownPosition.y(),
|
||||
_scrollDownShown.value(_scrollDownIsShown ? 1. : 0.));
|
||||
_scrollDown->moveToRight(
|
||||
st::historyToDownPosition.x(),
|
||||
_scroll->height() - top);
|
||||
auto shouldBeHidden = !_scrollDownIsShown && !_scrollDownShown.animating();
|
||||
if (shouldBeHidden != _scrollDown->isHidden()) {
|
||||
_scrollDown->setVisible(!shouldBeHidden);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::scrollDownAnimationFinish() {
|
||||
_scrollDownShown.stop();
|
||||
updateScrollDownPosition();
|
||||
}
|
||||
|
||||
void Widget::checkForSingleChannelFeed() {
|
||||
const auto &channels = _feed->channels();
|
||||
if (channels.size() > 1) {
|
||||
return;
|
||||
} else if (!channels.empty()) {
|
||||
controller()->showPeerHistory(channels[0]);
|
||||
} else {
|
||||
controller()->clearSectionStack();
|
||||
}
|
||||
}
|
||||
|
||||
Dialogs::RowDescriptor Widget::activeChat() const {
|
||||
return Dialogs::RowDescriptor(_feed, _currentMessageId);
|
||||
}
|
||||
|
||||
void Widget::updateAdaptiveLayout() {
|
||||
_topBarShadow->moveToLeft(
|
||||
Adaptive::OneColumn() ? 0 : st::lineWidth,
|
||||
_topBar->height());
|
||||
}
|
||||
|
||||
QPixmap Widget::grabForShowAnimation(const Window::SectionSlideParams ¶ms) {
|
||||
if (params.withTopBarShadow) _topBarShadow->hide();
|
||||
auto result = Ui::GrabWidget(this);
|
||||
if (params.withTopBarShadow) _topBarShadow->show();
|
||||
return result;
|
||||
}
|
||||
|
||||
void Widget::doSetInnerFocus() {
|
||||
_inner->setFocus();
|
||||
}
|
||||
|
||||
bool Widget::showInternal(
|
||||
not_null<Window::SectionMemento*> memento,
|
||||
const Window::SectionShow ¶ms) {
|
||||
if (const auto feedMemento = dynamic_cast<Memento*>(memento.get())) {
|
||||
if (feedMemento->feed() == _feed) {
|
||||
restoreState(feedMemento);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Widget::setInternalState(
|
||||
const QRect &geometry,
|
||||
not_null<Memento*> memento) {
|
||||
setGeometry(geometry);
|
||||
Ui::SendPendingMoveResizeEvents(this);
|
||||
restoreState(memento);
|
||||
}
|
||||
|
||||
void Widget::setupShortcuts() {
|
||||
Shortcuts::Requests(
|
||||
) | rpl::filter([=] {
|
||||
return isActiveWindow() && !Ui::isLayerShown() && inFocusChain();
|
||||
}) | rpl::start_with_next([=](not_null<Shortcuts::Request*> request) {
|
||||
using Command = Shortcuts::Command;
|
||||
request->check(Command::Search, 2) && request->handle([=] {
|
||||
App::main()->searchInChat(_feed);
|
||||
return true;
|
||||
});
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
HistoryView::Context Widget::listContext() {
|
||||
return HistoryView::Context::Feed;
|
||||
}
|
||||
|
||||
void Widget::listScrollTo(int top) {
|
||||
if (_scroll->scrollTop() != top) {
|
||||
_scroll->scrollToY(top);
|
||||
} else {
|
||||
updateInnerVisibleArea();
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::listCancelRequest() {
|
||||
controller()->showBackFromStack();
|
||||
}
|
||||
|
||||
void Widget::listDeleteRequest() {
|
||||
confirmDeleteSelected();
|
||||
}
|
||||
|
||||
rpl::producer<Data::MessagesSlice> Widget::listSource(
|
||||
Data::MessagePosition aroundId,
|
||||
int limitBefore,
|
||||
int limitAfter) {
|
||||
return Data::FeedMessagesViewer(
|
||||
Storage::FeedMessagesKey(_feed->id(), aroundId),
|
||||
limitBefore,
|
||||
limitAfter);
|
||||
}
|
||||
|
||||
bool Widget::listAllowsMultiSelect() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Widget::listIsLessInOrder(
|
||||
not_null<HistoryItem*> first,
|
||||
not_null<HistoryItem*> second) {
|
||||
return first->position() < second->position();
|
||||
}
|
||||
|
||||
void Widget::listSelectionChanged(HistoryView::SelectedItems &&items) {
|
||||
HistoryView::TopBarWidget::SelectedState state;
|
||||
state.count = items.size();
|
||||
for (const auto item : items) {
|
||||
if (item.canForward) {
|
||||
++state.canForwardCount;
|
||||
}
|
||||
if (item.canDelete) {
|
||||
++state.canDeleteCount;
|
||||
}
|
||||
}
|
||||
_topBar->showSelected(state);
|
||||
}
|
||||
|
||||
void Widget::listVisibleItemsChanged(HistoryItemsList &&items) {
|
||||
const auto reversed = ranges::view::reverse(items);
|
||||
const auto good = ranges::find_if(reversed, [](auto item) {
|
||||
return IsServerMsgId(item->id);
|
||||
});
|
||||
if (good != end(reversed)) {
|
||||
Auth().api().readFeed(_feed, (*good)->position());
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<int> Widget::listUnreadBarView(
|
||||
const std::vector<not_null<Element*>> &elements) {
|
||||
const auto position = _feed->unreadPosition();
|
||||
if (!position || elements.empty() || !_feed->unreadCount()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto minimal = ranges::upper_bound(
|
||||
elements,
|
||||
position,
|
||||
std::less<>(),
|
||||
[](auto view) { return view->data()->position(); });
|
||||
if (minimal == end(elements)) {
|
||||
return std::nullopt;
|
||||
}
|
||||
const auto view = *minimal;
|
||||
const auto unreadMessagesHeight = elements.back()->y()
|
||||
+ elements.back()->height()
|
||||
- view->y();
|
||||
if (unreadMessagesHeight < _scroll->height()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
return base::make_optional(int(minimal - begin(elements)));
|
||||
}
|
||||
|
||||
void Widget::validateEmptyTextItem() {
|
||||
if (!_inner->isEmpty()) {
|
||||
_emptyTextView = nullptr;
|
||||
_emptyTextItem = nullptr;
|
||||
update();
|
||||
return;
|
||||
} else if (_emptyTextItem) {
|
||||
return;
|
||||
}
|
||||
const auto channels = _feed->channels();
|
||||
if (channels.empty()) {
|
||||
return;
|
||||
}
|
||||
const auto history = channels[0];
|
||||
_emptyTextItem.reset(new HistoryService(
|
||||
history,
|
||||
clientMsgId(),
|
||||
unixtime(),
|
||||
{ lang(lng_feed_no_messages) }));
|
||||
_emptyTextView = _emptyTextItem->createView(
|
||||
HistoryInner::ElementDelegate());
|
||||
updateControlsGeometry();
|
||||
update();
|
||||
}
|
||||
|
||||
void Widget::listContentRefreshed() {
|
||||
validateEmptyTextItem();
|
||||
|
||||
if (!_nextAnimatedScrollPosition) {
|
||||
return;
|
||||
}
|
||||
const auto position = *base::take(_nextAnimatedScrollPosition);
|
||||
if (const auto scrollTop = _inner->scrollTopForPosition(position)) {
|
||||
const auto wanted = std::clamp(
|
||||
*scrollTop,
|
||||
0,
|
||||
_scroll->scrollTopMax());
|
||||
_inner->animatedScrollTo(
|
||||
wanted,
|
||||
position,
|
||||
_nextAnimatedScrollDelta,
|
||||
HistoryView::ListWidget::AnimatedScroll::Part);
|
||||
if (const auto highlight = base::take(_highlightMessageId)) {
|
||||
_inner->highlightMessage(highlight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ClickHandlerPtr Widget::listDateLink(not_null<Element*> view) {
|
||||
if (!_dateLink) {
|
||||
_dateLink = std::make_shared<Window::DateClickHandler>(_feed, view->dateTime().date());
|
||||
} else {
|
||||
_dateLink->setDate(view->dateTime().date());
|
||||
}
|
||||
return _dateLink;
|
||||
}
|
||||
|
||||
std::unique_ptr<Window::SectionMemento> Widget::createMemento() {
|
||||
auto result = std::make_unique<Memento>(_feed);
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
||||
void Widget::saveState(not_null<Memento*> memento) {
|
||||
_inner->saveState(memento->list());
|
||||
}
|
||||
|
||||
void Widget::restoreState(not_null<Memento*> memento) {
|
||||
const auto list = memento->list();
|
||||
if (!list->aroundPosition()) {
|
||||
if (const auto position = _feed->unreadPosition()) {
|
||||
list->setAroundPosition(position);
|
||||
}
|
||||
}
|
||||
_undefinedAroundPosition = !list->aroundPosition();
|
||||
_inner->restoreState(memento->list());
|
||||
if (const auto position = memento->position()) {
|
||||
_currentMessageId = _highlightMessageId = position.fullId;
|
||||
showAtPosition(position);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::resizeEvent(QResizeEvent *e) {
|
||||
if (!width() || !height()) {
|
||||
return;
|
||||
}
|
||||
updateControlsGeometry();
|
||||
}
|
||||
|
||||
void Widget::updateControlsGeometry() {
|
||||
const auto contentWidth = width();
|
||||
|
||||
const auto newScrollTop = _scroll->isHidden()
|
||||
? std::nullopt
|
||||
: base::make_optional(_scroll->scrollTop() + topDelta());
|
||||
_topBar->resizeToWidth(contentWidth);
|
||||
_topBarShadow->resize(contentWidth, st::lineWidth);
|
||||
|
||||
const auto bottom = height();
|
||||
const auto scrollHeight = bottom
|
||||
- _topBar->height();
|
||||
// - _showNext->height();
|
||||
const auto scrollSize = QSize(contentWidth, scrollHeight);
|
||||
if (_scroll->size() != scrollSize) {
|
||||
_skipScrollEvent = true;
|
||||
_scroll->resize(scrollSize);
|
||||
_inner->resizeToWidth(scrollSize.width(), _scroll->height());
|
||||
_skipScrollEvent = false;
|
||||
}
|
||||
if (!_scroll->isHidden()) {
|
||||
if (newScrollTop) {
|
||||
_scroll->scrollToY(*newScrollTop);
|
||||
}
|
||||
updateInnerVisibleArea();
|
||||
}
|
||||
|
||||
updateScrollDownPosition();
|
||||
//const auto fullWidthButtonRect = myrtlrect(
|
||||
// 0,
|
||||
// bottom - _showNext->height(),
|
||||
// contentWidth,
|
||||
// _showNext->height());
|
||||
//_showNext->setGeometry(fullWidthButtonRect);
|
||||
|
||||
if (_emptyTextView) {
|
||||
_emptyTextView->resizeGetHeight(width());
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::paintEvent(QPaintEvent *e) {
|
||||
if (animating()) {
|
||||
SectionWidget::paintEvent(e);
|
||||
return;
|
||||
}
|
||||
if (Ui::skipPaintEvent(this, e)) {
|
||||
return;
|
||||
}
|
||||
//if (hasPendingResizedItems()) {
|
||||
// updateListSize();
|
||||
//}
|
||||
|
||||
SectionWidget::PaintBackground(this, e->rect());
|
||||
|
||||
if (_emptyTextView) {
|
||||
Painter p(this);
|
||||
|
||||
const auto clip = e->rect();
|
||||
const auto left = 0;
|
||||
const auto top = (height()
|
||||
// - _showNext->height()
|
||||
- _emptyTextView->height()) / 2;
|
||||
p.translate(left, top);
|
||||
_emptyTextView->draw(
|
||||
p,
|
||||
clip.translated(-left, -top),
|
||||
TextSelection(),
|
||||
crl::now());
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::onScroll() {
|
||||
if (_skipScrollEvent) {
|
||||
return;
|
||||
}
|
||||
updateInnerVisibleArea();
|
||||
}
|
||||
|
||||
void Widget::updateInnerVisibleArea() {
|
||||
const auto scrollTop = _scroll->scrollTop();
|
||||
_inner->setVisibleTopBottom(scrollTop, scrollTop + _scroll->height());
|
||||
updateScrollDownVisibility();
|
||||
}
|
||||
|
||||
void Widget::showAnimatedHook(
|
||||
const Window::SectionSlideParams ¶ms) {
|
||||
_topBar->setAnimatingMode(true);
|
||||
if (params.withTopBarShadow) _topBarShadow->show();
|
||||
}
|
||||
|
||||
void Widget::showFinishedHook() {
|
||||
_topBar->setAnimatingMode(false);
|
||||
}
|
||||
|
||||
bool Widget::wheelEventFromFloatPlayer(QEvent *e) {
|
||||
return _scroll->viewportEvent(e);
|
||||
}
|
||||
|
||||
QRect Widget::rectForFloatPlayer() const {
|
||||
return mapToGlobal(_scroll->geometry());
|
||||
}
|
||||
|
||||
void Widget::forwardSelected() {
|
||||
auto items = _inner->getSelectedItems();
|
||||
if (items.empty()) {
|
||||
return;
|
||||
}
|
||||
const auto weak = make_weak(this);
|
||||
Window::ShowForwardMessagesBox(std::move(items), [=] {
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->clearSelected();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Widget::confirmDeleteSelected() {
|
||||
auto items = _inner->getSelectedItems();
|
||||
if (items.empty()) {
|
||||
return;
|
||||
}
|
||||
const auto weak = make_weak(this);
|
||||
const auto box = Ui::show(Box<DeleteMessagesBox>(std::move(items)));
|
||||
box->setDeleteConfirmedCallback([=] {
|
||||
if (const auto strong = weak.data()) {
|
||||
strong->clearSelected();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Widget::clearSelected() {
|
||||
_inner->cancelSelection();
|
||||
}
|
||||
|
||||
} // namespace HistoryFeed
|
|
@ -1,179 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/effects/animations.h"
|
||||
#include "history/view/history_view_list_widget.h"
|
||||
#include "window/section_widget.h"
|
||||
#include "window/section_memento.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "history/history_item.h"
|
||||
#include "history/admin_log/history_admin_log_item.h"
|
||||
|
||||
namespace Ui {
|
||||
class ScrollArea;
|
||||
class PlainShadow;
|
||||
class FlatButton;
|
||||
class HistoryDownButton;
|
||||
} // namespace Ui
|
||||
|
||||
namespace HistoryView {
|
||||
class ListWidget;
|
||||
class TopBarWidget;
|
||||
class Element;
|
||||
} // namespace HistoryView
|
||||
|
||||
namespace Window {
|
||||
class DateClickHandler;
|
||||
} // namespace Window
|
||||
|
||||
namespace HistoryFeed {
|
||||
|
||||
class Memento;
|
||||
|
||||
class Widget final
|
||||
: public Window::SectionWidget
|
||||
, public HistoryView::ListDelegate {
|
||||
public:
|
||||
using Element = HistoryView::Element;
|
||||
|
||||
Widget(
|
||||
QWidget *parent,
|
||||
not_null<Window::Controller*> controller,
|
||||
not_null<Data::Feed*> feed);
|
||||
|
||||
Dialogs::RowDescriptor activeChat() const override;
|
||||
|
||||
bool hasTopBarShadow() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
QPixmap grabForShowAnimation(
|
||||
const Window::SectionSlideParams ¶ms) override;
|
||||
|
||||
bool showInternal(
|
||||
not_null<Window::SectionMemento*> memento,
|
||||
const Window::SectionShow ¶ms) override;
|
||||
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
||||
|
||||
void setInternalState(
|
||||
const QRect &geometry,
|
||||
not_null<Memento*> memento);
|
||||
|
||||
// Float player interface.
|
||||
bool wheelEventFromFloatPlayer(QEvent *e) override;
|
||||
QRect rectForFloatPlayer() const override;
|
||||
|
||||
// HistoryView::ListDelegate interface.
|
||||
HistoryView::Context listContext() override;
|
||||
void listScrollTo(int top) override;
|
||||
void listCancelRequest() override;
|
||||
void listDeleteRequest() override;
|
||||
rpl::producer<Data::MessagesSlice> listSource(
|
||||
Data::MessagePosition aroundId,
|
||||
int limitBefore,
|
||||
int limitAfter) override;
|
||||
bool listAllowsMultiSelect() override;
|
||||
bool listIsLessInOrder(
|
||||
not_null<HistoryItem*> first,
|
||||
not_null<HistoryItem*> second) override;
|
||||
void listSelectionChanged(
|
||||
HistoryView::SelectedItems &&items) override;
|
||||
void listVisibleItemsChanged(HistoryItemsList &&items) override;
|
||||
std::optional<int> listUnreadBarView(
|
||||
const std::vector<not_null<Element*>> &elements) override;
|
||||
void listContentRefreshed() override;
|
||||
ClickHandlerPtr listDateLink(not_null<Element*> view) override;
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
|
||||
void showAnimatedHook(
|
||||
const Window::SectionSlideParams ¶ms) override;
|
||||
void showFinishedHook() override;
|
||||
void doSetInnerFocus() override;
|
||||
|
||||
private:
|
||||
void checkForSingleChannelFeed();
|
||||
void onScroll();
|
||||
void updateInnerVisibleArea();
|
||||
void updateControlsGeometry();
|
||||
void updateAdaptiveLayout();
|
||||
void saveState(not_null<Memento*> memento);
|
||||
void restoreState(not_null<Memento*> memento);
|
||||
void showAtPosition(Data::MessagePosition position);
|
||||
bool showAtPositionNow(Data::MessagePosition position);
|
||||
void validateEmptyTextItem();
|
||||
|
||||
void setupScrollDownButton();
|
||||
void scrollDownClicked();
|
||||
void scrollDownAnimationFinish();
|
||||
void updateScrollDownVisibility();
|
||||
void updateScrollDownPosition();
|
||||
|
||||
void forwardSelected();
|
||||
void confirmDeleteSelected();
|
||||
void clearSelected();
|
||||
|
||||
void setupShortcuts();
|
||||
|
||||
not_null<Data::Feed*> _feed;
|
||||
object_ptr<Ui::ScrollArea> _scroll;
|
||||
QPointer<HistoryView::ListWidget> _inner;
|
||||
object_ptr<HistoryView::TopBarWidget> _topBar;
|
||||
object_ptr<Ui::PlainShadow> _topBarShadow;
|
||||
object_ptr<Ui::FlatButton> _showNext;
|
||||
bool _skipScrollEvent = false;
|
||||
bool _undefinedAroundPosition = false;
|
||||
std::unique_ptr<HistoryItem, HistoryItem::Destroyer> _emptyTextItem;
|
||||
std::unique_ptr<HistoryView::Element> _emptyTextView;
|
||||
|
||||
FullMsgId _currentMessageId;
|
||||
FullMsgId _highlightMessageId;
|
||||
std::optional<Data::MessagePosition> _nextAnimatedScrollPosition;
|
||||
int _nextAnimatedScrollDelta = 0;
|
||||
|
||||
Ui::Animations::Simple _scrollDownShown;
|
||||
bool _scrollDownIsShown = false;
|
||||
object_ptr<Ui::HistoryDownButton> _scrollDown;
|
||||
std::shared_ptr<Window::DateClickHandler> _dateLink;
|
||||
|
||||
};
|
||||
|
||||
class Memento : public Window::SectionMemento {
|
||||
public:
|
||||
explicit Memento(
|
||||
not_null<Data::Feed*> feed,
|
||||
Data::MessagePosition position = Data::UnreadMessagePosition);
|
||||
~Memento();
|
||||
|
||||
object_ptr<Window::SectionWidget> createWidget(
|
||||
QWidget *parent,
|
||||
not_null<Window::Controller*> controller,
|
||||
Window::Column column,
|
||||
const QRect &geometry) override;
|
||||
|
||||
not_null<Data::Feed*> feed() const {
|
||||
return _feed;
|
||||
}
|
||||
Data::MessagePosition position() const {
|
||||
return _position;
|
||||
}
|
||||
not_null<HistoryView::ListMemento*> list() const {
|
||||
return _list.get();
|
||||
}
|
||||
|
||||
private:
|
||||
not_null<Data::Feed*> _feed;
|
||||
Data::MessagePosition _position;
|
||||
std::unique_ptr<HistoryView::ListMemento> _list;
|
||||
|
||||
};
|
||||
|
||||
} // namespace HistoryFeed
|
|
@ -39,7 +39,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/storage_facade.h"
|
||||
#include "storage/storage_shared_media.h"
|
||||
#include "storage/storage_account.h"
|
||||
//#include "storage/storage_feed_messages.h" // #feed
|
||||
#include "support/support_helper.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/text/text_options.h"
|
||||
|
@ -159,13 +158,6 @@ void History::checkChatListMessageRemoved(not_null<HistoryItem*> item) {
|
|||
}
|
||||
setChatListMessageUnknown();
|
||||
refreshChatListMessage();
|
||||
//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) {
|
||||
|
@ -2165,26 +2157,11 @@ void History::setNotLoadedAtBottom() {
|
|||
|
||||
session().storage().invalidate(
|
||||
Storage::SharedMediaInvalidateBottom(peer->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()) { // #feed
|
||||
// if (const auto feed = channel->feed()) {
|
||||
// session().storage().remove(
|
||||
// Storage::FeedMessagesRemoveAll(
|
||||
// feed->id(),
|
||||
// channel->bareId()));
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
void History::setLastServerMessage(HistoryItem *item) {
|
||||
|
@ -2415,15 +2392,6 @@ bool History::lastServerMessageKnown() const {
|
|||
|
||||
void History::updateChatListExistence() {
|
||||
Entry::updateChatListExistence();
|
||||
//if (const auto channel = peer->asChannel()) { // #feed
|
||||
// if (!channel->feed()) {
|
||||
// // After ungrouping from a feed we need to load dialog.
|
||||
// requestChatListMessage();
|
||||
// if (!unreadCountKnown()) {
|
||||
// owner().histories().requestDialogEntry(this);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
bool History::useTopPromotion() const {
|
||||
|
@ -2456,8 +2424,6 @@ bool History::shouldBeInChatList() const {
|
|||
} else if (const auto channel = peer->asChannel()) {
|
||||
if (!channel->amIn()) {
|
||||
return isTopPromoted();
|
||||
//} else if (const auto feed = channel->feed()) { // #feed
|
||||
// return !feed->needUpdateInChatList();
|
||||
}
|
||||
} else if (const auto chat = peer->asChat()) {
|
||||
return chat->amIn()
|
||||
|
@ -3077,12 +3043,6 @@ void History::clear(ClearType type) {
|
|||
_loadedAtTop = _loadedAtBottom = _lastMessage.has_value();
|
||||
clearSharedMedia();
|
||||
clearLastKeyboard();
|
||||
if (const auto channel = peer->asChannel()) {
|
||||
//if (const auto feed = channel->feed()) { // #feed
|
||||
// // Should be after resetting the _lastMessage.
|
||||
// feed->historyCleared(this);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
if (const auto chat = peer->asChat()) {
|
||||
|
|
|
@ -25,7 +25,6 @@ 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" // #feed
|
||||
#include "main/main_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "media/audio/media_audio.h"
|
||||
|
@ -558,13 +557,6 @@ void HistoryItem::indexAsNewItem() {
|
|||
_history->peer->setHasPinnedMessages(true);
|
||||
}
|
||||
}
|
||||
//if (const auto channel = history()->peer->asChannel()) { // #feed
|
||||
// if (const auto feed = channel->feed()) {
|
||||
// _history->session().storage().add(Storage::FeedMessagesAddNew(
|
||||
// feed->id(),
|
||||
// position()));
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ 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" // #feed
|
||||
#include "history/view/controls/history_view_voice_record_bar.h"
|
||||
#include "history/view/controls/history_view_ttl_button.h"
|
||||
#include "history/view/history_view_service_message.h"
|
||||
|
|
|
@ -61,17 +61,6 @@ namespace {
|
|||
constexpr auto kExportLocalTimeout = crl::time(1000);
|
||||
constexpr auto kRescheduleLimit = 20;
|
||||
|
||||
//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
|
||||
// grouped ? tr::lng_feed_ungroup(tr::now) : tr::lng_feed_group(tr::now),
|
||||
// [=] { Window::ToggleChannelGrouping(channel, !grouped); });
|
||||
// }
|
||||
//}
|
||||
|
||||
MsgId ItemIdAcrossData(not_null<HistoryItem*> item) {
|
||||
if (!item->isScheduled() || item->isSending() || item->hasFailed()) {
|
||||
return item->id;
|
||||
|
@ -929,18 +918,6 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
|
|||
AddPhotoActions(result, photo, list);
|
||||
} else if (linkDocument) {
|
||||
AddDocumentActions(result, document, itemId, list);
|
||||
//} 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 (poll) {
|
||||
AddPollActions(result, poll, item, list->elementContext());
|
||||
} else if (!request.overSelection && view && !hasSelection) {
|
||||
|
|
|
@ -34,7 +34,6 @@ enum class Context : char {
|
|||
History,
|
||||
Replies,
|
||||
Pinned,
|
||||
//Feed, // #feed
|
||||
AdminLog,
|
||||
ContactPreview
|
||||
};
|
||||
|
|
|
@ -1196,7 +1196,6 @@ bool Message::hasFromPhoto() const {
|
|||
}
|
||||
switch (context()) {
|
||||
case Context::AdminLog:
|
||||
//case Context::Feed: // #feed
|
||||
return true;
|
||||
case Context::History:
|
||||
case Context::Pinned:
|
||||
|
@ -2078,7 +2077,6 @@ bool Message::displayPinIcon() const {
|
|||
bool Message::hasFromName() const {
|
||||
switch (context()) {
|
||||
case Context::AdminLog:
|
||||
//case Context::Feed: // #feed
|
||||
return true;
|
||||
case Context::History:
|
||||
case Context::Pinned:
|
||||
|
|
|
@ -384,9 +384,6 @@ QSize Service::performCountOptimalSize() {
|
|||
}
|
||||
|
||||
bool Service::isHidden() const {
|
||||
//if (context() == Context::Feed) { // #feed
|
||||
// return true;
|
||||
//}
|
||||
return Element::isHidden();
|
||||
}
|
||||
|
||||
|
|
|
@ -553,10 +553,6 @@ void TopBarWidget::infoClicked() {
|
|||
return;
|
||||
} else if (key.folder()) {
|
||||
_controller->closeFolder();
|
||||
//} else if (const auto feed = _activeChat.feed()) { // #feed
|
||||
// _controller->showSection(std::make_shared<Info::Memento>(
|
||||
// feed,
|
||||
// Info::Section(Info::Section::Type::Profile)));
|
||||
} else if (key.peer()->isSelf()) {
|
||||
_controller->showSection(std::make_shared<Info::Memento>(
|
||||
key.peer(),
|
||||
|
@ -645,13 +641,6 @@ void TopBarWidget::refreshInfoButton() {
|
|||
info->showSavedMessagesOnSelf(true);
|
||||
_info.destroy();
|
||||
_info = std::move(info);
|
||||
//} 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);
|
||||
|
|
|
@ -1,330 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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 "info/feed/info_feed_channels.h"
|
||||
|
||||
#include "info/feed/info_feed_channels_controllers.h"
|
||||
#include "info/profile/info_profile_icon.h"
|
||||
#include "info/profile/info_profile_button.h"
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "info/channels/info_channels_widget.h"
|
||||
#include "info/info_controller.h"
|
||||
#include "info/info_memento.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/search_field_controller.h"
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
#include "data/data_feed.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
namespace Info {
|
||||
namespace FeedProfile {
|
||||
namespace {
|
||||
|
||||
constexpr auto kEnableSearchChannelsAfterCount = 20;
|
||||
|
||||
} // namespace
|
||||
|
||||
Channels::Channels(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller)
|
||||
: RpWidget(parent)
|
||||
, _controller(controller)
|
||||
, _feed(_controller->key().feed())
|
||||
, _listController(std::make_unique<ChannelsController>(_controller)) {
|
||||
setupHeader();
|
||||
setupList();
|
||||
setContent(_list.data());
|
||||
_listController->setDelegate(static_cast<PeerListDelegate*>(this));
|
||||
|
||||
_controller->searchFieldController()->queryValue(
|
||||
) | rpl::start_with_next([this](QString &&query) {
|
||||
peerListScrollToTop();
|
||||
content()->searchQueryChanged(std::move(query));
|
||||
}, lifetime());
|
||||
Profile::FeedChannelsCountValue(
|
||||
_feed
|
||||
) | rpl::start_with_next([this](int count) {
|
||||
const auto enabled = (count >= kEnableSearchChannelsAfterCount);
|
||||
_controller->setSearchEnabledByContent(enabled);
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
int Channels::desiredHeight() const {
|
||||
auto desired = _header ? _header->height() : 0;
|
||||
desired += st::infoChannelsList.item.height
|
||||
* std::max(int(_feed->channels().size()), _list->fullRowsCount());
|
||||
return qMax(height(), desired);
|
||||
}
|
||||
|
||||
rpl::producer<Ui::ScrollToRequest> Channels::scrollToRequests() const {
|
||||
return _scrollToRequests.events();
|
||||
}
|
||||
|
||||
std::unique_ptr<ChannelsState> Channels::saveState() {
|
||||
auto result = std::make_unique<ChannelsState>();
|
||||
result->list = _listController->saveState();
|
||||
return result;
|
||||
}
|
||||
|
||||
void Channels::restoreState(std::unique_ptr<ChannelsState> state) {
|
||||
if (!state) {
|
||||
return;
|
||||
}
|
||||
_listController->restoreState(std::move(state->list));
|
||||
}
|
||||
|
||||
void Channels::setupHeader() {
|
||||
if (_controller->section().type() == Section::Type::Channels) {
|
||||
return;
|
||||
}
|
||||
_header = object_ptr<Ui::FixedHeightWidget>(
|
||||
this,
|
||||
st::infoMembersHeader);
|
||||
auto parent = _header.data();
|
||||
|
||||
_openChannels = Ui::CreateChild<Profile::Button>(
|
||||
parent,
|
||||
rpl::single(QString()));
|
||||
|
||||
// #feed
|
||||
//object_ptr<Profile::FloatingIcon>(
|
||||
// parent,
|
||||
// st::infoIconFeed,
|
||||
// st::infoIconPosition);
|
||||
|
||||
_titleWrap = Ui::CreateChild<Ui::RpWidget>(parent);
|
||||
_title = setupTitle();
|
||||
_addChannel = Ui::CreateChild<Ui::IconButton>(
|
||||
_openChannels,
|
||||
st::infoChannelsAddChannel);
|
||||
_search = Ui::CreateChild<Ui::IconButton>(
|
||||
_openChannels,
|
||||
st::infoMembersSearch);
|
||||
|
||||
setupButtons();
|
||||
|
||||
widthValue(
|
||||
) | rpl::start_with_next([this](int width) {
|
||||
_header->resizeToWidth(width);
|
||||
}, _header->lifetime());
|
||||
}
|
||||
|
||||
object_ptr<Ui::FlatLabel> Channels::setupTitle() {
|
||||
auto result = object_ptr<Ui::FlatLabel>(
|
||||
_titleWrap,
|
||||
Profile::FeedChannelsCountValue(
|
||||
_feed
|
||||
) | rpl::map([](int count) {
|
||||
return lng_feed_channels(lt_count, count);
|
||||
}) | Profile::ToUpperValue(),
|
||||
st::infoBlockHeaderLabel);
|
||||
result->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Channels::setupButtons() {
|
||||
using namespace rpl::mappers;
|
||||
|
||||
_openChannels->addClickHandler([this] {
|
||||
showChannelsWithSearch(false);
|
||||
});
|
||||
|
||||
_addChannel->addClickHandler([this] { // TODO throttle(ripple duration)
|
||||
this->addChannel();
|
||||
});
|
||||
|
||||
auto searchShown = Profile::FeedChannelsCountValue(_feed)
|
||||
| rpl::map(_1 >= kEnableSearchChannelsAfterCount)
|
||||
| rpl::distinct_until_changed()
|
||||
| rpl::start_spawning(lifetime());
|
||||
_search->showOn(rpl::duplicate(searchShown));
|
||||
_search->addClickHandler([this] { // TODO throttle(ripple duration)
|
||||
this->showChannelsWithSearch(true);
|
||||
});
|
||||
|
||||
std::move(
|
||||
searchShown
|
||||
) | rpl::start_with_next([this] {
|
||||
updateHeaderControlsGeometry(width());
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void Channels::setupList() {
|
||||
auto topSkip = _header ? _header->height() : 0;
|
||||
_list = object_ptr<ListWidget>(
|
||||
this,
|
||||
_listController.get(),
|
||||
st::infoChannelsList);
|
||||
_list->scrollToRequests(
|
||||
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
|
||||
auto addmin = (request.ymin < 0 || !_header)
|
||||
? 0
|
||||
: _header->height();
|
||||
auto addmax = (request.ymax < 0 || !_header)
|
||||
? 0
|
||||
: _header->height();
|
||||
_scrollToRequests.fire({
|
||||
request.ymin + addmin,
|
||||
request.ymax + addmax });
|
||||
}, _list->lifetime());
|
||||
widthValue(
|
||||
) | rpl::start_with_next([this](int newWidth) {
|
||||
_list->resizeToWidth(newWidth);
|
||||
}, _list->lifetime());
|
||||
_list->heightValue(
|
||||
) | rpl::start_with_next([=](int listHeight) {
|
||||
auto newHeight = (listHeight > st::membersMarginBottom)
|
||||
? (topSkip
|
||||
+ listHeight
|
||||
+ st::membersMarginBottom)
|
||||
: 0;
|
||||
resize(width(), newHeight);
|
||||
}, _list->lifetime());
|
||||
_list->moveToLeft(0, topSkip);
|
||||
}
|
||||
|
||||
int Channels::resizeGetHeight(int newWidth) {
|
||||
if (_header) {
|
||||
updateHeaderControlsGeometry(newWidth);
|
||||
}
|
||||
return heightNoMargins();
|
||||
}
|
||||
|
||||
//void Channels::updateSearchEnabledByContent() {
|
||||
// _controller->setSearchEnabledByContent(
|
||||
// peerListFullRowsCount() >= kEnableSearchMembersAfterCount);
|
||||
//}
|
||||
|
||||
void Channels::updateHeaderControlsGeometry(int newWidth) {
|
||||
_openChannels->setGeometry(0, st::infoProfileSkip, newWidth, st::infoMembersHeader - st::infoProfileSkip - st::infoMembersHeaderPaddingBottom);
|
||||
|
||||
auto availableWidth = newWidth
|
||||
- st::infoMembersButtonPosition.x();
|
||||
|
||||
//auto cancelLeft = availableWidth - _cancelSearch->width();
|
||||
//_cancelSearch->moveToLeft(
|
||||
// cancelLeft,
|
||||
// st::infoMembersButtonPosition.y());
|
||||
|
||||
//auto searchShownLeft = st::infoIconPosition.x()
|
||||
// - st::infoMembersSearch.iconPosition.x();
|
||||
//auto searchHiddenLeft = availableWidth - _search->width();
|
||||
//auto searchShown = _searchShownAnimation.value(_searchShown ? 1. : 0.);
|
||||
//auto searchCurrentLeft = anim::interpolate(
|
||||
// searchHiddenLeft,
|
||||
// searchShownLeft,
|
||||
// searchShown);
|
||||
//_search->moveToLeft(
|
||||
// searchCurrentLeft,
|
||||
// st::infoMembersButtonPosition.y());
|
||||
|
||||
//if (!_search->isHidden()) {
|
||||
// availableWidth -= st::infoMembersSearch.width;
|
||||
//}
|
||||
_addChannel->moveToLeft(
|
||||
availableWidth - _addChannel->width(),
|
||||
st::infoMembersButtonPosition.y(),
|
||||
newWidth);
|
||||
if (!_addChannel->isHidden()) {
|
||||
availableWidth -= st::infoMembersSearch.width;
|
||||
}
|
||||
_search->moveToLeft(
|
||||
availableWidth - _search->width(),
|
||||
st::infoMembersButtonPosition.y(),
|
||||
newWidth);
|
||||
|
||||
//auto fieldLeft = anim::interpolate(
|
||||
// cancelLeft,
|
||||
// st::infoBlockHeaderPosition.x(),
|
||||
// searchShown);
|
||||
//_searchField->setGeometryToLeft(
|
||||
// fieldLeft,
|
||||
// st::infoMembersSearchTop,
|
||||
// cancelLeft - fieldLeft,
|
||||
// _searchField->height());
|
||||
|
||||
//_titleWrap->resize(
|
||||
// searchCurrentLeft - st::infoBlockHeaderPosition.x(),
|
||||
// _title->height());
|
||||
_titleWrap->resize(
|
||||
availableWidth - _addChannel->width() - st::infoBlockHeaderPosition.x(),
|
||||
_title->height());
|
||||
_titleWrap->moveToLeft(
|
||||
st::infoBlockHeaderPosition.x(),
|
||||
st::infoBlockHeaderPosition.y(),
|
||||
newWidth);
|
||||
_titleWrap->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
//_title->resizeToWidth(searchHiddenLeft);
|
||||
_title->resizeToWidth(_titleWrap->width());
|
||||
_title->moveToLeft(0, 0);
|
||||
}
|
||||
|
||||
void Channels::addChannel() {
|
||||
EditController::Start(_feed);
|
||||
}
|
||||
|
||||
void Channels::showChannelsWithSearch(bool withSearch) {
|
||||
auto contentMemento = std::make_unique<Info::Channels::Memento>(
|
||||
_controller);
|
||||
contentMemento->setState(saveState());
|
||||
contentMemento->setSearchStartsFocused(withSearch);
|
||||
auto mementoStack = std::vector<std::unique_ptr<ContentMemento>>();
|
||||
mementoStack.push_back(std::move(contentMemento));
|
||||
_controller->showSection(
|
||||
std::make_unique<Info::Memento>(std::move(mementoStack)));
|
||||
}
|
||||
|
||||
void Channels::visibleTopBottomUpdated(
|
||||
int visibleTop,
|
||||
int visibleBottom) {
|
||||
setChildVisibleTopBottom(_list, visibleTop, visibleBottom);
|
||||
}
|
||||
|
||||
void Channels::peerListSetTitle(Fn<QString()> title) {
|
||||
}
|
||||
|
||||
void Channels::peerListSetAdditionalTitle(
|
||||
Fn<QString()> title) {
|
||||
}
|
||||
|
||||
bool Channels::peerListIsRowSelected(not_null<PeerData*> peer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int Channels::peerListSelectedRowsCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<not_null<PeerData*>> Channels::peerListCollectSelectedRows() {
|
||||
return {};
|
||||
}
|
||||
|
||||
void Channels::peerListScrollToTop() {
|
||||
_scrollToRequests.fire({ -1, -1 });
|
||||
}
|
||||
|
||||
void Channels::peerListAddSelectedRowInBunch(not_null<PeerData*> peer) {
|
||||
Unexpected("Item selection in Info::Profile::Members.");
|
||||
}
|
||||
|
||||
void Channels::peerListFinishSelectedRowsBunch() {
|
||||
}
|
||||
|
||||
void Channels::peerListSetDescription(
|
||||
object_ptr<Ui::FlatLabel> description) {
|
||||
description.destroy();
|
||||
}
|
||||
|
||||
} // namespace FeedProfile
|
||||
} // namespace Info
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/rp_widget.h"
|
||||
#include "boxes/peer_list_box.h"
|
||||
|
||||
namespace Ui {
|
||||
class InputField;
|
||||
class CrossButton;
|
||||
class IconButton;
|
||||
class FlatLabel;
|
||||
struct ScrollToRequest;
|
||||
class AbstractButton;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Info {
|
||||
|
||||
class Controller;
|
||||
enum class Wrap;
|
||||
|
||||
namespace Profile {
|
||||
class Button;
|
||||
} // namespace Profile
|
||||
|
||||
namespace FeedProfile {
|
||||
|
||||
class Memento;
|
||||
struct ChannelsState {
|
||||
std::unique_ptr<PeerListState> list;
|
||||
std::optional<QString> search;
|
||||
};
|
||||
|
||||
class Channels
|
||||
: public Ui::RpWidget
|
||||
, private PeerListContentDelegate {
|
||||
public:
|
||||
Channels(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller);
|
||||
|
||||
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
|
||||
|
||||
std::unique_ptr<ChannelsState> saveState();
|
||||
void restoreState(std::unique_ptr<ChannelsState> state);
|
||||
|
||||
int desiredHeight() const;
|
||||
|
||||
protected:
|
||||
void visibleTopBottomUpdated(
|
||||
int visibleTop,
|
||||
int visibleBottom) override;
|
||||
int resizeGetHeight(int newWidth) override;
|
||||
|
||||
private:
|
||||
using ListWidget = PeerListContent;
|
||||
|
||||
// PeerListContentDelegate interface.
|
||||
void peerListSetTitle(Fn<QString()> title) override;
|
||||
void peerListSetAdditionalTitle(
|
||||
Fn<QString()> title) override;
|
||||
bool peerListIsRowSelected(not_null<PeerData*> peer) override;
|
||||
int peerListSelectedRowsCount() override;
|
||||
std::vector<not_null<PeerData*>> peerListCollectSelectedRows() override;
|
||||
void peerListScrollToTop() override;
|
||||
void peerListAddSelectedRowInBunch(
|
||||
not_null<PeerData*> peer) override;
|
||||
void peerListFinishSelectedRowsBunch() override;
|
||||
void peerListSetDescription(
|
||||
object_ptr<Ui::FlatLabel> description) override;
|
||||
|
||||
void setupHeader();
|
||||
object_ptr<Ui::FlatLabel> setupTitle();
|
||||
void setupList();
|
||||
|
||||
void setupButtons();
|
||||
void addChannel();
|
||||
void showChannelsWithSearch(bool withSearch);
|
||||
void updateHeaderControlsGeometry(int newWidth);
|
||||
|
||||
not_null<Controller*> _controller;
|
||||
not_null<Data::Feed*> _feed;
|
||||
std::unique_ptr<PeerListController> _listController;
|
||||
object_ptr<Ui::RpWidget> _header = { nullptr };
|
||||
object_ptr<ListWidget> _list = { nullptr };
|
||||
|
||||
Profile::Button *_openChannels = nullptr;
|
||||
Ui::RpWidget *_titleWrap = nullptr;
|
||||
Ui::FlatLabel *_title = nullptr;
|
||||
Ui::IconButton *_addChannel = nullptr;
|
||||
Ui::IconButton *_search = nullptr;
|
||||
|
||||
rpl::event_stream<Ui::ScrollToRequest> _scrollToRequests;
|
||||
|
||||
};
|
||||
|
||||
} // namespace FeedProfile
|
||||
} // namespace Info
|
|
@ -1,458 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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 "info/feed/info_feed_channels_controllers.h"
|
||||
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "info/info_controller.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "history/history.h"
|
||||
#include "window/window_peer_menu.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "auth_session.h"
|
||||
#include "mainwidget.h"
|
||||
#include "apiwrap.h"
|
||||
#include "styles/style_widgets.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
||||
namespace Info {
|
||||
namespace FeedProfile {
|
||||
namespace {
|
||||
|
||||
constexpr auto kChannelsInFeedMin = 4;
|
||||
|
||||
} // namespace
|
||||
|
||||
class ChannelsController::Row final : public PeerListRow {
|
||||
public:
|
||||
Row(not_null<History*> history);
|
||||
|
||||
QSize actionSize() const override;
|
||||
QMargins actionMargins() const override;
|
||||
void paintAction(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
bool selected,
|
||||
bool actionSelected) override;
|
||||
|
||||
not_null<History*> history() const {
|
||||
return _history;
|
||||
}
|
||||
|
||||
private:
|
||||
not_null<History*> _history;
|
||||
|
||||
};
|
||||
|
||||
ChannelsController::Row::Row(not_null<History*> history)
|
||||
: PeerListRow(history->peer)
|
||||
, _history(history) {
|
||||
}
|
||||
|
||||
QSize ChannelsController::Row::actionSize() const {
|
||||
return QRect(
|
||||
QPoint(),
|
||||
st::smallCloseIcon.size()).marginsAdded(
|
||||
st::infoFeedLeaveIconMargins).size();
|
||||
}
|
||||
|
||||
QMargins ChannelsController::Row::actionMargins() const {
|
||||
return QMargins(
|
||||
0,
|
||||
(st::infoCommonGroupsList.item.height - actionSize().height()) / 2,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
|
||||
void ChannelsController::Row::paintAction(
|
||||
Painter &p,
|
||||
int x,
|
||||
int y,
|
||||
int outerWidth,
|
||||
bool selected,
|
||||
bool actionSelected) {
|
||||
if (selected) {
|
||||
x += st::infoFeedLeaveIconMargins.left();
|
||||
y += st::infoFeedLeaveIconMargins.top();
|
||||
(actionSelected
|
||||
? st::smallCloseIconOver
|
||||
: st::smallCloseIcon).paint(p, x, y, outerWidth);
|
||||
}
|
||||
}
|
||||
|
||||
ChannelsController::ChannelsController(not_null<Controller*> controller)
|
||||
: PeerListController()
|
||||
, _controller(controller)
|
||||
, _feed(_controller->key().feed()) {
|
||||
if (!_feed->channelsLoaded()) {
|
||||
// Auth().api().requestFeedChannels(_feed); // #feed
|
||||
}
|
||||
_controller->setSearchEnabledByContent(false);
|
||||
}
|
||||
|
||||
auto ChannelsController::createRow(not_null<History*> history)
|
||||
-> std::unique_ptr<Row> {
|
||||
auto result = std::make_unique<Row>(history);
|
||||
result->setCustomStatus(QString());
|
||||
return result;
|
||||
}
|
||||
|
||||
std::unique_ptr<PeerListRow> ChannelsController::createRestoredRow(
|
||||
not_null<PeerData*> peer) {
|
||||
return createRow(peer->owner().history(peer));
|
||||
}
|
||||
|
||||
void ChannelsController::prepare() {
|
||||
setSearchNoResultsText(lang(lng_feed_channels_not_found));
|
||||
delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled);
|
||||
delegate()->peerListSetTitle(langFactory(lng_info_feed_channels));
|
||||
|
||||
rebuildRows();
|
||||
using Flag = Data::FeedUpdateFlag;
|
||||
Auth().data().feedUpdated(
|
||||
) | rpl::filter([=](const Data::FeedUpdate &update) {
|
||||
return (update.feed == _feed) && (update.flag == Flag::Channels);
|
||||
}) | rpl::filter([=] {
|
||||
return _feed->channelsLoaded();
|
||||
}) | rpl::start_with_next([=] {
|
||||
rebuildRows();
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void ChannelsController::rebuildRows() {
|
||||
if (!_feed->channelsLoaded()) {
|
||||
return;
|
||||
}
|
||||
const auto &channels = _feed->channels();
|
||||
auto count = delegate()->peerListFullRowsCount();
|
||||
for (auto i = 0; i != count;) {
|
||||
const auto row = delegate()->peerListRowAt(i);
|
||||
const auto peer = row->peer();
|
||||
if (ranges::find_if(channels, [=](not_null<History*> history) {
|
||||
return (history->peer == peer);
|
||||
}) != end(channels)) {
|
||||
++i;
|
||||
} else {
|
||||
delegate()->peerListRemoveRow(row);
|
||||
--count;
|
||||
}
|
||||
}
|
||||
for (const auto history : channels) {
|
||||
if (auto row = createRow(history)) {
|
||||
delegate()->peerListAppendRow(std::move(row));
|
||||
}
|
||||
}
|
||||
delegate()->peerListRefreshRows();
|
||||
}
|
||||
|
||||
std::unique_ptr<PeerListState> ChannelsController::saveState() const {
|
||||
auto result = PeerListController::saveState();
|
||||
auto my = std::make_unique<SavedState>();
|
||||
using Flag = Data::FeedUpdateFlag;
|
||||
|
||||
// Must not capture `this` here, because it dies before my->lifetime.
|
||||
Auth().data().feedUpdated(
|
||||
) | rpl::filter([feed = _feed](const Data::FeedUpdate &update) {
|
||||
return (update.feed == feed) && (update.flag == Flag::Channels);
|
||||
}) | rpl::start_with_next([state = result.get()] {
|
||||
state->controllerState = nullptr;
|
||||
}, my->lifetime);
|
||||
result->controllerState = std::move(my);
|
||||
return result;
|
||||
}
|
||||
|
||||
void ChannelsController::restoreState(
|
||||
std::unique_ptr<PeerListState> state) {
|
||||
PeerListController::restoreState(std::move(state));
|
||||
}
|
||||
|
||||
void ChannelsController::rowClicked(not_null<PeerListRow*> row) {
|
||||
_controller->parentController()->showPeerHistory(
|
||||
row->peer(),
|
||||
Window::SectionShow::Way::Forward);
|
||||
}
|
||||
|
||||
void ChannelsController::rowActionClicked(not_null<PeerListRow*> row) {
|
||||
Window::DeleteAndLeaveHandler(row->peer())();
|
||||
}
|
||||
|
||||
base::unique_qptr<Ui::PopupMenu> ChannelsController::rowContextMenu(
|
||||
QWidget *parent,
|
||||
not_null<PeerListRow*> row) {
|
||||
auto my = static_cast<Row*>(row.get());
|
||||
auto channel = my->history()->peer->asChannel();
|
||||
|
||||
auto result = base::make_unique_q<Ui::PopupMenu>(parent);
|
||||
Window::PeerMenuAddMuteAction(channel, [&](
|
||||
const QString &text,
|
||||
Fn<void()> handler) {
|
||||
return result->addAction(text, handler);
|
||||
});
|
||||
//result->addAction( // #feed
|
||||
// lang(lng_feed_ungroup),
|
||||
// [=] { Window::ToggleChannelGrouping(channel, false); });
|
||||
|
||||
result->addAction(
|
||||
lang(lng_profile_leave_channel),
|
||||
Window::DeleteAndLeaveHandler(channel));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void NotificationsController::Start(not_null<Data::Feed*> feed) {
|
||||
const auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_settings_save), [=] {
|
||||
const auto count = box->peerListFullRowsCount();
|
||||
for (auto i = 0; i != count; ++i) {
|
||||
const auto row = box->peerListRowAt(i);
|
||||
const auto peer = row->peer();
|
||||
const auto muted = !row->checked();
|
||||
if (muted != Auth().data().notifyIsMuted(peer)) {
|
||||
Auth().data().updateNotifySettings(
|
||||
peer,
|
||||
(muted
|
||||
? Data::NotifySettings::kDefaultMutePeriod
|
||||
: 0));
|
||||
}
|
||||
}
|
||||
box->closeBox();
|
||||
});
|
||||
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
|
||||
};
|
||||
Ui::show(Box<PeerListBox>(
|
||||
std::make_unique<NotificationsController>(feed),
|
||||
initBox));
|
||||
}
|
||||
|
||||
NotificationsController::NotificationsController(
|
||||
not_null<Data::Feed*> feed)
|
||||
: _feed(feed) {
|
||||
}
|
||||
|
||||
void NotificationsController::prepare() {
|
||||
setSearchNoResultsText(lang(lng_feed_channels_not_found));
|
||||
delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled);
|
||||
delegate()->peerListSetTitle(langFactory(lng_feed_notifications));
|
||||
|
||||
loadMoreRows();
|
||||
}
|
||||
|
||||
void NotificationsController::loadMoreRows() {
|
||||
if (_preloadRequestId || _allLoaded) {
|
||||
return;
|
||||
}
|
||||
// const auto hash = 0;
|
||||
//_preloadRequestId = request(MTPmessages_GetDialogs( // #feed
|
||||
// MTP_flags(MTPmessages_GetDialogs::Flag::f_feed_id),
|
||||
// MTP_int(_feed->id()),
|
||||
// MTP_int(_preloadOffsetDate),
|
||||
// MTP_int(_preloadOffsetId),
|
||||
// _preloadPeer ? _preloadPeer->input : MTP_inputPeerEmpty(),
|
||||
// MTP_int(Data::Feed::kChannelsLimit),
|
||||
// MTP_int(hash)
|
||||
//)).done([=](const MTPmessages_Dialogs &result) {
|
||||
// applyFeedDialogs(result);
|
||||
// _preloadRequestId = 0;
|
||||
//}).fail([=](const RPCError &error) {
|
||||
// _preloadRequestId = 0;
|
||||
//}).send();
|
||||
}
|
||||
|
||||
void NotificationsController::applyFeedDialogs(
|
||||
const MTPmessages_Dialogs &result) {
|
||||
const auto [dialogsList, messagesList] = [&] {
|
||||
const auto process = [&](const auto &data) {
|
||||
_feed->owner().processUsers(data.vusers);
|
||||
_feed->owner().processChats(data.vchats);
|
||||
return std::make_tuple(&data.vdialogs.v, &data.vmessages.v);
|
||||
};
|
||||
switch (result.type()) {
|
||||
case mtpc_messages_dialogs:
|
||||
_allLoaded = true;
|
||||
return process(result.c_messages_dialogs());
|
||||
|
||||
case mtpc_messages_dialogsSlice:
|
||||
LOG(("API Error: "
|
||||
"Unexpected dialogsSlice in feed dialogs list."));
|
||||
return process(result.c_messages_dialogsSlice());
|
||||
}
|
||||
Unexpected("Type in NotificationsController::applyFeedDialogs");
|
||||
}();
|
||||
|
||||
App::feedMsgs(*messagesList, NewMessageLast);
|
||||
|
||||
if (dialogsList->empty()) {
|
||||
_allLoaded = true;
|
||||
}
|
||||
auto channels = std::vector<not_null<ChannelData*>>();
|
||||
channels.reserve(dialogsList->size());
|
||||
for (const auto &dialog : *dialogsList) {
|
||||
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(data);
|
||||
channels.emplace_back(channel);
|
||||
} else {
|
||||
LOG(("API Error: "
|
||||
"Unexpected non-channel in folder dialogs list."));
|
||||
}
|
||||
}
|
||||
}, [&](const MTPDdialogFolder &data) {
|
||||
LOG(("API Error: Unexpected dialogFolder in folder dialogs list."));
|
||||
});
|
||||
}
|
||||
if (!channels.empty()) {
|
||||
auto notMutedChannels = ranges::view::all(
|
||||
channels
|
||||
) | ranges::view::filter([](not_null<ChannelData*> channel) {
|
||||
return !Auth().data().notifyIsMuted(channel);
|
||||
});
|
||||
delegate()->peerListAddSelectedRows(notMutedChannels);
|
||||
for (const auto channel : channels) {
|
||||
delegate()->peerListAppendRow(createRow(channel));
|
||||
}
|
||||
}
|
||||
delegate()->peerListRefreshRows();
|
||||
}
|
||||
|
||||
void NotificationsController::rowClicked(not_null<PeerListRow*> row) {
|
||||
delegate()->peerListSetRowChecked(row, !row->checked());
|
||||
}
|
||||
|
||||
std::unique_ptr<PeerListRow> NotificationsController::createRow(
|
||||
not_null<ChannelData*> channel) {
|
||||
return std::make_unique<PeerListRow>(channel);
|
||||
}
|
||||
|
||||
void EditController::Start(
|
||||
not_null<Data::Feed*> feed,
|
||||
ChannelData *channel) {
|
||||
const auto initBox = [=](not_null<PeerListBox*> box) {
|
||||
box->addButton(langFactory(lng_settings_save), [=] {
|
||||
auto channels = std::vector<not_null<ChannelData*>>();
|
||||
const auto main = App::main();
|
||||
const auto count = box->peerListFullRowsCount();
|
||||
for (auto i = 0; i != count; ++i) {
|
||||
const auto row = box->peerListRowAt(i);
|
||||
if (row->checked()) {
|
||||
channels.push_back(row->peer()->asChannel());
|
||||
}
|
||||
}
|
||||
if (channels.size() < kChannelsInFeedMin) {
|
||||
Ui::Toast::Show(lng_feed_select_more_channels(
|
||||
lt_count,
|
||||
kChannelsInFeedMin));
|
||||
return;
|
||||
}
|
||||
box->closeBox();
|
||||
//Auth().api().setFeedChannels(feed, channels); // #feed
|
||||
});
|
||||
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
|
||||
};
|
||||
Ui::show(Box<PeerListBox>(
|
||||
std::make_unique<EditController>(feed, channel),
|
||||
initBox));
|
||||
}
|
||||
|
||||
EditController::EditController(
|
||||
not_null<Data::Feed*> feed,
|
||||
ChannelData *channel)
|
||||
: _feed(feed) {
|
||||
//, _startWithChannel(channel) { // #feed
|
||||
}
|
||||
|
||||
void EditController::prepare() {
|
||||
setSearchNoResultsText(lang(lng_feed_channels_not_found));
|
||||
delegate()->peerListSetSearchMode(PeerListSearchMode::Enabled);
|
||||
delegate()->peerListSetTitle(langFactory(
|
||||
(_feed->channels().size() < kChannelsInFeedMin
|
||||
? lng_feed_create_new
|
||||
: lng_feed_edit_title)));
|
||||
|
||||
loadMoreRows();
|
||||
}
|
||||
|
||||
void EditController::loadMoreRows() {
|
||||
if (_preloadRequestId || _allLoaded) {
|
||||
return;
|
||||
}
|
||||
//const auto hash = 0; // #feed
|
||||
//_preloadRequestId = request(MTPchannels_GetFeedSources(
|
||||
// MTP_flags(0),
|
||||
// MTP_int(0),
|
||||
// MTP_int(hash)
|
||||
//)).done([=](const MTPchannels_FeedSources &result) {
|
||||
// applyFeedSources(result);
|
||||
// _preloadRequestId = 0;
|
||||
//}).fail([=](const RPCError &error) {
|
||||
// _preloadRequestId = 0;
|
||||
//}).send();
|
||||
}
|
||||
// #feed
|
||||
//void EditController::applyFeedSources(
|
||||
// const MTPchannels_FeedSources &result) {
|
||||
// auto channels = std::vector<not_null<ChannelData*>>();
|
||||
//
|
||||
// switch (result.type()) {
|
||||
// case mtpc_channels_feedSourcesNotModified:
|
||||
// LOG(("API Error: Unexpected channels.feedSourcesNotModified."));
|
||||
// break;
|
||||
//
|
||||
// case mtpc_channels_feedSources: {
|
||||
// const auto &data = result.c_channels_feedSources();
|
||||
// Auth().api().applyFeedSources(data);
|
||||
//
|
||||
// for (const auto &chat : data.vchats.v) {
|
||||
// if (chat.type() == mtpc_channel) {
|
||||
// channels.push_back(_feed->owner().channel(chat.c_channel().vid.v));
|
||||
// }
|
||||
// }
|
||||
// } break;
|
||||
//
|
||||
// default: Unexpected("Type in channels.getFeedSources response.");
|
||||
// }
|
||||
//
|
||||
// _allLoaded = true;
|
||||
// if (channels.size() < kChannelsInFeedMin) {
|
||||
// setDescriptionText(lng_feed_too_few_channels(
|
||||
// lt_count,
|
||||
// kChannelsInFeedMin));
|
||||
// delegate()->peerListSetSearchMode(PeerListSearchMode::Disabled);
|
||||
// } else {
|
||||
// auto alreadyInFeed = ranges::view::all(
|
||||
// channels
|
||||
// ) | ranges::view::filter([&](not_null<ChannelData*> channel) {
|
||||
// return (channel->feed() == _feed)
|
||||
// || (channel == _startWithChannel);
|
||||
// });
|
||||
// delegate()->peerListAddSelectedRows(alreadyInFeed);
|
||||
// for (const auto channel : channels) {
|
||||
// delegate()->peerListAppendRow(createRow(channel));
|
||||
// }
|
||||
// }
|
||||
// delegate()->peerListRefreshRows();
|
||||
//}
|
||||
|
||||
void EditController::rowClicked(not_null<PeerListRow*> row) {
|
||||
delegate()->peerListSetRowChecked(row, !row->checked());
|
||||
}
|
||||
|
||||
std::unique_ptr<PeerListRow> EditController::createRow(
|
||||
not_null<ChannelData*> channel) {
|
||||
return std::make_unique<PeerListRow>(channel);
|
||||
}
|
||||
|
||||
} // namespace FeedProfile
|
||||
} // namespace Info
|
|
@ -1,111 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "boxes/peer_list_box.h"
|
||||
#include "mtproto/sender.h"
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
} // namespace Data
|
||||
|
||||
namespace Info {
|
||||
|
||||
class Controller;
|
||||
|
||||
namespace FeedProfile {
|
||||
|
||||
class ChannelsController
|
||||
: public PeerListController
|
||||
, private base::Subscriber {
|
||||
public:
|
||||
ChannelsController(not_null<Controller*> controller);
|
||||
|
||||
void prepare() override;
|
||||
void rowClicked(not_null<PeerListRow*> row) override;
|
||||
void rowActionClicked(not_null<PeerListRow*> row) override;
|
||||
|
||||
std::unique_ptr<PeerListRow> createRestoredRow(
|
||||
not_null<PeerData*> peer) override;
|
||||
base::unique_qptr<Ui::PopupMenu> rowContextMenu(
|
||||
QWidget *parent,
|
||||
not_null<PeerListRow*> row) override;
|
||||
|
||||
std::unique_ptr<PeerListState> saveState() const override;
|
||||
void restoreState(std::unique_ptr<PeerListState> state) override;
|
||||
|
||||
private:
|
||||
class Row;
|
||||
struct SavedState : SavedStateBase {
|
||||
rpl::lifetime lifetime;
|
||||
};
|
||||
|
||||
void rebuildRows();
|
||||
std::unique_ptr<Row> createRow(not_null<History*> history);
|
||||
|
||||
const not_null<Controller*> _controller;
|
||||
not_null<Data::Feed*> _feed;
|
||||
|
||||
};
|
||||
|
||||
class NotificationsController
|
||||
: public PeerListController
|
||||
, private MTP::Sender {
|
||||
public:
|
||||
static void Start(not_null<Data::Feed*> feed);
|
||||
|
||||
NotificationsController(not_null<Data::Feed*> feed);
|
||||
|
||||
void prepare() override;
|
||||
void rowClicked(not_null<PeerListRow*> row) override;
|
||||
|
||||
void loadMoreRows() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<PeerListRow> createRow(not_null<ChannelData*> channel);
|
||||
void applyFeedDialogs(const MTPmessages_Dialogs &result);
|
||||
|
||||
not_null<Data::Feed*> _feed;
|
||||
mtpRequestId _preloadRequestId = 0;
|
||||
//TimeId _preloadOffsetDate = TimeId(0); // #feed
|
||||
//MsgId _preloadOffsetId = MsgId(0);
|
||||
//PeerData *_preloadPeer = nullptr;
|
||||
bool _allLoaded = false;
|
||||
|
||||
};
|
||||
|
||||
class EditController
|
||||
: public PeerListController
|
||||
, private MTP::Sender {
|
||||
public:
|
||||
static void Start(
|
||||
not_null<Data::Feed*> feed,
|
||||
ChannelData *channel = nullptr);
|
||||
|
||||
EditController(
|
||||
not_null<Data::Feed*> feed,
|
||||
ChannelData *channel);
|
||||
|
||||
void prepare() override;
|
||||
void rowClicked(not_null<PeerListRow*> row) override;
|
||||
|
||||
void loadMoreRows() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<PeerListRow> createRow(not_null<ChannelData*> channel);
|
||||
// void applyFeedSources(const MTPchannels_FeedSources &result); // #feed
|
||||
|
||||
not_null<Data::Feed*> _feed;
|
||||
// ChannelData *_startWithChannel = nullptr; // #feed
|
||||
mtpRequestId _preloadRequestId = 0;
|
||||
bool _allLoaded = false;
|
||||
|
||||
};
|
||||
|
||||
} // namespace FeedProfile
|
||||
} // namespace Info
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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 "info/feed/info_feed_channels_widget.h"
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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 "info/feed/info_feed_cover.h"
|
||||
|
||||
#include "data/data_feed.h"
|
||||
#include "data/data_session.h"
|
||||
#include "info/info_controller.h"
|
||||
#include "info/info_memento.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "auth_session.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
namespace Info {
|
||||
namespace FeedProfile {
|
||||
|
||||
Cover::Cover(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller)
|
||||
: FixedHeightWidget(
|
||||
parent,
|
||||
st::infoProfilePhotoTop
|
||||
+ st::infoProfilePhoto.size.height()
|
||||
+ st::infoProfilePhotoBottom)
|
||||
, _controller(controller)
|
||||
, _feed(_controller->key().feed())
|
||||
, _userpic(
|
||||
this,
|
||||
controller->parentController(),
|
||||
_feed,
|
||||
st::infoFeedProfilePhoto)
|
||||
, _name(this, st::infoProfileNameLabel)
|
||||
, _status(
|
||||
this,
|
||||
st::infoProfileMegagroupStatusLabel) {
|
||||
_userpic->setPointerCursor(false);
|
||||
_name->setSelectable(true);
|
||||
_name->setContextCopyText(lang(lng_profile_copy_fullname));
|
||||
refreshNameText();
|
||||
refreshStatusText();
|
||||
|
||||
initViewers();
|
||||
setupChildGeometry();
|
||||
}
|
||||
|
||||
void Cover::setupChildGeometry() {
|
||||
widthValue(
|
||||
) | rpl::start_with_next([=](int newWidth) {
|
||||
_userpic->moveToLeft(
|
||||
st::infoProfilePhotoLeft,
|
||||
st::infoProfilePhotoTop,
|
||||
newWidth);
|
||||
refreshNameGeometry(newWidth);
|
||||
refreshStatusGeometry(newWidth);
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void Cover::initViewers() {
|
||||
Auth().data().feedUpdated(
|
||||
) | rpl::filter([](const Data::FeedUpdate &update) {
|
||||
return (update.flag == Data::FeedUpdateFlag::Channels);
|
||||
}) | rpl::start_with_next(
|
||||
[=] { refreshStatusText(); },
|
||||
lifetime());
|
||||
}
|
||||
|
||||
void Cover::refreshNameText() {
|
||||
_name->setText(_feed->chatListName());
|
||||
refreshNameGeometry(width());
|
||||
}
|
||||
|
||||
void Cover::refreshStatusText() {
|
||||
const auto statusText = [&] {
|
||||
if (!_feed->channelsLoaded() || _feed->channels().empty()) {
|
||||
return QString();
|
||||
}
|
||||
return lng_feed_channels(lt_count, _feed->channels().size());
|
||||
}();
|
||||
_status->setRichText(textcmdLink(1, statusText));
|
||||
_status->setLink(1, std::make_shared<LambdaClickHandler>([=] {
|
||||
_controller->showSection(std::make_unique<Info::Memento>(
|
||||
_feed,
|
||||
Section::Type::Channels));
|
||||
}));
|
||||
refreshStatusGeometry(width());
|
||||
}
|
||||
|
||||
void Cover::refreshNameGeometry(int newWidth) {
|
||||
auto nameLeft = st::infoProfileNameLeft;
|
||||
auto nameTop = st::infoProfileNameTop;
|
||||
auto nameWidth = newWidth
|
||||
- nameLeft
|
||||
- st::infoProfileNameRight;
|
||||
_name->resizeToNaturalWidth(nameWidth);
|
||||
_name->moveToLeft(nameLeft, nameTop, newWidth);
|
||||
}
|
||||
|
||||
void Cover::refreshStatusGeometry(int newWidth) {
|
||||
auto statusWidth = newWidth
|
||||
- st::infoProfileStatusLeft
|
||||
- st::infoProfileStatusRight;
|
||||
_status->resizeToWidth(statusWidth);
|
||||
_status->moveToLeft(
|
||||
st::infoProfileStatusLeft,
|
||||
st::infoProfileStatusTop,
|
||||
newWidth);
|
||||
}
|
||||
|
||||
Cover::~Cover() = default;
|
||||
|
||||
} // namespace FeedProfile
|
||||
} // namespace Info
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "base/timer.h"
|
||||
|
||||
namespace style {
|
||||
struct InfoToggle;
|
||||
} // namespace style
|
||||
|
||||
namespace Data {
|
||||
class Feed;
|
||||
} // namespace Data
|
||||
|
||||
namespace Ui {
|
||||
class FeedUserpicButton;
|
||||
class FlatLabel;
|
||||
template <typename Widget>
|
||||
class SlideWrap;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Info {
|
||||
class Controller;
|
||||
} // namespace Info
|
||||
|
||||
namespace Info {
|
||||
namespace FeedProfile {
|
||||
|
||||
class Cover : public Ui::FixedHeightWidget {
|
||||
public:
|
||||
Cover(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller);
|
||||
|
||||
~Cover();
|
||||
|
||||
private:
|
||||
void setupChildGeometry();
|
||||
void initViewers();
|
||||
void refreshNameText();
|
||||
void refreshStatusText();
|
||||
void refreshNameGeometry(int newWidth);
|
||||
void refreshStatusGeometry(int newWidth);
|
||||
|
||||
not_null<Controller*> _controller;
|
||||
not_null<Data::Feed*> _feed;
|
||||
|
||||
object_ptr<Ui::FeedUserpicButton> _userpic;
|
||||
object_ptr<Ui::FlatLabel> _name = { nullptr };
|
||||
object_ptr<Ui::FlatLabel> _status = { nullptr };
|
||||
//object_ptr<CoverDropArea> _dropArea = { nullptr };
|
||||
|
||||
};
|
||||
|
||||
} // namespace FeedProfile
|
||||
} // namespace Info
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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 "info/feed/info_feed_profile_inner_widget.h"
|
||||
|
||||
#include "info/info_controller.h"
|
||||
#include "info/feed/info_feed_profile_widget.h"
|
||||
#include "info/feed/info_feed_cover.h"
|
||||
#include "info/feed/info_feed_channels.h"
|
||||
#include "info/profile/info_profile_actions.h"
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
|
||||
namespace Info {
|
||||
namespace FeedProfile {
|
||||
|
||||
InnerWidget::InnerWidget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller)
|
||||
: RpWidget(parent)
|
||||
, _controller(controller)
|
||||
, _feed(_controller->key().feed())
|
||||
, _content(setupContent(this)) {
|
||||
_content->heightValue(
|
||||
) | rpl::start_with_next([this](int height) {
|
||||
if (!_inResize) {
|
||||
resizeToWidth(width());
|
||||
updateDesiredHeight();
|
||||
}
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
object_ptr<Ui::RpWidget> InnerWidget::setupContent(
|
||||
not_null<RpWidget*> parent) {
|
||||
auto result = object_ptr<Ui::VerticalLayout>(parent);
|
||||
_cover = result->add(object_ptr<Cover>(
|
||||
result,
|
||||
_controller));
|
||||
auto details = Profile::SetupFeedDetails(_controller, parent, _feed);
|
||||
result->add(std::move(details));
|
||||
result->add(object_ptr<BoxContentDivider>(result));
|
||||
|
||||
_channels = result->add(object_ptr<Channels>(
|
||||
result,
|
||||
_controller)
|
||||
);
|
||||
_channels->scrollToRequests(
|
||||
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
|
||||
auto min = (request.ymin < 0)
|
||||
? request.ymin
|
||||
: mapFromGlobal(_channels->mapToGlobal({ 0, request.ymin })).y();
|
||||
auto max = (request.ymin < 0)
|
||||
? mapFromGlobal(_channels->mapToGlobal({ 0, 0 })).y()
|
||||
: (request.ymax < 0)
|
||||
? request.ymax
|
||||
: mapFromGlobal(_channels->mapToGlobal({ 0, request.ymax })).y();
|
||||
_scrollToRequests.fire({ min, max });
|
||||
}, _channels->lifetime());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int InnerWidget::countDesiredHeight() const {
|
||||
return _content->height() + (_channels
|
||||
? (_channels->desiredHeight() - _channels->height())
|
||||
: 0);
|
||||
}
|
||||
|
||||
void InnerWidget::visibleTopBottomUpdated(
|
||||
int visibleTop,
|
||||
int visibleBottom) {
|
||||
setChildVisibleTopBottom(_content, visibleTop, visibleBottom);
|
||||
}
|
||||
|
||||
void InnerWidget::saveState(not_null<Memento*> memento) {
|
||||
if (_channels) {
|
||||
memento->setChannelsState(_channels->saveState());
|
||||
}
|
||||
}
|
||||
|
||||
void InnerWidget::restoreState(not_null<Memento*> memento) {
|
||||
if (_channels) {
|
||||
_channels->restoreState(memento->channelsState());
|
||||
}
|
||||
}
|
||||
|
||||
rpl::producer<Ui::ScrollToRequest> InnerWidget::scrollToRequests() const {
|
||||
return _scrollToRequests.events();
|
||||
}
|
||||
|
||||
rpl::producer<int> InnerWidget::desiredHeightValue() const {
|
||||
return _desiredHeight.events_starting_with(countDesiredHeight());
|
||||
}
|
||||
|
||||
int InnerWidget::resizeGetHeight(int newWidth) {
|
||||
_inResize = true;
|
||||
auto guard = gsl::finally([&] { _inResize = false; });
|
||||
|
||||
_content->resizeToWidth(newWidth);
|
||||
_content->moveToLeft(0, 0);
|
||||
updateDesiredHeight();
|
||||
return _content->heightNoMargins();
|
||||
}
|
||||
|
||||
} // namespace FeedProfile
|
||||
} // namespace Info
|
|
@ -1,81 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <rpl/variable.h>
|
||||
#include "ui/rp_widget.h"
|
||||
|
||||
namespace Window {
|
||||
class Controller;
|
||||
} // namespace Window
|
||||
|
||||
namespace Ui {
|
||||
class VerticalLayout;
|
||||
template <typename Widget>
|
||||
class SlideWrap;
|
||||
struct ScrollToRequest;
|
||||
class MultiSlideTracker;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Info {
|
||||
|
||||
enum class Wrap;
|
||||
class Controller;
|
||||
|
||||
namespace FeedProfile {
|
||||
|
||||
class Memento;
|
||||
class Channels;
|
||||
class Cover;
|
||||
|
||||
class InnerWidget final : public Ui::RpWidget {
|
||||
public:
|
||||
InnerWidget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller);
|
||||
|
||||
void saveState(not_null<Memento*> memento);
|
||||
void restoreState(not_null<Memento*> memento);
|
||||
|
||||
void setIsStackBottom(bool isStackBottom) {
|
||||
_isStackBottom = isStackBottom;
|
||||
}
|
||||
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
|
||||
rpl::producer<int> desiredHeightValue() const override;
|
||||
|
||||
protected:
|
||||
int resizeGetHeight(int newWidth) override;
|
||||
void visibleTopBottomUpdated(
|
||||
int visibleTop,
|
||||
int visibleBottom) override;
|
||||
|
||||
private:
|
||||
object_ptr<RpWidget> setupContent(not_null<RpWidget*> parent);
|
||||
|
||||
int countDesiredHeight() const;
|
||||
void updateDesiredHeight() {
|
||||
_desiredHeight.fire(countDesiredHeight());
|
||||
}
|
||||
|
||||
rpl::variable<bool> _isStackBottom = true;
|
||||
|
||||
const not_null<Controller*> _controller;
|
||||
const not_null<Data::Feed*> _feed;
|
||||
|
||||
Channels *_channels = nullptr;
|
||||
Cover *_cover = nullptr;
|
||||
object_ptr<RpWidget> _content;
|
||||
|
||||
bool _inResize = false;
|
||||
rpl::event_stream<Ui::ScrollToRequest> _scrollToRequests;
|
||||
rpl::event_stream<int> _desiredHeight;
|
||||
|
||||
};
|
||||
|
||||
} // namespace FeedProfile
|
||||
} // namespace Info
|
|
@ -1,116 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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 "info/feed/info_feed_profile_widget.h"
|
||||
|
||||
#include "info/feed/info_feed_profile_inner_widget.h"
|
||||
#include "info/feed/info_feed_channels.h"
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
#include "info/info_controller.h"
|
||||
|
||||
namespace Info {
|
||||
namespace FeedProfile {
|
||||
|
||||
Memento::Memento(not_null<Controller*> controller)
|
||||
: Memento(controller->feed()) {
|
||||
}
|
||||
|
||||
Memento::Memento(not_null<Data::Feed*> feed)
|
||||
: ContentMemento(feed) {
|
||||
}
|
||||
|
||||
Section Memento::section() const {
|
||||
return Section(Section::Type::Profile);
|
||||
}
|
||||
|
||||
object_ptr<ContentWidget> Memento::createWidget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller,
|
||||
const QRect &geometry) {
|
||||
auto result = object_ptr<Widget>(
|
||||
parent,
|
||||
controller);
|
||||
result->setInternalState(geometry, this);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Memento::setChannelsState(std::unique_ptr<ChannelsState> state) {
|
||||
_channelsState = std::move(state);
|
||||
}
|
||||
|
||||
std::unique_ptr<ChannelsState> Memento::channelsState() {
|
||||
return std::move(_channelsState);
|
||||
}
|
||||
|
||||
Memento::~Memento() = default;
|
||||
|
||||
Widget::Widget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller)
|
||||
: ContentWidget(parent, controller) {
|
||||
controller->setSearchEnabledByContent(false);
|
||||
|
||||
_inner = setInnerWidget(object_ptr<InnerWidget>(
|
||||
this,
|
||||
controller));
|
||||
_inner->move(0, 0);
|
||||
_inner->scrollToRequests(
|
||||
) | rpl::start_with_next([this](Ui::ScrollToRequest request) {
|
||||
if (request.ymin < 0) {
|
||||
scrollTopRestore(
|
||||
qMin(scrollTopSave(), request.ymax));
|
||||
} else {
|
||||
scrollTo(request);
|
||||
}
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
void Widget::setIsStackBottom(bool isStackBottom) {
|
||||
_inner->setIsStackBottom(isStackBottom);
|
||||
}
|
||||
|
||||
void Widget::setInnerFocus() {
|
||||
_inner->setFocus();
|
||||
}
|
||||
|
||||
bool Widget::showInternal(not_null<ContentMemento*> memento) {
|
||||
if (!controller()->validateMementoPeer(memento)) {
|
||||
return false;
|
||||
}
|
||||
if (auto profileMemento = dynamic_cast<Memento*>(memento.get())) {
|
||||
restoreState(profileMemento);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Widget::setInternalState(
|
||||
const QRect &geometry,
|
||||
not_null<Memento*> memento) {
|
||||
setGeometry(geometry);
|
||||
Ui::SendPendingMoveResizeEvents(this);
|
||||
restoreState(memento);
|
||||
}
|
||||
|
||||
std::unique_ptr<ContentMemento> Widget::doCreateMemento() {
|
||||
auto result = std::make_unique<Memento>(controller());
|
||||
saveState(result.get());
|
||||
return result;
|
||||
}
|
||||
|
||||
void Widget::saveState(not_null<Memento*> memento) {
|
||||
memento->setScrollTop(scrollTopSave());
|
||||
_inner->saveState(memento);
|
||||
}
|
||||
|
||||
void Widget::restoreState(not_null<Memento*> memento) {
|
||||
_inner->restoreState(memento);
|
||||
scrollTopRestore(memento->scrollTop());
|
||||
}
|
||||
|
||||
} // namespace FeedProfile
|
||||
} // namespace Info
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <rpl/producer.h>
|
||||
#include "info/info_content_widget.h"
|
||||
|
||||
namespace Info {
|
||||
namespace FeedProfile {
|
||||
|
||||
class InnerWidget;
|
||||
struct ChannelsState;
|
||||
|
||||
class Memento final : public ContentMemento {
|
||||
public:
|
||||
Memento(not_null<Controller*> controller);
|
||||
Memento(not_null<Data::Feed*> feed);
|
||||
|
||||
object_ptr<ContentWidget> createWidget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller,
|
||||
const QRect &geometry) override;
|
||||
|
||||
Section section() const override;
|
||||
|
||||
void setChannelsState(std::unique_ptr<ChannelsState> state);
|
||||
std::unique_ptr<ChannelsState> channelsState();
|
||||
|
||||
~Memento();
|
||||
|
||||
private:
|
||||
std::unique_ptr<ChannelsState> _channelsState;
|
||||
|
||||
};
|
||||
|
||||
class Widget final : public ContentWidget {
|
||||
public:
|
||||
Widget(
|
||||
QWidget *parent,
|
||||
not_null<Controller*> controller);
|
||||
|
||||
void setIsStackBottom(bool isStackBottom) override;
|
||||
|
||||
bool showInternal(
|
||||
not_null<ContentMemento*> memento) override;
|
||||
|
||||
void setInternalState(
|
||||
const QRect &geometry,
|
||||
not_null<Memento*> memento);
|
||||
|
||||
void setInnerFocus() override;
|
||||
|
||||
private:
|
||||
void saveState(not_null<Memento*> memento);
|
||||
void restoreState(not_null<Memento*> memento);
|
||||
|
||||
std::unique_ptr<ContentMemento> doCreateMemento() override;
|
||||
|
||||
InnerWidget *_inner = nullptr;
|
||||
|
||||
};
|
||||
|
||||
} // namespace FeedProfile
|
||||
} // namespace Info
|
|
@ -352,7 +352,6 @@ infoIconInformation: icon {{ "info_information", infoIconFg }};
|
|||
infoIconMembers: icon {{ "info/edit/group_manage_members", infoIconFg, point(-2px, 0px) }};
|
||||
infoIconNotifications: icon {{ "info_notifications", infoIconFg }};
|
||||
infoIconActions: icon {{ "info_actions", infoIconFg }};
|
||||
//infoIconFeed: icon {{ "info_feed", infoIconFg }};
|
||||
infoIconMediaPhoto: icon {{ "info_media_photo", infoIconFg }};
|
||||
infoIconMediaVideo: icon {{ "info_media_video", infoIconFg }};
|
||||
infoIconMediaFile: icon {{ "info_media_file", infoIconFg }};
|
||||
|
|
|
@ -264,8 +264,6 @@ void ContentWidget::refreshSearchField(bool shown) {
|
|||
Key ContentMemento::key() const {
|
||||
if (const auto peer = this->peer()) {
|
||||
return Key(peer);
|
||||
//} else if (const auto feed = this->feed()) { // #feed
|
||||
// return Key(feed);
|
||||
} else if (const auto poll = this->poll()) {
|
||||
return Key(poll, pollContextId());
|
||||
} else {
|
||||
|
|
|
@ -120,8 +120,6 @@ public:
|
|||
: _peer(peer)
|
||||
, _migratedPeerId(migratedPeerId) {
|
||||
}
|
||||
//explicit ContentMemento(not_null<Data::Feed*> feed) : _feed(feed) { // #feed
|
||||
//}
|
||||
explicit ContentMemento(Settings::Tag settings);
|
||||
ContentMemento(not_null<PollData*> poll, FullMsgId contextId)
|
||||
: _poll(poll)
|
||||
|
@ -139,9 +137,6 @@ public:
|
|||
PeerId migratedPeerId() const {
|
||||
return _migratedPeerId;
|
||||
}
|
||||
//Data::Feed *feed() const { // #feed
|
||||
// return _feed;
|
||||
//}
|
||||
UserData *settingsSelf() const {
|
||||
return _settingsSelf;
|
||||
}
|
||||
|
@ -185,7 +180,6 @@ public:
|
|||
private:
|
||||
PeerData * const _peer = nullptr;
|
||||
const PeerId _migratedPeerId = 0;
|
||||
//Data::Feed * const _feed = nullptr; // #feed
|
||||
UserData * const _settingsSelf = nullptr;
|
||||
PollData * const _poll = nullptr;
|
||||
const FullMsgId _pollContextId;
|
||||
|
|
|
@ -29,9 +29,6 @@ namespace Info {
|
|||
Key::Key(not_null<PeerData*> peer) : _value(peer) {
|
||||
}
|
||||
|
||||
//Key::Key(not_null<Data::Feed*> feed) : _value(feed) { // #feed
|
||||
//}
|
||||
|
||||
Key::Key(Settings::Tag settings) : _value(settings) {
|
||||
}
|
||||
|
||||
|
@ -46,13 +43,6 @@ PeerData *Key::peer() const {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
//Data::Feed *Key::feed() const { // #feed
|
||||
// if (const auto feed = std::get_if<not_null<Data::Feed*>>(&_value)) {
|
||||
// return *feed;
|
||||
// }
|
||||
// return nullptr;
|
||||
//}
|
||||
|
||||
UserData *Key::settingsSelf() const {
|
||||
if (const auto tag = std::get_if<Settings::Tag>(&_value)) {
|
||||
return tag->self;
|
||||
|
@ -191,7 +181,6 @@ bool Controller::validateMementoPeer(
|
|||
not_null<ContentMemento*> memento) const {
|
||||
return memento->peer() == peer()
|
||||
&& memento->migratedPeerId() == migratedPeerId()
|
||||
//&& memento->feed() == feed() // #feed
|
||||
&& memento->settingsSelf() == settingsSelf();
|
||||
}
|
||||
|
||||
|
@ -212,10 +201,7 @@ void Controller::updateSearchControllers(
|
|||
&& SharedMediaAllowSearch(mediaType);
|
||||
auto hasCommonGroupsSearch
|
||||
= (type == Type::CommonGroups);
|
||||
auto hasMembersSearch
|
||||
= (type == Type::Members
|
||||
|| type == Type::Profile/* // #feed
|
||||
|| type == Type::Channels*/);
|
||||
auto hasMembersSearch = (type == Type::Members || type == Type::Profile);
|
||||
auto searchQuery = memento->searchFieldQuery();
|
||||
if (isMedia) {
|
||||
_searchController
|
||||
|
|
|
@ -31,12 +31,10 @@ struct Tag {
|
|||
class Key {
|
||||
public:
|
||||
Key(not_null<PeerData*> peer);
|
||||
//Key(not_null<Data::Feed*> feed); // #feed
|
||||
Key(Settings::Tag settings);
|
||||
Key(not_null<PollData*> poll, FullMsgId contextId);
|
||||
|
||||
PeerData *peer() const;
|
||||
//Data::Feed *feed() const; // #feed
|
||||
UserData *settingsSelf() const;
|
||||
PollData *poll() const;
|
||||
FullMsgId pollContextId() const;
|
||||
|
@ -48,7 +46,6 @@ private:
|
|||
};
|
||||
std::variant<
|
||||
not_null<PeerData*>,
|
||||
//not_null<Data::Feed*>, // #feed
|
||||
Settings::Tag,
|
||||
PollKey> _value;
|
||||
|
||||
|
@ -66,7 +63,6 @@ public:
|
|||
Media,
|
||||
CommonGroups,
|
||||
Members,
|
||||
//Channels, // #feed
|
||||
Settings,
|
||||
PollResults,
|
||||
};
|
||||
|
@ -116,9 +112,6 @@ public:
|
|||
|
||||
PeerData *peer() const;
|
||||
PeerId migratedPeerId() const;
|
||||
//Data::Feed *feed() const { // #feed
|
||||
// return key().feed();
|
||||
//}
|
||||
UserData *settingsSelf() const {
|
||||
return key().settingsSelf();
|
||||
}
|
||||
|
|
|
@ -10,9 +10,7 @@ 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" // #feed
|
||||
#include "info/common_groups/info_common_groups_widget.h"
|
||||
//#include "info/feed/info_feed_profile_widget.h" // #feed
|
||||
#include "info/settings/info_settings_widget.h"
|
||||
#include "info/polls/info_polls_results_widget.h"
|
||||
#include "info/info_section_widget.h"
|
||||
|
@ -35,10 +33,6 @@ Memento::Memento(not_null<PeerData*> peer, Section section)
|
|||
: Memento(DefaultStack(peer, 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)) {
|
||||
}
|
||||
|
@ -59,14 +53,6 @@ std::vector<std::shared_ptr<ContentMemento>> Memento::DefaultStack(
|
|||
return result;
|
||||
}
|
||||
|
||||
//std::vector<std::shared_ptr<ContentMemento>> Memento::DefaultStack( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section) {
|
||||
// auto result = std::vector<std::shared_ptr<ContentMemento>>();
|
||||
// result.push_back(DefaultContent(feed, section));
|
||||
// return result;
|
||||
//}
|
||||
//
|
||||
std::vector<std::shared_ptr<ContentMemento>> Memento::DefaultStack(
|
||||
Settings::Tag settings,
|
||||
Section section) {
|
||||
|
@ -91,26 +77,10 @@ Section Memento::DefaultSection(not_null<PeerData*> peer) {
|
|||
}
|
||||
return Section(Section::Type::Profile);
|
||||
}
|
||||
// // #feed
|
||||
//Section Memento::DefaultSection(Dialogs::Key key) {
|
||||
// if (const auto peer = key.peer()) {
|
||||
// if (peer->sharedMediaInfo()) {
|
||||
// return Section(Section::MediaType::Photo);
|
||||
// }
|
||||
// }
|
||||
// return Section(Section::Type::Profile);
|
||||
//}
|
||||
|
||||
std::shared_ptr<Memento> Memento::Default(not_null<PeerData*> peer) {
|
||||
return std::make_shared<Memento>(peer, 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::shared_ptr<ContentMemento> Memento::DefaultContent(
|
||||
not_null<PeerData*> peer,
|
||||
|
@ -140,18 +110,6 @@ std::shared_ptr<ContentMemento> Memento::DefaultContent(
|
|||
}
|
||||
Unexpected("Wrong section type in Info::Memento::DefaultContent()");
|
||||
}
|
||||
//
|
||||
//std::shared_ptr<ContentMemento> Memento::DefaultContent( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section) {
|
||||
// switch (section.type()) {
|
||||
// case Section::Type::Profile:
|
||||
// return std::make_shared<FeedProfile::Memento>(feed);
|
||||
// case Section::Type::Channels:
|
||||
// return std::make_shared<Channels::Memento>(feed);
|
||||
// }
|
||||
// Unexpected("Wrong feed section in Info::Memento::DefaultContent()");
|
||||
//}
|
||||
|
||||
object_ptr<Window::SectionWidget> Memento::createWidget(
|
||||
QWidget *parent,
|
||||
|
|
|
@ -34,7 +34,6 @@ class Memento final : public Window::SectionMemento {
|
|||
public:
|
||||
explicit Memento(not_null<PeerData*> peer);
|
||||
Memento(not_null<PeerData*> peer, Section section);
|
||||
//Memento(not_null<Data::Feed*> feed, Section section); // #feed
|
||||
Memento(Settings::Tag settings, Section section);
|
||||
Memento(not_null<PollData*> poll, FullMsgId contextId);
|
||||
explicit Memento(std::vector<std::shared_ptr<ContentMemento>> stack);
|
||||
|
@ -61,9 +60,7 @@ public:
|
|||
}
|
||||
|
||||
static Section DefaultSection(not_null<PeerData*> peer);
|
||||
//static Section DefaultSection(Dialogs::Key key); // #feed
|
||||
static std::shared_ptr<Memento> Default(not_null<PeerData*> peer);
|
||||
//static Memento Default(Dialogs::Key key); // #feed
|
||||
|
||||
~Memento();
|
||||
|
||||
|
@ -71,9 +68,6 @@ private:
|
|||
static std::vector<std::shared_ptr<ContentMemento>> DefaultStack(
|
||||
not_null<PeerData*> peer,
|
||||
Section section);
|
||||
//static std::vector<std::shared_ptr<ContentMemento>> DefaultStack( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section);
|
||||
static std::vector<std::shared_ptr<ContentMemento>> DefaultStack(
|
||||
Settings::Tag settings,
|
||||
Section section);
|
||||
|
@ -81,9 +75,6 @@ private:
|
|||
not_null<PollData*> poll,
|
||||
FullMsgId contextId);
|
||||
|
||||
//static std::shared_ptr<ContentMemento> DefaultContent( // #feed
|
||||
// not_null<Data::Feed*> feed,
|
||||
// Section section);
|
||||
static std::shared_ptr<ContentMemento> DefaultContent(
|
||||
not_null<PeerData*> peer,
|
||||
Section section);
|
||||
|
|
|
@ -559,9 +559,7 @@ rpl::producer<QString> TitleValue(
|
|||
|
||||
switch (section.type()) {
|
||||
case Section::Type::Profile:
|
||||
/*if (const auto feed = key.feed()) {
|
||||
return tr::lng_info_feed_title();
|
||||
} else */if (const auto user = peer->asUser()) {
|
||||
if (const auto user = peer->asUser()) {
|
||||
return (user->isBot() && !user->isSupport())
|
||||
? tr::lng_info_bot_title()
|
||||
: tr::lng_info_user_title();
|
||||
|
@ -607,9 +605,6 @@ rpl::producer<QString> TitleValue(
|
|||
}
|
||||
return tr::lng_profile_participants_section();
|
||||
|
||||
//case Section::Type::Channels: // #feed
|
||||
// return tr::lng_info_feed_channels();
|
||||
|
||||
case Section::Type::Settings:
|
||||
switch (section.settingsType()) {
|
||||
case Section::SettingsType::Main:
|
||||
|
|
|
@ -134,8 +134,6 @@ void WrapWidget::startInjectingActivePeerProfiles() {
|
|||
void WrapWidget::injectActiveProfile(Dialogs::Key key) {
|
||||
if (const auto peer = key.peer()) {
|
||||
injectActivePeerProfile(peer);
|
||||
//} else if (const auto feed = key.feed()) { // #feed
|
||||
// injectActiveFeedProfile(feed);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,22 +168,6 @@ void WrapWidget::injectActivePeerProfile(not_null<PeerData*> peer) {
|
|||
Memento(peer, 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::shared_ptr<ContentMemento> memento) {
|
||||
|
@ -217,8 +199,6 @@ 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()) { // #feed
|
||||
// return Dialogs::RowDescriptor(feed, FullMsgId());
|
||||
} else if (key().settingsSelf() || key().poll()) {
|
||||
return Dialogs::RowDescriptor();
|
||||
}
|
||||
|
@ -582,12 +562,6 @@ void WrapWidget::showTopBarMenu() {
|
|||
.section = Dialogs::EntryState::Section::Profile,
|
||||
},
|
||||
addAction);
|
||||
//} 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();
|
||||
|
|
|
@ -144,7 +144,6 @@ private:
|
|||
void startInjectingActivePeerProfiles();
|
||||
void injectActiveProfile(Dialogs::Key key);
|
||||
void injectActivePeerProfile(not_null<PeerData*> peer);
|
||||
//void injectActiveFeedProfile(not_null<Data::Feed*> feed); // #feed
|
||||
void injectActiveProfileMemento(
|
||||
std::shared_ptr<ContentMemento> memento);
|
||||
void checkBeforeClose(Fn<void()> close);
|
||||
|
|
|
@ -177,37 +177,6 @@ private:
|
|||
object_ptr<Ui::VerticalLayout> _wrap = { nullptr };
|
||||
|
||||
};
|
||||
// // #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,
|
||||
|
@ -742,48 +711,6 @@ object_ptr<Ui::RpWidget> ActionsFiller::fill() {
|
|||
}
|
||||
return { nullptr };
|
||||
}
|
||||
// // #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<Ui::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 feed = _feed;
|
||||
// const auto feedId = feed->id();
|
||||
// auto result = object_ptr<Ui::SettingsButton>(
|
||||
// _wrap,
|
||||
// tr::lng_info_feed_is_default(),
|
||||
// st::infoNotificationsButton);
|
||||
// result->toggleOn(
|
||||
// feed->owner().defaultFeedIdValue(
|
||||
// ) | rpl::map(_1 == feedId)
|
||||
// )->addClickHandler([=] {
|
||||
// const auto makeDefault = (feed->owner().defaultFeedId() != feedId);
|
||||
// const auto defaultFeedId = makeDefault ? feedId : 0;
|
||||
// feed->owner().setDefaultFeedId(defaultFeedId);
|
||||
//// feed->session().api().saveDefaultFeedId(feedId, makeDefault); // #feed
|
||||
// });
|
||||
// object_ptr<FloatingIcon>(
|
||||
// result,
|
||||
// st::infoIconNotifications,
|
||||
// st::infoNotificationsIconPosition);
|
||||
// return result;
|
||||
//}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -879,14 +806,6 @@ object_ptr<Ui::RpWidget> SetupChannelMembers(
|
|||
|
||||
return result;
|
||||
}
|
||||
// // #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
|
||||
|
|
|
@ -33,11 +33,6 @@ object_ptr<Ui::RpWidget> SetupChannelMembers(
|
|||
not_null<Controller*> controller,
|
||||
not_null<Ui::RpWidget*> parent,
|
||||
not_null<PeerData*> peer);
|
||||
// // #feed
|
||||
//object_ptr<Ui::RpWidget> SetupFeedDetails(
|
||||
// not_null<Controller*> controller,
|
||||
// not_null<Ui::RpWidget*> parent,
|
||||
// not_null<Data::Feed*> feed);
|
||||
|
||||
} // namespace Profile
|
||||
} // namespace Info
|
||||
|
|
|
@ -401,21 +401,5 @@ rpl::producer<Badge> BadgeValue(not_null<PeerData*> peer) {
|
|||
return rpl::single(Badge::None);
|
||||
}
|
||||
|
||||
// // #feed
|
||||
//rpl::producer<int> FeedChannelsCountValue(not_null<Data::Feed*> feed) {
|
||||
// using Flag = Data::FeedUpdateFlag;
|
||||
// return rpl::single(
|
||||
// Data::FeedUpdate{ feed, Flag::Channels }
|
||||
// ) | rpl::then(
|
||||
// feed->owner().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
|
||||
|
|
|
@ -68,7 +68,5 @@ enum class Badge {
|
|||
};
|
||||
rpl::producer<Badge> BadgeValue(not_null<PeerData*> peer);
|
||||
|
||||
//rpl::producer<int> FeedChannelsCountValue(not_null<Data::Feed*> feed); // #feed
|
||||
|
||||
} // namespace Profile
|
||||
} // namespace Info
|
||||
|
|
|
@ -2483,10 +2483,6 @@ auto MainWidget::thirdSectionForCurrentMainSection(
|
|||
return std::make_shared<Info::Memento>(
|
||||
peer,
|
||||
Info::Memento::DefaultSection(peer));
|
||||
//} else if (const auto feed = key.feed()) { // #feed
|
||||
// return std::make_shared<Info::Memento>(
|
||||
// feed,
|
||||
// Info::Memento::DefaultSection(key));
|
||||
}
|
||||
Unexpected("Key in MainWidget::thirdSectionForCurrentMainSection().");
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ 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" // #feed
|
||||
|
||||
namespace Storage {
|
||||
|
||||
|
@ -36,24 +35,9 @@ public:
|
|||
rpl::producer<UserPhotosResult> query(UserPhotosQuery &&query) const;
|
||||
rpl::producer<UserPhotosSliceUpdate> userPhotosSliceUpdated() 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; // #feed
|
||||
|
||||
};
|
||||
|
||||
|
@ -132,55 +116,6 @@ rpl::producer<UserPhotosResult> Facade::Impl::query(UserPhotosQuery &&query) con
|
|||
rpl::producer<UserPhotosSliceUpdate> Facade::Impl::userPhotosSliceUpdated() const {
|
||||
return _userPhotos.sliceUpdated();
|
||||
}
|
||||
// // #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>()) {
|
||||
}
|
||||
|
@ -260,55 +195,6 @@ rpl::producer<UserPhotosResult> Facade::query(UserPhotosQuery &&query) const {
|
|||
rpl::producer<UserPhotosSliceUpdate> Facade::userPhotosSliceUpdated() const {
|
||||
return _impl->userPhotosSliceUpdated();
|
||||
}
|
||||
// // #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;
|
||||
|
||||
|
|
|
@ -37,16 +37,6 @@ struct UserPhotosQuery;
|
|||
struct UserPhotosResult;
|
||||
struct UserPhotosSliceUpdate;
|
||||
|
||||
//struct FeedMessagesAddNew; // #feed
|
||||
//struct FeedMessagesAddSlice;
|
||||
//struct FeedMessagesRemoveOne;
|
||||
//struct FeedMessagesRemoveAll;
|
||||
//struct FeedMessagesInvalidate;
|
||||
//struct FeedMessagesInvalidateBottom;
|
||||
//struct FeedMessagesQuery;
|
||||
//using FeedMessagesResult = Data::MessagesResult;
|
||||
//struct FeedMessagesSliceUpdate;
|
||||
|
||||
class Facade {
|
||||
public:
|
||||
Facade();
|
||||
|
@ -74,21 +64,6 @@ public:
|
|||
rpl::producer<UserPhotosResult> query(UserPhotosQuery &&query) const;
|
||||
rpl::producer<UserPhotosSliceUpdate> userPhotosSliceUpdated() 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;
|
||||
|
||||
~Facade();
|
||||
|
||||
private:
|
||||
|
|
|
@ -1,110 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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 "storage/storage_feed_messages.h"
|
||||
|
||||
namespace Storage {
|
||||
|
||||
auto FeedMessages::enforceLists(FeedId feedId)
|
||||
-> std::map<FeedId, List>::iterator {
|
||||
auto result = _lists.find(feedId);
|
||||
if (result != _lists.end()) {
|
||||
return result;
|
||||
}
|
||||
result = _lists.emplace(feedId, List {}).first;
|
||||
result->second.sliceUpdated(
|
||||
) | rpl::map([=](Data::MessagesSliceUpdate &&update) {
|
||||
return FeedMessagesSliceUpdate(
|
||||
feedId,
|
||||
std::move(update));
|
||||
}) | rpl::start_to_stream(_sliceUpdated, _lifetime);
|
||||
return result;
|
||||
}
|
||||
|
||||
void FeedMessages::add(FeedMessagesAddNew &&query) {
|
||||
auto feedId = query.feedId;
|
||||
auto feedIt = enforceLists(feedId);
|
||||
feedIt->second.addNew(query.messageId);
|
||||
}
|
||||
|
||||
void FeedMessages::add(FeedMessagesAddSlice &&query) {
|
||||
auto feedIt = enforceLists(query.feedId);
|
||||
feedIt->second.addSlice(
|
||||
std::move(query.messageIds),
|
||||
query.noSkipRange,
|
||||
std::nullopt);
|
||||
}
|
||||
|
||||
void FeedMessages::remove(FeedMessagesRemoveOne &&query) {
|
||||
auto feedIt = _lists.find(query.feedId);
|
||||
if (feedIt != _lists.end()) {
|
||||
feedIt->second.removeOne(query.messageId);
|
||||
_oneRemoved.fire(std::move(query));
|
||||
}
|
||||
}
|
||||
|
||||
void FeedMessages::remove(FeedMessagesRemoveAll &&query) {
|
||||
auto feedIt = _lists.find(query.feedId);
|
||||
if (feedIt != _lists.end()) {
|
||||
feedIt->second.removeAll(query.channelId);
|
||||
_allRemoved.fire(std::move(query));
|
||||
}
|
||||
}
|
||||
|
||||
void FeedMessages::invalidate(FeedMessagesInvalidate &&query) {
|
||||
auto feedIt = _lists.find(query.feedId);
|
||||
if (feedIt != _lists.end()) {
|
||||
feedIt->second.invalidateBottom();
|
||||
feedIt->second.invalidate();
|
||||
_invalidated.fire(std::move(query));
|
||||
}
|
||||
}
|
||||
|
||||
void FeedMessages::invalidate(FeedMessagesInvalidateBottom &&query) {
|
||||
auto feedIt = _lists.find(query.feedId);
|
||||
if (feedIt != _lists.end()) {
|
||||
feedIt->second.invalidateBottom();
|
||||
_bottomInvalidated.fire(std::move(query));
|
||||
}
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesResult> FeedMessages::query(
|
||||
FeedMessagesQuery &&query) const {
|
||||
auto feedIt = _lists.find(query.key.feedId);
|
||||
if (feedIt != _lists.end()) {
|
||||
return feedIt->second.query(Data::MessagesQuery(
|
||||
query.key.position,
|
||||
query.limitBefore,
|
||||
query.limitAfter));
|
||||
}
|
||||
return [](auto consumer) {
|
||||
consumer.put_done();
|
||||
return rpl::lifetime();
|
||||
};
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesSliceUpdate> FeedMessages::sliceUpdated() const {
|
||||
return _sliceUpdated.events();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesRemoveOne> FeedMessages::oneRemoved() const {
|
||||
return _oneRemoved.events();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesRemoveAll> FeedMessages::allRemoved() const {
|
||||
return _allRemoved.events();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesInvalidate> FeedMessages::invalidated() const {
|
||||
return _invalidated.events();
|
||||
}
|
||||
|
||||
rpl::producer<FeedMessagesInvalidateBottom> FeedMessages::bottomInvalidated() const {
|
||||
return _bottomInvalidated.events();
|
||||
}
|
||||
|
||||
} // namespace Storage
|
|
@ -1,172 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
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
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <rpl/event_stream.h>
|
||||
#include "storage/storage_facade.h"
|
||||
#include "data/data_feed_messages.h"
|
||||
|
||||
namespace Storage {
|
||||
|
||||
struct FeedMessagesAddNew {
|
||||
FeedMessagesAddNew(FeedId feedId, Data::MessagePosition messageId)
|
||||
: feedId(feedId)
|
||||
, messageId(messageId) {
|
||||
}
|
||||
|
||||
FeedId feedId = 0;
|
||||
Data::MessagePosition messageId;
|
||||
|
||||
};
|
||||
|
||||
struct FeedMessagesAddSlice {
|
||||
FeedMessagesAddSlice(
|
||||
FeedId feedId,
|
||||
std::vector<Data::MessagePosition> &&messageIds,
|
||||
Data::MessagesRange noSkipRange)
|
||||
: feedId(feedId)
|
||||
, messageIds(std::move(messageIds))
|
||||
, noSkipRange(noSkipRange) {
|
||||
}
|
||||
|
||||
FeedId feedId = 0;
|
||||
std::vector<Data::MessagePosition> messageIds;
|
||||
Data::MessagesRange noSkipRange;
|
||||
|
||||
};
|
||||
|
||||
struct FeedMessagesRemoveOne {
|
||||
FeedMessagesRemoveOne(
|
||||
FeedId feedId,
|
||||
Data::MessagePosition messageId)
|
||||
: feedId(feedId)
|
||||
, messageId(messageId) {
|
||||
}
|
||||
|
||||
FeedId feedId = 0;
|
||||
Data::MessagePosition messageId;
|
||||
|
||||
};
|
||||
|
||||
struct FeedMessagesRemoveAll {
|
||||
FeedMessagesRemoveAll(FeedId feedId, ChannelId channelId)
|
||||
: feedId(feedId)
|
||||
, channelId(channelId) {
|
||||
}
|
||||
|
||||
FeedId feedId = 0;
|
||||
ChannelId channelId = 0;
|
||||
|
||||
};
|
||||
|
||||
struct FeedMessagesInvalidate {
|
||||
explicit FeedMessagesInvalidate(FeedId feedId)
|
||||
: feedId(feedId) {
|
||||
}
|
||||
|
||||
FeedId feedId = 0;
|
||||
|
||||
};
|
||||
|
||||
struct FeedMessagesInvalidateBottom {
|
||||
explicit FeedMessagesInvalidateBottom(FeedId feedId)
|
||||
: feedId(feedId) {
|
||||
}
|
||||
|
||||
FeedId feedId = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
struct FeedMessagesKey {
|
||||
FeedMessagesKey(
|
||||
FeedId feedId,
|
||||
Data::MessagePosition position)
|
||||
: feedId(feedId)
|
||||
, position(position) {
|
||||
}
|
||||
|
||||
bool operator==(const FeedMessagesKey &other) const {
|
||||
return (feedId == other.feedId)
|
||||
&& (position == other.position);
|
||||
}
|
||||
bool operator!=(const FeedMessagesKey &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
FeedId feedId = 0;
|
||||
Data::MessagePosition position;
|
||||
|
||||
};
|
||||
|
||||
struct FeedMessagesQuery {
|
||||
FeedMessagesQuery(
|
||||
FeedMessagesKey key,
|
||||
int limitBefore,
|
||||
int limitAfter)
|
||||
: key(key)
|
||||
, limitBefore(limitBefore)
|
||||
, limitAfter(limitAfter) {
|
||||
}
|
||||
|
||||
FeedMessagesKey key;
|
||||
int limitBefore = 0;
|
||||
int limitAfter = 0;
|
||||
|
||||
};
|
||||
|
||||
using FeedMessagesResult = Data::MessagesResult;
|
||||
|
||||
struct FeedMessagesSliceUpdate {
|
||||
FeedMessagesSliceUpdate(
|
||||
FeedId feedId,
|
||||
Data::MessagesSliceUpdate &&data)
|
||||
: feedId(feedId)
|
||||
, data(std::move(data)) {
|
||||
}
|
||||
|
||||
FeedId feedId = 0;
|
||||
Data::MessagesSliceUpdate data;
|
||||
|
||||
};
|
||||
|
||||
class FeedMessages {
|
||||
public:
|
||||
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> sliceUpdated() const;
|
||||
rpl::producer<FeedMessagesRemoveOne> oneRemoved() const;
|
||||
rpl::producer<FeedMessagesRemoveAll> allRemoved() const;
|
||||
rpl::producer<FeedMessagesInvalidate> invalidated() const;
|
||||
rpl::producer<FeedMessagesInvalidateBottom> bottomInvalidated() const;
|
||||
|
||||
private:
|
||||
using List = Data::MessagesList;
|
||||
|
||||
std::map<FeedId, List>::iterator enforceLists(FeedId feedId);
|
||||
|
||||
std::map<FeedId, List> _lists;
|
||||
|
||||
rpl::event_stream<FeedMessagesSliceUpdate> _sliceUpdated;
|
||||
rpl::event_stream<FeedMessagesRemoveOne> _oneRemoved;
|
||||
rpl::event_stream<FeedMessagesRemoveAll> _allRemoved;
|
||||
rpl::event_stream<FeedMessagesInvalidate> _invalidated;
|
||||
rpl::event_stream<FeedMessagesInvalidateBottom> _bottomInvalidated;
|
||||
|
||||
rpl::lifetime _lifetime;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Storage
|
|
@ -769,95 +769,6 @@ void UserpicButton::prepareUserpicPixmap() {
|
|||
? _peer->userpicUniqueKey(_userpicView)
|
||||
: InMemoryKey();
|
||||
}
|
||||
// // #feed
|
||||
//FeedUserpicButton::FeedUserpicButton(
|
||||
// QWidget *parent,
|
||||
// not_null<Window::SessionController*> 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);
|
||||
//
|
||||
// _feed->owner().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)
|
||||
: RippleButton(parent, st::historySilentToggle.ripple)
|
||||
|
|
|
@ -155,33 +155,6 @@ private:
|
|||
Ui::Animations::Simple _changeOverlayShown;
|
||||
|
||||
};
|
||||
// // #feed
|
||||
//class FeedUserpicButton : public AbstractButton {
|
||||
//public:
|
||||
// FeedUserpicButton(
|
||||
// QWidget *parent,
|
||||
// not_null<Window::SessionController*> 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::SessionController*> _controller;
|
||||
// not_null<Data::Feed*> _feed;
|
||||
// std::vector<Part> _parts;
|
||||
//
|
||||
//};
|
||||
|
||||
class SilentToggle
|
||||
: public Ui::RippleButton
|
||||
|
|
|
@ -14,7 +14,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mtproto/mtproto_config.h"
|
||||
#include "history/history.h"
|
||||
#include "history/history_item_components.h"
|
||||
//#include "history/feed/history_feed_section.h" // #feed
|
||||
#include "lang/lang_keys.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_channel.h"
|
||||
|
@ -656,17 +655,8 @@ void Manager::openNotificationMessage(
|
|||
}
|
||||
return true;
|
||||
}();
|
||||
//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) { // #feed
|
||||
// App::wnd()->sessionController()->showSection(
|
||||
// std::make_shared<HistoryFeed::Memento>(messageFeed));
|
||||
} else {
|
||||
Ui::showPeerHistory(history, ShowAtUnreadMsgId);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ 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" // #feed
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "data/data_changes.h"
|
||||
#include "data/data_session.h"
|
||||
|
@ -539,15 +538,6 @@ void Filler::addChatActions(not_null<ChatData*> chat) {
|
|||
void Filler::addChannelActions(not_null<ChannelData*> channel) {
|
||||
const auto isGroup = channel->isMegagroup();
|
||||
const auto navigation = _controller;
|
||||
//if (!isGroup) { // #feed
|
||||
// const auto feed = channel->feed();
|
||||
// const auto grouped = (feed != nullptr);
|
||||
// if (!grouped || feed->channels().size() > 1) {
|
||||
// _addAction( // #feed
|
||||
// (grouped ? tr::lng_feed_ungroup(tr::now) : tr::lng_feed_group(tr::now)),
|
||||
// [=] { ToggleChannelGrouping(channel, !grouped); });
|
||||
// }
|
||||
//}
|
||||
if (_request.section != Section::ChatsList) {
|
||||
if (channel->isBroadcast()) {
|
||||
if (const auto chat = channel->linkedChat()) {
|
||||
|
@ -718,38 +708,6 @@ void Filler::addTogglesForArchive() {
|
|||
[folder = _folder] { return folder->chatsList(); },
|
||||
_addAction);
|
||||
}
|
||||
//
|
||||
//void FolderFiller::addInfo() {
|
||||
// const auto controller = _controller;
|
||||
// const auto feed = _feed;
|
||||
// _addAction(tr::lng_context_view_feed_info(tr::now), [=] {
|
||||
// controller->showSection(std::make_shared<Info::Memento>(
|
||||
// feed,
|
||||
// Info::Section(Info::Section::Type::Profile)));
|
||||
// });
|
||||
//}
|
||||
//
|
||||
//void FolderFiller::addNotifications() {
|
||||
// const auto feed = _feed;
|
||||
// _addAction(tr::lng_feed_notifications(tr::now), [=] {
|
||||
// Info::FeedProfile::NotificationsController::Start(feed);
|
||||
// });
|
||||
//}
|
||||
//
|
||||
//void FolderFiller::addSearch() {
|
||||
// const auto feed = _feed;
|
||||
// const auto controller = _controller;
|
||||
// _addAction(tr::lng_profile_search_messages(tr::now), [=] {
|
||||
// controller->content()->searchInChat(feed);
|
||||
// });
|
||||
//}
|
||||
//
|
||||
//void FolderFiller::addUngroup() {
|
||||
// const auto feed = _feed;
|
||||
// //_addAction(tr::lng_feed_ungroup_all(tr::now), [=] { // #feed
|
||||
// // PeerMenuUngroupFeed(feed);
|
||||
// //});
|
||||
//}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -1271,14 +1229,7 @@ void MenuAddMarkAsReadChatListAction(
|
|||
tr::lng_context_mark_read(tr::now),
|
||||
std::move(callback));
|
||||
}
|
||||
// #feed
|
||||
//void PeerMenuUngroupFeed(not_null<Data::Feed*> feed) {
|
||||
// Ui::show(Box<ConfirmBox>(
|
||||
// tr::lng_feed_sure_ungroup_all(tr::now),
|
||||
// tr::lng_feed_ungroup_sure(tr::now),
|
||||
// [=] { Ui::hideLayer(); feed->session().api().ungroupAllFromFeed(feed); }));
|
||||
//}
|
||||
//
|
||||
|
||||
void ToggleHistoryArchived(not_null<History*> history, bool archived) {
|
||||
const auto callback = [=] {
|
||||
Ui::Toast::Show(Ui::Toast::Config{
|
||||
|
|
|
@ -63,7 +63,6 @@ void PeerMenuShareContactBox(
|
|||
void PeerMenuAddChannelMembers(
|
||||
not_null<Window::SessionNavigation*> navigation,
|
||||
not_null<ChannelData*> channel);
|
||||
//void PeerMenuUngroupFeed(not_null<Data::Feed*> feed); // #feed
|
||||
void PeerMenuCreatePoll(
|
||||
not_null<Window::SessionController*> controller,
|
||||
not_null<PeerData*> peer,
|
||||
|
|
|
@ -19,7 +19,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "history/history_item.h"
|
||||
#include "history/view/history_view_element.h"
|
||||
#include "history/view/history_view_replies_section.h"
|
||||
//#include "history/feed/history_feed_section.h" // #feed
|
||||
#include "media/player/media_player_instance.h"
|
||||
#include "data/data_media_types.h"
|
||||
#include "data/data_session.h"
|
||||
|
@ -639,12 +638,6 @@ bool SessionController::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()) { // #feed
|
||||
// if (const auto item = session().data().message(row.fullId)) {
|
||||
// showSection(std::make_shared<HistoryFeed::Memento>(feed, item->position()));
|
||||
// } else {
|
||||
// showSection(std::make_shared<HistoryFeed::Memento>(feed));
|
||||
// }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -991,12 +984,6 @@ void SessionController::showJumpToDate(Dialogs::Key chat, QDate requestedDate) {
|
|||
} else if (history->chatListTimeId() != 0) {
|
||||
return base::unixtime::parse(history->chatListTimeId()).date();
|
||||
}
|
||||
//} else if (const auto feed = chat.feed()) { // #feed
|
||||
// if (chatScrollPosition(feed)) { // #TODO feeds save position
|
||||
|
||||
// } else if (feed->chatListTimeId() != 0) {
|
||||
// return base::unixtime::parse(feed->chatListTimeId()).date();
|
||||
// }
|
||||
}
|
||||
return QDate();
|
||||
}();
|
||||
|
@ -1008,10 +995,6 @@ void SessionController::showJumpToDate(Dialogs::Key chat, QDate requestedDate) {
|
|||
if (history && history->chatListTimeId() != 0) {
|
||||
return base::unixtime::parse(history->chatListTimeId()).date();
|
||||
}
|
||||
//} else if (const auto feed = chat.feed()) { // #feed
|
||||
// if (feed->chatListTimeId() != 0) {
|
||||
// return base::unixtime::parse(feed->chatListTimeId()).date();
|
||||
// }
|
||||
}
|
||||
return QDate::currentDate();
|
||||
};
|
||||
|
@ -1038,8 +1021,6 @@ void SessionController::showJumpToDate(Dialogs::Key chat, QDate requestedDate) {
|
|||
}
|
||||
return QDate::currentDate();
|
||||
}
|
||||
//} else if (const auto feed = chat.feed()) { // #feed
|
||||
// return startDate();
|
||||
}
|
||||
return startDate();
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue