diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index c5ba8fdfcc..e4df45f5d7 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -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 diff --git a/Telegram/Resources/icons/dialogs_feed.png b/Telegram/Resources/icons/dialogs_feed.png deleted file mode 100644 index 967e0edc9f..0000000000 Binary files a/Telegram/Resources/icons/dialogs_feed.png and /dev/null differ diff --git a/Telegram/Resources/icons/dialogs_feed@2x.png b/Telegram/Resources/icons/dialogs_feed@2x.png deleted file mode 100644 index c95642786e..0000000000 Binary files a/Telegram/Resources/icons/dialogs_feed@2x.png and /dev/null differ diff --git a/Telegram/Resources/icons/dialogs_feed@3x.png b/Telegram/Resources/icons/dialogs_feed@3x.png deleted file mode 100644 index 9b9bd9cc66..0000000000 Binary files a/Telegram/Resources/icons/dialogs_feed@3x.png and /dev/null differ diff --git a/Telegram/Resources/icons/info_feed.png b/Telegram/Resources/icons/info_feed.png deleted file mode 100644 index ffa8e853b3..0000000000 Binary files a/Telegram/Resources/icons/info_feed.png and /dev/null differ diff --git a/Telegram/Resources/icons/info_feed@2x.png b/Telegram/Resources/icons/info_feed@2x.png deleted file mode 100644 index 7750fd3a04..0000000000 Binary files a/Telegram/Resources/icons/info_feed@2x.png and /dev/null differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 4cdcaa5ad2..49c755a92d 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -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"; diff --git a/Telegram/SourceFiles/api/api_updates.cpp b/Telegram/SourceFiles/api/api_updates.cpp index 3fefdab206..f920794736 100644 --- a/Telegram/SourceFiles/api/api_updates.cpp +++ b/Telegram/SourceFiles/api/api_updates.cpp @@ -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); } diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index b5c9a7bc72..6ebd12c686 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -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 session) , _featuredSetsReadTimer([=] { readFeaturedSets(); }) , _dialogsLoadState(std::make_unique()) , _fileLoader(std::make_unique(kFileLoaderQueueStopTimeout)) -//, _feedReadTimer([=] { readFeeds(); }) // #feed , _topPromotionTimer([=] { refreshTopPromotion(); }) , _updateNotifySettingsTimer([=] { sendNotifySettingsUpdates(); }) , _authorizations(std::make_unique(this)) @@ -507,19 +502,6 @@ void ApiWrap::toggleHistoryArchived( }).send(); _historyArchivedRequests.emplace(history, requestId, callback); } -// #feed -//void ApiWrap::ungroupAllFromFeed(not_null 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(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 peer, const QDate &date) { jumpToDateInPeer(); } } -// // #feed -//template -//void ApiWrap::requestMessageAfterDate( -// not_null feed, -// const QDate &date, -// Callback &&callback) { -// const auto offsetId = 0; -// const auto offsetDate = static_cast(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) -// ](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 feed, const QDate &date) { -// requestMessageAfterDate(feed, date, [=](Data::MessagePosition result) { -// Ui::hideLayer(); -// App::wnd()->sessionController()->showSection( -// std::make_shared(feed, result)); -// }); -//} void ApiWrap::preloadEnoughUnreadMentions(not_null history) { auto fullCount = history->getUnreadMentionsCount(); @@ -3617,270 +3539,6 @@ void ApiWrap::userPhotosDone( fullCount )); } -// #feed -//void ApiWrap::requestFeedChannels(not_null 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>(); -// 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 feed, -// const std::vector> &channels) { -// if (const auto already = _feedChannelsSetRequests.take(feed)) { -// request(*already).cancel(); -// } -// auto inputs = QVector(); -// 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(inputs), -// MTPbool() -// )).done([=](const MTPUpdates &result) { -// applyUpdates(result); -// -// _feedChannelsSetRequests.remove(feed); -// }).fail([=](const RPCError &error) { -// _feedChannelsSetRequests.remove(feed); -// }).send(); -// -//} -// -//void ApiWrap::feedChannelsDone(not_null feed) { -// feed->setChannelsLoaded(true); -// for (const auto key : base::take(_feedMessagesRequestsPending)) { -// std::apply( -// [=](auto&&...args) { requestFeedMessages(args...); }, -// key); -// } -//} -// -//void ApiWrap::requestFeedMessages( -// not_null 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 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::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(); -// 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(), -// MTP_bool(isDefaultFeedId) -// )).send(); -//} void ApiWrap::sendAction(const SendAction &action) { if (!action.options.scheduled) { @@ -5373,57 +5031,3 @@ void ApiWrap::reloadPollResults(not_null item) { }).send(); _pollReloadRequestIds.emplace(itemId, requestId); } - -// // #feed -//void ApiWrap::readFeed( -// not_null 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); -// } -//} diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index 69ac68f7b4..b7c75744ab 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -171,7 +171,6 @@ public: not_null history, bool archived, Fn callback); - //void ungroupAllFromFeed(not_null feed); // #feed using RequestMessageDataCallback = Fn; void requestMessageData( @@ -190,11 +189,6 @@ public: rpl::producer dialogsLoadMayBlockByDate() const; rpl::producer dialogsLoadBlockedByDate() const; - //void applyFeedSources(const MTPDchannels_feedSources &data); // #feed - //void setFeedChannels( - // not_null feed, - // const std::vector> &channels); - void requestWallPaper( const QString &slug, Fn done, @@ -334,14 +328,6 @@ public: not_null user, PhotoId afterId); - //void requestFeedChannels( // #feed - // not_null feed); - //void requestFeedMessages( - // not_null 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 user, const SendAction &action); - //void readFeed( // #feed - // not_null feed, - // Data::MessagePosition position); void applyAffectedMessages( not_null peer, const MTPmessages_AffectedMessages &result); @@ -565,17 +548,11 @@ private: const QVector &participants); void jumpToHistoryDate(not_null peer, const QDate &date); - //void jumpToFeedDate(not_null feed, const QDate &date); // #feed template void requestMessageAfterDate( not_null peer, const QDate &date, Callback &&callback); - //template // #feed - //void requestMessageAfterDate( - // not_null feed, - // const QDate &date, - // Callback &&callback); void sharedMediaDone( not_null peer, @@ -589,13 +566,6 @@ private: PhotoId photoId, const MTPphotos_Photos &result); - //void feedChannelsDone(not_null feed); // #feed - //void feedMessagesDone( - // not_null 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, mtpRequestId> _userPhotosRequests; - //base::flat_set> _feedChannelsGetRequests; // #feed - //base::flat_map< - // not_null, - // mtpRequestId> _feedChannelsSetRequests; - //base::flat_set, - // Data::MessagePosition, - // SliceType>> _feedMessagesRequests; - //base::flat_set, - // Data::MessagePosition, - // SliceType>> _feedMessagesRequestsPending; - //mtpRequestId _saveDefaultFeedIdRequest = 0; - std::unique_ptr _dialogsLoadState; TimeId _dialogsLoadTill = 0; rpl::variable _dialogsLoadMayBlockByDate = false; @@ -769,11 +723,6 @@ private: rpl::event_stream _stickerSetInstalled; - // #feed - //base::flat_map, crl::time> _feedReadsDelayed; - //base::flat_map, mtpRequestId> _feedReadRequests; - //base::Timer _feedReadTimer; - mtpRequestId _topPromotionRequestId = 0; std::pair _topPromotionKey; TimeId _topPromotionNextRequestTime = TimeId(0); diff --git a/Telegram/SourceFiles/data/data_feed_messages.cpp b/Telegram/SourceFiles/data/data_feed_messages.cpp deleted file mode 100644 index 4f4d9da521..0000000000 --- a/Telegram/SourceFiles/data/data_feed_messages.cpp +++ /dev/null @@ -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 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( - 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 diff --git a/Telegram/SourceFiles/data/data_feed_messages.h b/Telegram/SourceFiles/data/data_feed_messages.h deleted file mode 100644 index fac2aa06fa..0000000000 --- a/Telegram/SourceFiles/data/data_feed_messages.h +++ /dev/null @@ -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 FeedMessagesViewer( - Storage::FeedMessagesKey key, - int limitBefore, - int limitAfter); - -} // namespace Data diff --git a/Telegram/SourceFiles/data/data_folder.cpp b/Telegram/SourceFiles/data/data_folder.cpp index a87eeea064..20792a6435 100644 --- a/Telegram/SourceFiles/data/data_folder.cpp +++ b/Telegram/SourceFiles/data/data_folder.cpp @@ -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 owner, FolderId id) : Entry(owner, Type::Folder) , _id(id) @@ -226,14 +215,6 @@ not_null 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> &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 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 { diff --git a/Telegram/SourceFiles/data/data_folder.h b/Telegram/SourceFiles/data/data_folder.h index ab0c59b955..d1d1019f16 100644 --- a/Telegram/SourceFiles/data/data_folder.h +++ b/Telegram/SourceFiles/data/data_folder.h @@ -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 unreadPositionChanges() const; // #feed - TimeId adjustedChatListTimeId() const override; int fixedOnTopIndex() const override; diff --git a/Telegram/SourceFiles/data/data_histories.h b/Telegram/SourceFiles/data/data_histories.h index 2d95143573..eca1c07e5d 100644 --- a/Telegram/SourceFiles/data/data_histories.h +++ b/Telegram/SourceFiles/data/data_histories.h @@ -57,7 +57,6 @@ public: Fn callback = nullptr); void dialogEntryApplied(not_null history); void changeDialogUnreadMark(not_null history, bool unread); - //void changeDialogUnreadMark(not_null feed, bool unread); // #feed void requestFakeChatListMessage(not_null history); void deleteMessages( diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp index 7b5aef4fea..6a7d33849b 100644 --- a/Telegram/SourceFiles/data/data_peer.cpp +++ b/Telegram/SourceFiles/data/data_peer.cpp @@ -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); - // } - //} } } diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 8d844e64e7..6f334d8156 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -703,11 +703,6 @@ not_null 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 Session::processFolder(const MTPFolder &data) { } not_null 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 Session::defaultFeedIdValue() const { -// return _defaultFeedId.value(); -//} not_null Session::chatsList(Data::Folder *folder) { return folder ? folder->chatsList().get() : &_chatsList; diff --git a/Telegram/SourceFiles/data/data_session.h b/Telegram/SourceFiles/data/data_session.h index 3e04180937..e7bfc1c869 100644 --- a/Telegram/SourceFiles/data/data_session.h +++ b/Telegram/SourceFiles/data/data_session.h @@ -609,9 +609,6 @@ public: [[nodiscard]] Folder *folderLoaded(FolderId id) const; not_null processFolder(const MTPFolder &data); not_null processFolder(const MTPDfolder &data); - //void setDefaultFeedId(FeedId id); // #feed - //FeedId defaultFeedId() const; - //rpl::producer defaultFeedIdValue() const; [[nodiscard]] not_null chatsList( Data::Folder *folder = nullptr); @@ -940,7 +937,6 @@ private: base::Timer _pollsClosingTimer; base::flat_map> _folders; - //rpl::variable _defaultFeedId = FeedId(); // #feed std::unordered_map< not_null, diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style index 63b08e1a6a..c12055e8d2 100644 --- a/Telegram/SourceFiles/dialogs/dialogs.style +++ b/Telegram/SourceFiles/dialogs/dialogs.style @@ -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 }}; diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 38c1daaa0f..fc7bcea8eb 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -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 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(); diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h index 254b622c1d..89f80010b3 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h @@ -297,11 +297,6 @@ private: Painter &p, int top, const Ui::Text::String &text) const; - //void paintSearchInFeed( // #feed - // Painter &p, - // not_null feed, - // int top, - // const Ui::Text::String &text) const; template void paintSearchInFilter( Painter &p, diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp index 7aee359225..f4d33aeb9a 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp @@ -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 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, diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.h b/Telegram/SourceFiles/dialogs/dialogs_layout.h index 6dcf5eec1d..4fb7027fec 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_layout.h +++ b/Telegram/SourceFiles/dialogs/dialogs_layout.h @@ -19,10 +19,6 @@ const style::icon *ChatTypeIcon( not_null peer, bool active, bool selected); -//const style::icon *FeedTypeIcon( // #feed -// not_null feed, -// bool active, -// bool selected); class RowPainter { public: diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index 379c5341fb..00ae09b999 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -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(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(feed)); } else { Unexpected("Empty key in onCancelSearchInPeer()."); } diff --git a/Telegram/SourceFiles/history/feed/history_feed_section.cpp b/Telegram/SourceFiles/history/feed/history_feed_section.cpp deleted file mode 100644 index 3ecf7ee0d0..0000000000 --- a/Telegram/SourceFiles/history/feed/history_feed_section.cpp +++ /dev/null @@ -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 feed, - Data::MessagePosition position) -: _feed(feed) -, _position(position) -, _list(std::make_unique(position)) { -} - -Memento::~Memento() = default; - -object_ptr Memento::createWidget( - QWidget *parent, - not_null controller, - Window::Column column, - const QRect &geometry) { - if (column == Window::Column::Third) { - return nullptr; - } - auto result = object_ptr(parent, controller, _feed); - result->setInternalState(geometry, this); - return result; -} - -Widget::Widget( - QWidget *parent, - not_null controller, - not_null 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(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 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 { - 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 memento, - const Window::SectionShow ¶ms) { - if (const auto feedMemento = dynamic_cast(memento.get())) { - if (feedMemento->feed() == _feed) { - restoreState(feedMemento); - return true; - } - } - return false; -} - -void Widget::setInternalState( - const QRect &geometry, - not_null 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 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 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 first, - not_null 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 Widget::listUnreadBarView( - const std::vector> &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 view) { - if (!_dateLink) { - _dateLink = std::make_shared(_feed, view->dateTime().date()); - } else { - _dateLink->setDate(view->dateTime().date()); - } - return _dateLink; -} - -std::unique_ptr Widget::createMemento() { - auto result = std::make_unique(_feed); - saveState(result.get()); - return result; -} - -void Widget::saveState(not_null memento) { - _inner->saveState(memento->list()); -} - -void Widget::restoreState(not_null 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(std::move(items))); - box->setDeleteConfirmedCallback([=] { - if (const auto strong = weak.data()) { - strong->clearSelected(); - } - }); -} - -void Widget::clearSelected() { - _inner->cancelSelection(); -} - -} // namespace HistoryFeed diff --git a/Telegram/SourceFiles/history/feed/history_feed_section.h b/Telegram/SourceFiles/history/feed/history_feed_section.h deleted file mode 100644 index 9a0de09d29..0000000000 --- a/Telegram/SourceFiles/history/feed/history_feed_section.h +++ /dev/null @@ -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 controller, - not_null feed); - - Dialogs::RowDescriptor activeChat() const override; - - bool hasTopBarShadow() const override { - return true; - } - - QPixmap grabForShowAnimation( - const Window::SectionSlideParams ¶ms) override; - - bool showInternal( - not_null memento, - const Window::SectionShow ¶ms) override; - std::unique_ptr createMemento() override; - - void setInternalState( - const QRect &geometry, - not_null 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 listSource( - Data::MessagePosition aroundId, - int limitBefore, - int limitAfter) override; - bool listAllowsMultiSelect() override; - bool listIsLessInOrder( - not_null first, - not_null second) override; - void listSelectionChanged( - HistoryView::SelectedItems &&items) override; - void listVisibleItemsChanged(HistoryItemsList &&items) override; - std::optional listUnreadBarView( - const std::vector> &elements) override; - void listContentRefreshed() override; - ClickHandlerPtr listDateLink(not_null 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); - void restoreState(not_null 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 _feed; - object_ptr _scroll; - QPointer _inner; - object_ptr _topBar; - object_ptr _topBarShadow; - object_ptr _showNext; - bool _skipScrollEvent = false; - bool _undefinedAroundPosition = false; - std::unique_ptr _emptyTextItem; - std::unique_ptr _emptyTextView; - - FullMsgId _currentMessageId; - FullMsgId _highlightMessageId; - std::optional _nextAnimatedScrollPosition; - int _nextAnimatedScrollDelta = 0; - - Ui::Animations::Simple _scrollDownShown; - bool _scrollDownIsShown = false; - object_ptr _scrollDown; - std::shared_ptr _dateLink; - -}; - -class Memento : public Window::SectionMemento { -public: - explicit Memento( - not_null feed, - Data::MessagePosition position = Data::UnreadMessagePosition); - ~Memento(); - - object_ptr createWidget( - QWidget *parent, - not_null controller, - Window::Column column, - const QRect &geometry) override; - - not_null feed() const { - return _feed; - } - Data::MessagePosition position() const { - return _position; - } - not_null list() const { - return _list.get(); - } - -private: - not_null _feed; - Data::MessagePosition _position; - std::unique_ptr _list; - -}; - -} // namespace HistoryFeed diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 64d10d8f48..f6195dd622 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -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 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 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()) { diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 7c35d37ef1..184618cf4b 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -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())); - // } - //} } } diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 87a68e4850..1e5c5e43d0 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -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" diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index 433d803ef9..2c2abf2a39 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -61,17 +61,6 @@ namespace { constexpr auto kExportLocalTimeout = crl::time(1000); constexpr auto kRescheduleLimit = 20; -//void AddToggleGroupingAction( // #feed -// not_null menu, -// not_null 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 item) { if (!item->isScheduled() || item->isSending() || item->hasFailed()) { return item->id; @@ -929,18 +918,6 @@ base::unique_qptr 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 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) { diff --git a/Telegram/SourceFiles/history/view/history_view_element.h b/Telegram/SourceFiles/history/view/history_view_element.h index a9b414875a..6da4dd7a3b 100644 --- a/Telegram/SourceFiles/history/view/history_view_element.h +++ b/Telegram/SourceFiles/history/view/history_view_element.h @@ -34,7 +34,6 @@ enum class Context : char { History, Replies, Pinned, - //Feed, // #feed AdminLog, ContactPreview }; diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 687deade6d..499ab27719 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -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: diff --git a/Telegram/SourceFiles/history/view/history_view_service_message.cpp b/Telegram/SourceFiles/history/view/history_view_service_message.cpp index 083b85ff46..b091c85730 100644 --- a/Telegram/SourceFiles/history/view/history_view_service_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_service_message.cpp @@ -384,9 +384,6 @@ QSize Service::performCountOptimalSize() { } bool Service::isHidden() const { - //if (context() == Context::Feed) { // #feed - // return true; - //} return Element::isHidden(); } diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 25f5b2c534..1a6b265dcb 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -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( - // feed, - // Info::Section(Info::Section::Type::Profile))); } else if (key.peer()->isSelf()) { _controller->showSection(std::make_shared( 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( - // this, - // _controller, - // feed, - // st::topBarFeedInfoButton); } if (_info) { _info->setAttribute(Qt::WA_TransparentForMouseEvents); diff --git a/Telegram/SourceFiles/info/feed/info_feed_channels.cpp b/Telegram/SourceFiles/info/feed/info_feed_channels.cpp deleted file mode 100644 index 0d636df826..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_channels.cpp +++ /dev/null @@ -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) -: RpWidget(parent) -, _controller(controller) -, _feed(_controller->key().feed()) -, _listController(std::make_unique(_controller)) { - setupHeader(); - setupList(); - setContent(_list.data()); - _listController->setDelegate(static_cast(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 Channels::scrollToRequests() const { - return _scrollToRequests.events(); -} - -std::unique_ptr Channels::saveState() { - auto result = std::make_unique(); - result->list = _listController->saveState(); - return result; -} - -void Channels::restoreState(std::unique_ptr state) { - if (!state) { - return; - } - _listController->restoreState(std::move(state->list)); -} - -void Channels::setupHeader() { - if (_controller->section().type() == Section::Type::Channels) { - return; - } - _header = object_ptr( - this, - st::infoMembersHeader); - auto parent = _header.data(); - - _openChannels = Ui::CreateChild( - parent, - rpl::single(QString())); - - // #feed - //object_ptr( - // parent, - // st::infoIconFeed, - // st::infoIconPosition); - - _titleWrap = Ui::CreateChild(parent); - _title = setupTitle(); - _addChannel = Ui::CreateChild( - _openChannels, - st::infoChannelsAddChannel); - _search = Ui::CreateChild( - _openChannels, - st::infoMembersSearch); - - setupButtons(); - - widthValue( - ) | rpl::start_with_next([this](int width) { - _header->resizeToWidth(width); - }, _header->lifetime()); -} - -object_ptr Channels::setupTitle() { - auto result = object_ptr( - _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( - 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( - _controller); - contentMemento->setState(saveState()); - contentMemento->setSearchStartsFocused(withSearch); - auto mementoStack = std::vector>(); - mementoStack.push_back(std::move(contentMemento)); - _controller->showSection( - std::make_unique(std::move(mementoStack))); -} - -void Channels::visibleTopBottomUpdated( - int visibleTop, - int visibleBottom) { - setChildVisibleTopBottom(_list, visibleTop, visibleBottom); -} - -void Channels::peerListSetTitle(Fn title) { -} - -void Channels::peerListSetAdditionalTitle( - Fn title) { -} - -bool Channels::peerListIsRowSelected(not_null peer) { - return false; -} - -int Channels::peerListSelectedRowsCount() { - return 0; -} - -std::vector> Channels::peerListCollectSelectedRows() { - return {}; -} - -void Channels::peerListScrollToTop() { - _scrollToRequests.fire({ -1, -1 }); -} - -void Channels::peerListAddSelectedRowInBunch(not_null peer) { - Unexpected("Item selection in Info::Profile::Members."); -} - -void Channels::peerListFinishSelectedRowsBunch() { -} - -void Channels::peerListSetDescription( - object_ptr description) { - description.destroy(); -} - -} // namespace FeedProfile -} // namespace Info - diff --git a/Telegram/SourceFiles/info/feed/info_feed_channels.h b/Telegram/SourceFiles/info/feed/info_feed_channels.h deleted file mode 100644 index 5852042379..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_channels.h +++ /dev/null @@ -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 list; - std::optional search; -}; - -class Channels - : public Ui::RpWidget - , private PeerListContentDelegate { -public: - Channels( - QWidget *parent, - not_null controller); - - rpl::producer scrollToRequests() const; - - std::unique_ptr saveState(); - void restoreState(std::unique_ptr 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 title) override; - void peerListSetAdditionalTitle( - Fn title) override; - bool peerListIsRowSelected(not_null peer) override; - int peerListSelectedRowsCount() override; - std::vector> peerListCollectSelectedRows() override; - void peerListScrollToTop() override; - void peerListAddSelectedRowInBunch( - not_null peer) override; - void peerListFinishSelectedRowsBunch() override; - void peerListSetDescription( - object_ptr description) override; - - void setupHeader(); - object_ptr setupTitle(); - void setupList(); - - void setupButtons(); - void addChannel(); - void showChannelsWithSearch(bool withSearch); - void updateHeaderControlsGeometry(int newWidth); - - not_null _controller; - not_null _feed; - std::unique_ptr _listController; - object_ptr _header = { nullptr }; - object_ptr _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 _scrollToRequests; - -}; - -} // namespace FeedProfile -} // namespace Info diff --git a/Telegram/SourceFiles/info/feed/info_feed_channels_controllers.cpp b/Telegram/SourceFiles/info/feed/info_feed_channels_controllers.cpp deleted file mode 100644 index f5f519a904..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_channels_controllers.cpp +++ /dev/null @@ -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); - - 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() const { - return _history; - } - -private: - not_null _history; - -}; - -ChannelsController::Row::Row(not_null 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) -: PeerListController() -, _controller(controller) -, _feed(_controller->key().feed()) { - if (!_feed->channelsLoaded()) { -// Auth().api().requestFeedChannels(_feed); // #feed - } - _controller->setSearchEnabledByContent(false); -} - -auto ChannelsController::createRow(not_null history) --> std::unique_ptr { - auto result = std::make_unique(history); - result->setCustomStatus(QString()); - return result; -} - -std::unique_ptr ChannelsController::createRestoredRow( - not_null 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) { - 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 ChannelsController::saveState() const { - auto result = PeerListController::saveState(); - auto my = std::make_unique(); - 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 state) { - PeerListController::restoreState(std::move(state)); -} - -void ChannelsController::rowClicked(not_null row) { - _controller->parentController()->showPeerHistory( - row->peer(), - Window::SectionShow::Way::Forward); -} - -void ChannelsController::rowActionClicked(not_null row) { - Window::DeleteAndLeaveHandler(row->peer())(); -} - -base::unique_qptr ChannelsController::rowContextMenu( - QWidget *parent, - not_null row) { - auto my = static_cast(row.get()); - auto channel = my->history()->peer->asChannel(); - - auto result = base::make_unique_q(parent); - Window::PeerMenuAddMuteAction(channel, [&]( - const QString &text, - Fn 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 feed) { - const auto initBox = [=](not_null 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( - std::make_unique(feed), - initBox)); -} - -NotificationsController::NotificationsController( - not_null 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>(); - 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 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 row) { - delegate()->peerListSetRowChecked(row, !row->checked()); -} - -std::unique_ptr NotificationsController::createRow( - not_null channel) { - return std::make_unique(channel); -} - -void EditController::Start( - not_null feed, - ChannelData *channel) { - const auto initBox = [=](not_null box) { - box->addButton(langFactory(lng_settings_save), [=] { - auto channels = std::vector>(); - 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( - std::make_unique(feed, channel), - initBox)); -} - -EditController::EditController( - not_null 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>(); -// -// 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 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 row) { - delegate()->peerListSetRowChecked(row, !row->checked()); -} - -std::unique_ptr EditController::createRow( - not_null channel) { - return std::make_unique(channel); -} - -} // namespace FeedProfile -} // namespace Info diff --git a/Telegram/SourceFiles/info/feed/info_feed_channels_controllers.h b/Telegram/SourceFiles/info/feed/info_feed_channels_controllers.h deleted file mode 100644 index 9051904091..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_channels_controllers.h +++ /dev/null @@ -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); - - void prepare() override; - void rowClicked(not_null row) override; - void rowActionClicked(not_null row) override; - - std::unique_ptr createRestoredRow( - not_null peer) override; - base::unique_qptr rowContextMenu( - QWidget *parent, - not_null row) override; - - std::unique_ptr saveState() const override; - void restoreState(std::unique_ptr state) override; - -private: - class Row; - struct SavedState : SavedStateBase { - rpl::lifetime lifetime; - }; - - void rebuildRows(); - std::unique_ptr createRow(not_null history); - - const not_null _controller; - not_null _feed; - -}; - -class NotificationsController - : public PeerListController - , private MTP::Sender { -public: - static void Start(not_null feed); - - NotificationsController(not_null feed); - - void prepare() override; - void rowClicked(not_null row) override; - - void loadMoreRows() override; - -private: - std::unique_ptr createRow(not_null channel); - void applyFeedDialogs(const MTPmessages_Dialogs &result); - - not_null _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 feed, - ChannelData *channel = nullptr); - - EditController( - not_null feed, - ChannelData *channel); - - void prepare() override; - void rowClicked(not_null row) override; - - void loadMoreRows() override; - -private: - std::unique_ptr createRow(not_null channel); -// void applyFeedSources(const MTPchannels_FeedSources &result); // #feed - - not_null _feed; -// ChannelData *_startWithChannel = nullptr; // #feed - mtpRequestId _preloadRequestId = 0; - bool _allLoaded = false; - -}; - -} // namespace FeedProfile -} // namespace Info diff --git a/Telegram/SourceFiles/info/feed/info_feed_channels_widget.cpp b/Telegram/SourceFiles/info/feed/info_feed_channels_widget.cpp deleted file mode 100644 index 436009363c..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_channels_widget.cpp +++ /dev/null @@ -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" - diff --git a/Telegram/SourceFiles/info/feed/info_feed_channels_widget.h b/Telegram/SourceFiles/info/feed/info_feed_channels_widget.h deleted file mode 100644 index 73e0063250..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_channels_widget.h +++ /dev/null @@ -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 - diff --git a/Telegram/SourceFiles/info/feed/info_feed_cover.cpp b/Telegram/SourceFiles/info/feed/info_feed_cover.cpp deleted file mode 100644 index 1ec2be9e8a..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_cover.cpp +++ /dev/null @@ -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) -: 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([=] { - _controller->showSection(std::make_unique( - _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 diff --git a/Telegram/SourceFiles/info/feed/info_feed_cover.h b/Telegram/SourceFiles/info/feed/info_feed_cover.h deleted file mode 100644 index 3c600f18b4..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_cover.h +++ /dev/null @@ -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 -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); - - ~Cover(); - -private: - void setupChildGeometry(); - void initViewers(); - void refreshNameText(); - void refreshStatusText(); - void refreshNameGeometry(int newWidth); - void refreshStatusGeometry(int newWidth); - - not_null _controller; - not_null _feed; - - object_ptr _userpic; - object_ptr _name = { nullptr }; - object_ptr _status = { nullptr }; - //object_ptr _dropArea = { nullptr }; - -}; - -} // namespace FeedProfile -} // namespace Info diff --git a/Telegram/SourceFiles/info/feed/info_feed_profile_inner_widget.cpp b/Telegram/SourceFiles/info/feed/info_feed_profile_inner_widget.cpp deleted file mode 100644 index b5f8d48c59..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_profile_inner_widget.cpp +++ /dev/null @@ -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) -: 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 InnerWidget::setupContent( - not_null parent) { - auto result = object_ptr(parent); - _cover = result->add(object_ptr( - result, - _controller)); - auto details = Profile::SetupFeedDetails(_controller, parent, _feed); - result->add(std::move(details)); - result->add(object_ptr(result)); - - _channels = result->add(object_ptr( - 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) { - if (_channels) { - memento->setChannelsState(_channels->saveState()); - } -} - -void InnerWidget::restoreState(not_null memento) { - if (_channels) { - _channels->restoreState(memento->channelsState()); - } -} - -rpl::producer InnerWidget::scrollToRequests() const { - return _scrollToRequests.events(); -} - -rpl::producer 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 diff --git a/Telegram/SourceFiles/info/feed/info_feed_profile_inner_widget.h b/Telegram/SourceFiles/info/feed/info_feed_profile_inner_widget.h deleted file mode 100644 index 105606477f..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_profile_inner_widget.h +++ /dev/null @@ -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 -#include "ui/rp_widget.h" - -namespace Window { -class Controller; -} // namespace Window - -namespace Ui { -class VerticalLayout; -template -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); - - void saveState(not_null memento); - void restoreState(not_null memento); - - void setIsStackBottom(bool isStackBottom) { - _isStackBottom = isStackBottom; - } - rpl::producer scrollToRequests() const; - rpl::producer desiredHeightValue() const override; - -protected: - int resizeGetHeight(int newWidth) override; - void visibleTopBottomUpdated( - int visibleTop, - int visibleBottom) override; - -private: - object_ptr setupContent(not_null parent); - - int countDesiredHeight() const; - void updateDesiredHeight() { - _desiredHeight.fire(countDesiredHeight()); - } - - rpl::variable _isStackBottom = true; - - const not_null _controller; - const not_null _feed; - - Channels *_channels = nullptr; - Cover *_cover = nullptr; - object_ptr _content; - - bool _inResize = false; - rpl::event_stream _scrollToRequests; - rpl::event_stream _desiredHeight; - -}; - -} // namespace FeedProfile -} // namespace Info diff --git a/Telegram/SourceFiles/info/feed/info_feed_profile_widget.cpp b/Telegram/SourceFiles/info/feed/info_feed_profile_widget.cpp deleted file mode 100644 index ec09c252cb..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_profile_widget.cpp +++ /dev/null @@ -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) -: Memento(controller->feed()) { -} - -Memento::Memento(not_null feed) -: ContentMemento(feed) { -} - -Section Memento::section() const { - return Section(Section::Type::Profile); -} - -object_ptr Memento::createWidget( - QWidget *parent, - not_null controller, - const QRect &geometry) { - auto result = object_ptr( - parent, - controller); - result->setInternalState(geometry, this); - return result; -} - -void Memento::setChannelsState(std::unique_ptr state) { - _channelsState = std::move(state); -} - -std::unique_ptr Memento::channelsState() { - return std::move(_channelsState); -} - -Memento::~Memento() = default; - -Widget::Widget( - QWidget *parent, - not_null controller) -: ContentWidget(parent, controller) { - controller->setSearchEnabledByContent(false); - - _inner = setInnerWidget(object_ptr( - 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 memento) { - if (!controller()->validateMementoPeer(memento)) { - return false; - } - if (auto profileMemento = dynamic_cast(memento.get())) { - restoreState(profileMemento); - return true; - } - return false; -} - -void Widget::setInternalState( - const QRect &geometry, - not_null memento) { - setGeometry(geometry); - Ui::SendPendingMoveResizeEvents(this); - restoreState(memento); -} - -std::unique_ptr Widget::doCreateMemento() { - auto result = std::make_unique(controller()); - saveState(result.get()); - return result; -} - -void Widget::saveState(not_null memento) { - memento->setScrollTop(scrollTopSave()); - _inner->saveState(memento); -} - -void Widget::restoreState(not_null memento) { - _inner->restoreState(memento); - scrollTopRestore(memento->scrollTop()); -} - -} // namespace FeedProfile -} // namespace Info diff --git a/Telegram/SourceFiles/info/feed/info_feed_profile_widget.h b/Telegram/SourceFiles/info/feed/info_feed_profile_widget.h deleted file mode 100644 index 0578f13fdc..0000000000 --- a/Telegram/SourceFiles/info/feed/info_feed_profile_widget.h +++ /dev/null @@ -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 -#include "info/info_content_widget.h" - -namespace Info { -namespace FeedProfile { - -class InnerWidget; -struct ChannelsState; - -class Memento final : public ContentMemento { -public: - Memento(not_null controller); - Memento(not_null feed); - - object_ptr createWidget( - QWidget *parent, - not_null controller, - const QRect &geometry) override; - - Section section() const override; - - void setChannelsState(std::unique_ptr state); - std::unique_ptr channelsState(); - - ~Memento(); - -private: - std::unique_ptr _channelsState; - -}; - -class Widget final : public ContentWidget { -public: - Widget( - QWidget *parent, - not_null controller); - - void setIsStackBottom(bool isStackBottom) override; - - bool showInternal( - not_null memento) override; - - void setInternalState( - const QRect &geometry, - not_null memento); - - void setInnerFocus() override; - -private: - void saveState(not_null memento); - void restoreState(not_null memento); - - std::unique_ptr doCreateMemento() override; - - InnerWidget *_inner = nullptr; - -}; - -} // namespace FeedProfile -} // namespace Info diff --git a/Telegram/SourceFiles/info/info.style b/Telegram/SourceFiles/info/info.style index f1076b875b..d6634d9b9f 100644 --- a/Telegram/SourceFiles/info/info.style +++ b/Telegram/SourceFiles/info/info.style @@ -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 }}; diff --git a/Telegram/SourceFiles/info/info_content_widget.cpp b/Telegram/SourceFiles/info/info_content_widget.cpp index b0e6f628f5..c52cb2fb83 100644 --- a/Telegram/SourceFiles/info/info_content_widget.cpp +++ b/Telegram/SourceFiles/info/info_content_widget.cpp @@ -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 { diff --git a/Telegram/SourceFiles/info/info_content_widget.h b/Telegram/SourceFiles/info/info_content_widget.h index 8eef9f81a9..f732b3ec16 100644 --- a/Telegram/SourceFiles/info/info_content_widget.h +++ b/Telegram/SourceFiles/info/info_content_widget.h @@ -120,8 +120,6 @@ public: : _peer(peer) , _migratedPeerId(migratedPeerId) { } - //explicit ContentMemento(not_null feed) : _feed(feed) { // #feed - //} explicit ContentMemento(Settings::Tag settings); ContentMemento(not_null 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; diff --git a/Telegram/SourceFiles/info/info_controller.cpp b/Telegram/SourceFiles/info/info_controller.cpp index 24f9e4f479..1ee91ed1aa 100644 --- a/Telegram/SourceFiles/info/info_controller.cpp +++ b/Telegram/SourceFiles/info/info_controller.cpp @@ -29,9 +29,6 @@ namespace Info { Key::Key(not_null peer) : _value(peer) { } -//Key::Key(not_null 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>(&_value)) { -// return *feed; -// } -// return nullptr; -//} - UserData *Key::settingsSelf() const { if (const auto tag = std::get_if(&_value)) { return tag->self; @@ -191,7 +181,6 @@ bool Controller::validateMementoPeer( not_null 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 diff --git a/Telegram/SourceFiles/info/info_controller.h b/Telegram/SourceFiles/info/info_controller.h index ff58f95e9c..efd25e5209 100644 --- a/Telegram/SourceFiles/info/info_controller.h +++ b/Telegram/SourceFiles/info/info_controller.h @@ -31,12 +31,10 @@ struct Tag { class Key { public: Key(not_null peer); - //Key(not_null feed); // #feed Key(Settings::Tag settings); Key(not_null 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, - //not_null, // #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(); } diff --git a/Telegram/SourceFiles/info/info_memento.cpp b/Telegram/SourceFiles/info/info_memento.cpp index 84d3aa26cb..ae5b488d1d 100644 --- a/Telegram/SourceFiles/info/info_memento.cpp +++ b/Telegram/SourceFiles/info/info_memento.cpp @@ -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 peer, Section section) : Memento(DefaultStack(peer, section)) { } -//Memento::Memento(not_null 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> Memento::DefaultStack( return result; } -//std::vector> Memento::DefaultStack( // #feed -// not_null feed, -// Section section) { -// auto result = std::vector>(); -// result.push_back(DefaultContent(feed, section)); -// return result; -//} -// std::vector> Memento::DefaultStack( Settings::Tag settings, Section section) { @@ -91,26 +77,10 @@ Section Memento::DefaultSection(not_null 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::Default(not_null peer) { return std::make_shared(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 Memento::DefaultContent( not_null peer, @@ -140,18 +110,6 @@ std::shared_ptr Memento::DefaultContent( } Unexpected("Wrong section type in Info::Memento::DefaultContent()"); } -// -//std::shared_ptr Memento::DefaultContent( // #feed -// not_null feed, -// Section section) { -// switch (section.type()) { -// case Section::Type::Profile: -// return std::make_shared(feed); -// case Section::Type::Channels: -// return std::make_shared(feed); -// } -// Unexpected("Wrong feed section in Info::Memento::DefaultContent()"); -//} object_ptr Memento::createWidget( QWidget *parent, diff --git a/Telegram/SourceFiles/info/info_memento.h b/Telegram/SourceFiles/info/info_memento.h index 2b58224dfa..af23e30c09 100644 --- a/Telegram/SourceFiles/info/info_memento.h +++ b/Telegram/SourceFiles/info/info_memento.h @@ -34,7 +34,6 @@ class Memento final : public Window::SectionMemento { public: explicit Memento(not_null peer); Memento(not_null peer, Section section); - //Memento(not_null feed, Section section); // #feed Memento(Settings::Tag settings, Section section); Memento(not_null poll, FullMsgId contextId); explicit Memento(std::vector> stack); @@ -61,9 +60,7 @@ public: } static Section DefaultSection(not_null peer); - //static Section DefaultSection(Dialogs::Key key); // #feed static std::shared_ptr Default(not_null peer); - //static Memento Default(Dialogs::Key key); // #feed ~Memento(); @@ -71,9 +68,6 @@ private: static std::vector> DefaultStack( not_null peer, Section section); - //static std::vector> DefaultStack( // #feed - // not_null feed, - // Section section); static std::vector> DefaultStack( Settings::Tag settings, Section section); @@ -81,9 +75,6 @@ private: not_null poll, FullMsgId contextId); - //static std::shared_ptr DefaultContent( // #feed - // not_null feed, - // Section section); static std::shared_ptr DefaultContent( not_null peer, Section section); diff --git a/Telegram/SourceFiles/info/info_top_bar.cpp b/Telegram/SourceFiles/info/info_top_bar.cpp index 23689f1b53..68cd535580 100644 --- a/Telegram/SourceFiles/info/info_top_bar.cpp +++ b/Telegram/SourceFiles/info/info_top_bar.cpp @@ -559,9 +559,7 @@ rpl::producer 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 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: diff --git a/Telegram/SourceFiles/info/info_wrap_widget.cpp b/Telegram/SourceFiles/info/info_wrap_widget.cpp index 9adf008f90..eeec3631d0 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.cpp +++ b/Telegram/SourceFiles/info/info_wrap_widget.cpp @@ -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 peer) { Memento(peer, section).takeStack().front())); } } -// // #feed -//void WrapWidget::injectActiveFeedProfile(not_null 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 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(); diff --git a/Telegram/SourceFiles/info/info_wrap_widget.h b/Telegram/SourceFiles/info/info_wrap_widget.h index 76afa06a4b..6e6c43c3d4 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.h +++ b/Telegram/SourceFiles/info/info_wrap_widget.h @@ -144,7 +144,6 @@ private: void startInjectingActivePeerProfiles(); void injectActiveProfile(Dialogs::Key key); void injectActivePeerProfile(not_null peer); - //void injectActiveFeedProfile(not_null feed); // #feed void injectActiveProfileMemento( std::shared_ptr memento); void checkBeforeClose(Fn close); diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index fc08c38a45..2235c41b51 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -177,37 +177,6 @@ private: object_ptr _wrap = { nullptr }; }; -// // #feed -//class FeedDetailsFiller { -//public: -// FeedDetailsFiller( -// not_null controller, -// not_null parent, -// not_null feed); -// -// object_ptr fill(); -// -//private: -// object_ptr setupDefaultToggle(); -// -// template < -// typename Widget, -// typename = std::enable_if_t< -// std::is_base_of_v>> -// Widget *add( -// object_ptr &&child, -// const style::margins &margin = style::margins()) { -// return _wrap->add( -// std::move(child), -// margin); -// } -// -// not_null _controller; -// not_null _parent; -// not_null _feed; -// object_ptr _wrap; -// -//}; DetailsFiller::DetailsFiller( not_null controller, @@ -742,48 +711,6 @@ object_ptr ActionsFiller::fill() { } return { nullptr }; } -// // #feed -//FeedDetailsFiller::FeedDetailsFiller( -// not_null controller, -// not_null parent, -// not_null feed) -//: _controller(controller) -//, _parent(parent) -//, _feed(feed) -//, _wrap(_parent) { -//} -// -//object_ptr FeedDetailsFiller::fill() { -// add(object_ptr(_wrap)); -// add(CreateSkipWidget(_wrap)); -// add(setupDefaultToggle()); -// add(CreateSkipWidget(_wrap)); -// return std::move(_wrap); -//} -// -//object_ptr FeedDetailsFiller::setupDefaultToggle() { -// using namespace rpl::mappers; -// const auto feed = _feed; -// const auto feedId = feed->id(); -// auto result = object_ptr( -// _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( -// result, -// st::infoIconNotifications, -// st::infoNotificationsIconPosition); -// return result; -//} } // namespace @@ -879,14 +806,6 @@ object_ptr SetupChannelMembers( return result; } -// // #feed -//object_ptr SetupFeedDetails( -// not_null controller, -// not_null parent, -// not_null feed) { -// FeedDetailsFiller filler(controller, parent, feed); -// return filler.fill(); -//} } // namespace Profile } // namespace Info diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.h b/Telegram/SourceFiles/info/profile/info_profile_actions.h index f36b8a9d1a..4302630951 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.h +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.h @@ -33,11 +33,6 @@ object_ptr SetupChannelMembers( not_null controller, not_null parent, not_null peer); -// // #feed -//object_ptr SetupFeedDetails( -// not_null controller, -// not_null parent, -// not_null feed); } // namespace Profile } // namespace Info diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.cpp b/Telegram/SourceFiles/info/profile/info_profile_values.cpp index cf3fb4b514..95869380ab 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_values.cpp @@ -401,21 +401,5 @@ rpl::producer BadgeValue(not_null peer) { return rpl::single(Badge::None); } -// // #feed -//rpl::producer FeedChannelsCountValue(not_null 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 diff --git a/Telegram/SourceFiles/info/profile/info_profile_values.h b/Telegram/SourceFiles/info/profile/info_profile_values.h index d60111088a..130c3c4748 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_values.h +++ b/Telegram/SourceFiles/info/profile/info_profile_values.h @@ -68,7 +68,5 @@ enum class Badge { }; rpl::producer BadgeValue(not_null peer); -//rpl::producer FeedChannelsCountValue(not_null feed); // #feed - } // namespace Profile } // namespace Info diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index d4dc84d4bf..06e1da7963 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2483,10 +2483,6 @@ auto MainWidget::thirdSectionForCurrentMainSection( return std::make_shared( peer, Info::Memento::DefaultSection(peer)); - //} else if (const auto feed = key.feed()) { // #feed - // return std::make_shared( - // feed, - // Info::Memento::DefaultSection(key)); } Unexpected("Key in MainWidget::thirdSectionForCurrentMainSection()."); } diff --git a/Telegram/SourceFiles/storage/storage_facade.cpp b/Telegram/SourceFiles/storage/storage_facade.cpp index 5f87aa46e9..3891139a49 100644 --- a/Telegram/SourceFiles/storage/storage_facade.cpp +++ b/Telegram/SourceFiles/storage/storage_facade.cpp @@ -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 query(UserPhotosQuery &&query) const; rpl::producer 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 query( - // FeedMessagesQuery &&query) const; - //rpl::producer feedMessagesSliceUpdated() const; - //rpl::producer feedMessagesOneRemoved() const; - //rpl::producer feedMessagesAllRemoved() const; - //rpl::producer feedMessagesInvalidated() const; - //rpl::producer feedMessagesBottomInvalidated() const; - private: SharedMedia _sharedMedia; UserPhotos _userPhotos; - //FeedMessages _feedMessages; // #feed }; @@ -132,55 +116,6 @@ rpl::producer Facade::Impl::query(UserPhotosQuery &&query) con rpl::producer 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 Facade::Impl::query( -// FeedMessagesQuery &&query) const { -// return _feedMessages.query(std::move(query)); -//} -// -//rpl::producer Facade::Impl::feedMessagesSliceUpdated() const { -// return _feedMessages.sliceUpdated(); -//} -// -//rpl::producer Facade::Impl::feedMessagesOneRemoved() const { -// return _feedMessages.oneRemoved(); -//} -// -//rpl::producer Facade::Impl::feedMessagesAllRemoved() const { -// return _feedMessages.allRemoved(); -//} -// -//rpl::producer Facade::Impl::feedMessagesInvalidated() const { -// return _feedMessages.invalidated(); -//} -// -//rpl::producer Facade::Impl::feedMessagesBottomInvalidated() const { -// return _feedMessages.bottomInvalidated(); -//} Facade::Facade() : _impl(std::make_unique()) { } @@ -260,55 +195,6 @@ rpl::producer Facade::query(UserPhotosQuery &&query) const { rpl::producer 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 Facade::query( -// FeedMessagesQuery &&query) const { -// return _impl->query(std::move(query)); -//} -// -//rpl::producer Facade::feedMessagesSliceUpdated() const { -// return _impl->feedMessagesSliceUpdated(); -//} -// -//rpl::producer Facade::feedMessagesOneRemoved() const { -// return _impl->feedMessagesOneRemoved(); -//} -// -//rpl::producer Facade::feedMessagesAllRemoved() const { -// return _impl->feedMessagesAllRemoved(); -//} -// -//rpl::producer Facade::feedMessagesInvalidated() const { -// return _impl->feedMessagesInvalidated(); -//} -// -//rpl::producer Facade::feedMessagesBottomInvalidated() const { -// return _impl->feedMessagesBottomInvalidated(); -//} Facade::~Facade() = default; diff --git a/Telegram/SourceFiles/storage/storage_facade.h b/Telegram/SourceFiles/storage/storage_facade.h index 6b176c7d81..56456373eb 100644 --- a/Telegram/SourceFiles/storage/storage_facade.h +++ b/Telegram/SourceFiles/storage/storage_facade.h @@ -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 query(UserPhotosQuery &&query) const; rpl::producer 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 query( - // FeedMessagesQuery &&query) const; - //rpl::producer feedMessagesSliceUpdated() const; - //rpl::producer feedMessagesOneRemoved() const; - //rpl::producer feedMessagesAllRemoved() const; - //rpl::producer feedMessagesInvalidated() const; - //rpl::producer feedMessagesBottomInvalidated() const; - ~Facade(); private: diff --git a/Telegram/SourceFiles/storage/storage_feed_messages.cpp b/Telegram/SourceFiles/storage/storage_feed_messages.cpp deleted file mode 100644 index 09350a62fb..0000000000 --- a/Telegram/SourceFiles/storage/storage_feed_messages.cpp +++ /dev/null @@ -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::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 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 FeedMessages::sliceUpdated() const { - return _sliceUpdated.events(); -} - -rpl::producer FeedMessages::oneRemoved() const { - return _oneRemoved.events(); -} - -rpl::producer FeedMessages::allRemoved() const { - return _allRemoved.events(); -} - -rpl::producer FeedMessages::invalidated() const { - return _invalidated.events(); -} - -rpl::producer FeedMessages::bottomInvalidated() const { - return _bottomInvalidated.events(); -} - -} // namespace Storage diff --git a/Telegram/SourceFiles/storage/storage_feed_messages.h b/Telegram/SourceFiles/storage/storage_feed_messages.h deleted file mode 100644 index 1f9768b4b7..0000000000 --- a/Telegram/SourceFiles/storage/storage_feed_messages.h +++ /dev/null @@ -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 -#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 &&messageIds, - Data::MessagesRange noSkipRange) - : feedId(feedId) - , messageIds(std::move(messageIds)) - , noSkipRange(noSkipRange) { - } - - FeedId feedId = 0; - std::vector 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 query( - FeedMessagesQuery &&query) const; - rpl::producer sliceUpdated() const; - rpl::producer oneRemoved() const; - rpl::producer allRemoved() const; - rpl::producer invalidated() const; - rpl::producer bottomInvalidated() const; - -private: - using List = Data::MessagesList; - - std::map::iterator enforceLists(FeedId feedId); - - std::map _lists; - - rpl::event_stream _sliceUpdated; - rpl::event_stream _oneRemoved; - rpl::event_stream _allRemoved; - rpl::event_stream _invalidated; - rpl::event_stream _bottomInvalidated; - - rpl::lifetime _lifetime; - -}; - -} // namespace Storage diff --git a/Telegram/SourceFiles/ui/special_buttons.cpp b/Telegram/SourceFiles/ui/special_buttons.cpp index a3bad8c0a9..6ea4b1a662 100644 --- a/Telegram/SourceFiles/ui/special_buttons.cpp +++ b/Telegram/SourceFiles/ui/special_buttons.cpp @@ -769,95 +769,6 @@ void UserpicButton::prepareUserpicPixmap() { ? _peer->userpicUniqueKey(_userpicView) : InMemoryKey(); } -// // #feed -//FeedUserpicButton::FeedUserpicButton( -// QWidget *parent, -// not_null controller, -// not_null 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 channel) { -// auto result = base::make_unique_q( -// 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 channel) : RippleButton(parent, st::historySilentToggle.ripple) diff --git a/Telegram/SourceFiles/ui/special_buttons.h b/Telegram/SourceFiles/ui/special_buttons.h index fa9f866862..a97220ace2 100644 --- a/Telegram/SourceFiles/ui/special_buttons.h +++ b/Telegram/SourceFiles/ui/special_buttons.h @@ -155,33 +155,6 @@ private: Ui::Animations::Simple _changeOverlayShown; }; -// // #feed -//class FeedUserpicButton : public AbstractButton { -//public: -// FeedUserpicButton( -// QWidget *parent, -// not_null controller, -// not_null feed, -// const style::FeedUserpicButton &st); -// -//private: -// struct Part { -// not_null channel; -// base::unique_qptr button; -// }; -// -// void prepare(); -// void checkParts(); -// bool partsAreValid() const; -// void refreshParts(); -// QPoint countInnerPosition() const; -// -// const style::FeedUserpicButton &_st; -// not_null _controller; -// not_null _feed; -// std::vector _parts; -// -//}; class SilentToggle : public Ui::RippleButton diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 55e8031e68..a11b7a5d6e 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -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(messageFeed)); } else { Ui::showPeerHistory(history, ShowAtUnreadMsgId); } diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 7382ae4348..3fc73504bd 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -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 chat) { void Filler::addChannelActions(not_null 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( -// 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 feed) { -// Ui::show(Box( -// 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, bool archived) { const auto callback = [=] { Ui::Toast::Show(Ui::Toast::Config{ diff --git a/Telegram/SourceFiles/window/window_peer_menu.h b/Telegram/SourceFiles/window/window_peer_menu.h index fbec5bd768..c513e5ed28 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.h +++ b/Telegram/SourceFiles/window/window_peer_menu.h @@ -63,7 +63,6 @@ void PeerMenuShareContactBox( void PeerMenuAddChannelMembers( not_null navigation, not_null channel); -//void PeerMenuUngroupFeed(not_null feed); // #feed void PeerMenuCreatePoll( not_null controller, not_null peer, diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index ae360797e6..19279e5fdd 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -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(feed, item->position())); - // } else { - // showSection(std::make_shared(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(); };