Display title and userpic of archived chats.
This commit is contained in:
		
							parent
							
								
									9bf8a8108d
								
							
						
					
					
						commit
						76c3e9a529
					
				
					 19 changed files with 418 additions and 324 deletions
				
			
		| 
						 | 
					@ -304,6 +304,7 @@ historyPeer8NameFgSelected: historyPeer8NameFg; // orange group member name in a
 | 
				
			||||||
historyPeer8UserpicBg: #faa774; // orange userpic background
 | 
					historyPeer8UserpicBg: #faa774; // orange userpic background
 | 
				
			||||||
historyPeerUserpicFg: windowFgActive; // default userpic initials
 | 
					historyPeerUserpicFg: windowFgActive; // default userpic initials
 | 
				
			||||||
historyPeerSavedMessagesBg: historyPeer4UserpicBg; // saved messages userpic background
 | 
					historyPeerSavedMessagesBg: historyPeer4UserpicBg; // saved messages userpic background
 | 
				
			||||||
 | 
					historyPeerArchiveUserpicBg: historyPeer2UserpicBg; // archive folder userpic background
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Some values are marked as (adjusted), it means they're adjusted by
 | 
					// Some values are marked as (adjusted), it means they're adjusted by
 | 
				
			||||||
// hue and saturation of the average background color if user chooses
 | 
					// hue and saturation of the average background color if user chooses
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								Telegram/Resources/icons/archive_userpic.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Telegram/Resources/icons/archive_userpic.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 449 B  | 
							
								
								
									
										
											BIN
										
									
								
								Telegram/Resources/icons/archive_userpic@2x.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Telegram/Resources/icons/archive_userpic@2x.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 814 B  | 
							
								
								
									
										
											BIN
										
									
								
								Telegram/Resources/icons/archive_userpic@3x.png
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								Telegram/Resources/icons/archive_userpic@3x.png
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 1.3 KiB  | 
| 
						 | 
					@ -1192,6 +1192,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 | 
				
			||||||
"lng_channel_mute" = "Mute";
 | 
					"lng_channel_mute" = "Mute";
 | 
				
			||||||
"lng_channel_unmute" = "Unmute";
 | 
					"lng_channel_unmute" = "Unmute";
 | 
				
			||||||
"lng_saved_messages" = "Saved Messages";
 | 
					"lng_saved_messages" = "Saved Messages";
 | 
				
			||||||
 | 
					"lng_archived_chats" = "Archived chats";
 | 
				
			||||||
"lng_saved_short" = "Save";
 | 
					"lng_saved_short" = "Save";
 | 
				
			||||||
"lng_saved_forward_here" = "Forward messages here for quick access";
 | 
					"lng_saved_forward_here" = "Forward messages here for quick access";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1267,7 +1268,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 | 
				
			||||||
"lng_context_view_profile" = "View profile";
 | 
					"lng_context_view_profile" = "View profile";
 | 
				
			||||||
"lng_context_view_group" = "View group info";
 | 
					"lng_context_view_group" = "View group info";
 | 
				
			||||||
"lng_context_view_channel" = "View channel info";
 | 
					"lng_context_view_channel" = "View channel info";
 | 
				
			||||||
"lng_context_view_feed_info" = "View feed info";
 | 
					//"lng_context_view_feed_info" = "View feed info";
 | 
				
			||||||
"lng_context_pin_to_top" = "Pin to top";
 | 
					"lng_context_pin_to_top" = "Pin to top";
 | 
				
			||||||
"lng_context_unpin_from_top" = "Unpin from top";
 | 
					"lng_context_unpin_from_top" = "Unpin from top";
 | 
				
			||||||
"lng_context_mark_unread" = "Mark as unread";
 | 
					"lng_context_mark_unread" = "Mark as unread";
 | 
				
			||||||
| 
						 | 
					@ -1686,32 +1687,33 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 | 
				
			||||||
"lng_admin_log_admin_pin_messages" = "Pin messages";
 | 
					"lng_admin_log_admin_pin_messages" = "Pin messages";
 | 
				
			||||||
"lng_admin_log_admin_add_admins" = "Add new admins";
 | 
					"lng_admin_log_admin_add_admins" = "Add new admins";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"lng_feed_name" = "Feed";
 | 
					// #feed
 | 
				
			||||||
"lng_feed_show_next" = "Show Next";
 | 
					//"lng_feed_name" = "Feed";
 | 
				
			||||||
 | 
					//"lng_feed_show_next" = "Show Next";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"lng_feed_group" = "Group in feed";
 | 
					//"lng_feed_group" = "Group in feed";
 | 
				
			||||||
"lng_feed_ungroup" = "Ungroup from feed";
 | 
					//"lng_feed_ungroup" = "Ungroup from feed";
 | 
				
			||||||
"lng_feed_channel_added" = "Channel added to your feed.";
 | 
					//"lng_feed_channel_added" = "Channel added to your feed.";
 | 
				
			||||||
"lng_feed_channel_removed" = "Channel removed from your feed.";
 | 
					//"lng_feed_channel_removed" = "Channel removed from your feed.";
 | 
				
			||||||
"lng_feed_no_messages" = "No messages in this feed yet";
 | 
					//"lng_feed_no_messages" = "No messages in this feed yet";
 | 
				
			||||||
"lng_feed_channels#one" = "{count} channel";
 | 
					//"lng_feed_channels#one" = "{count} channel";
 | 
				
			||||||
"lng_feed_channels#other" = "{count} channels";
 | 
					//"lng_feed_channels#other" = "{count} channels";
 | 
				
			||||||
"lng_feed_notifications" = "Feed notifications";
 | 
					//"lng_feed_notifications" = "Feed notifications";
 | 
				
			||||||
"lng_feed_ungroup_all" = "Ungroup all channels";
 | 
					//"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_sure_ungroup_all" = "Are you sure you want to ungroup all channels from this feed?";
 | 
				
			||||||
"lng_feed_ungroup_sure" = "Ungroup";
 | 
					//"lng_feed_ungroup_sure" = "Ungroup";
 | 
				
			||||||
"lng_feed_create_new" = "New feed";
 | 
					//"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#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_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#one" = "Select {count} channel or more.";
 | 
				
			||||||
"lng_feed_select_more_channels#other" = "Select {count} channels or more.";
 | 
					//"lng_feed_select_more_channels#other" = "Select {count} channels or more.";
 | 
				
			||||||
"lng_feed_create" = "Create";
 | 
					//"lng_feed_create" = "Create";
 | 
				
			||||||
"lng_feed_edit_title" = "Edit feed";
 | 
					//"lng_feed_edit_title" = "Edit feed";
 | 
				
			||||||
"lng_feed_channels_not_found" = "No channels found";
 | 
					//"lng_feed_channels_not_found" = "No channels found";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"lng_info_feed_title" = "Feed Info";
 | 
					//"lng_info_feed_title" = "Feed Info";
 | 
				
			||||||
"lng_info_feed_is_default" = "Group new channels";
 | 
					//"lng_info_feed_is_default" = "Group new channels";
 | 
				
			||||||
"lng_info_feed_channels" = "Channels";
 | 
					//"lng_info_feed_channels" = "Channels";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"lng_terms_signup" = "By signing up,\nyou agree to the {link}.";
 | 
					"lng_terms_signup" = "By signing up,\nyou agree to the {link}.";
 | 
				
			||||||
"lng_terms_signup_link" = "Terms of Service";
 | 
					"lng_terms_signup_link" = "Terms of Service";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -433,15 +433,16 @@ void ApiWrap::savePinnedOrder() {
 | 
				
			||||||
		MTP_vector(peers)
 | 
							MTP_vector(peers)
 | 
				
			||||||
	)).send();
 | 
						)).send();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// #feed
 | 
					
 | 
				
			||||||
//void ApiWrap::toggleChannelGrouping(
 | 
					void ApiWrap::toggleHistoryArchived(
 | 
				
			||||||
//		not_null<ChannelData*> channel,
 | 
							not_null<History*> history,
 | 
				
			||||||
//		bool group,
 | 
							bool archived,
 | 
				
			||||||
//		Fn<void()> callback) {
 | 
							Fn<void()> callback) {
 | 
				
			||||||
//	if (const auto already = _channelGroupingRequests.take(channel)) {
 | 
						if (const auto already = _historyArchivedRequests.take(history)) {
 | 
				
			||||||
//		request(already->first).cancel();
 | 
							request(already->first).cancel();
 | 
				
			||||||
//	}
 | 
						}
 | 
				
			||||||
//	const auto feedId = Data::Feed::kId;
 | 
						// #TODO archive
 | 
				
			||||||
 | 
						const auto folderId = Data::Folder::kId;
 | 
				
			||||||
	//const auto flags = group
 | 
						//const auto flags = group
 | 
				
			||||||
	//	? MTPchannels_ChangeFeedBroadcast::Flag::f_feed_id
 | 
						//	? MTPchannels_ChangeFeedBroadcast::Flag::f_feed_id
 | 
				
			||||||
	//	: MTPchannels_ChangeFeedBroadcast::Flag(0);
 | 
						//	: MTPchannels_ChangeFeedBroadcast::Flag(0);
 | 
				
			||||||
| 
						 | 
					@ -463,8 +464,8 @@ void ApiWrap::savePinnedOrder() {
 | 
				
			||||||
	//	_channelGroupingRequests.remove(channel);
 | 
						//	_channelGroupingRequests.remove(channel);
 | 
				
			||||||
	//}).send();
 | 
						//}).send();
 | 
				
			||||||
	//_channelGroupingRequests.emplace(channel, requestId, callback);
 | 
						//_channelGroupingRequests.emplace(channel, requestId, callback);
 | 
				
			||||||
//}
 | 
					}
 | 
				
			||||||
//
 | 
					// #feed
 | 
				
			||||||
//void ApiWrap::ungroupAllFromFeed(not_null<Data::Feed*> feed) {
 | 
					//void ApiWrap::ungroupAllFromFeed(not_null<Data::Feed*> feed) {
 | 
				
			||||||
//	const auto flags = MTPchannels_SetFeedBroadcasts::Flag::f_channels
 | 
					//	const auto flags = MTPchannels_SetFeedBroadcasts::Flag::f_channels
 | 
				
			||||||
//		| MTPchannels_SetFeedBroadcasts::Flag::f_also_newly_joined;
 | 
					//		| MTPchannels_SetFeedBroadcasts::Flag::f_also_newly_joined;
 | 
				
			||||||
| 
						 | 
					@ -3597,6 +3598,23 @@ void ApiWrap::applyUpdateNoPtsCheck(const MTPUpdate &update) {
 | 
				
			||||||
		Q_UNUSED(d); // Web page was updated anyway.
 | 
							Q_UNUSED(d); // Web page was updated anyway.
 | 
				
			||||||
	} break;
 | 
						} break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case mtpc_updateFolderPeers: {
 | 
				
			||||||
 | 
							const auto &data = update.c_updateFolderPeers();
 | 
				
			||||||
 | 
							auto &owner = _session->data();
 | 
				
			||||||
 | 
							for (const auto &peer : data.vfolder_peers.v) {
 | 
				
			||||||
 | 
								peer.match([&](const MTPDfolderPeer &data) {
 | 
				
			||||||
 | 
									const auto peerId = peerFromMTP(data.vpeer);
 | 
				
			||||||
 | 
									if (const auto history = owner.historyLoaded(peerId)) {
 | 
				
			||||||
 | 
										if (const auto folderId = data.vfolder_id.v) {
 | 
				
			||||||
 | 
											history->setFolder(owner.folder(folderId));
 | 
				
			||||||
 | 
										} else {
 | 
				
			||||||
 | 
											history->clearFolder();
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								});
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						} break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case mtpc_updateDeleteMessages: {
 | 
						case mtpc_updateDeleteMessages: {
 | 
				
			||||||
		auto &d = update.c_updateDeleteMessages();
 | 
							auto &d = update.c_updateDeleteMessages();
 | 
				
			||||||
		App::feedWereDeleted(NoChannel, d.vmessages.v);
 | 
							App::feedWereDeleted(NoChannel, d.vmessages.v);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,11 +65,11 @@ public:
 | 
				
			||||||
	void applyUpdates(const MTPUpdates &updates, uint64 sentMessageRandomId = 0);
 | 
						void applyUpdates(const MTPUpdates &updates, uint64 sentMessageRandomId = 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void savePinnedOrder();
 | 
						void savePinnedOrder();
 | 
				
			||||||
	//void toggleChannelGrouping( // #feed
 | 
						void toggleHistoryArchived(
 | 
				
			||||||
	//	not_null<ChannelData*> channel,
 | 
							not_null<History*> history,
 | 
				
			||||||
	//	bool group,
 | 
							bool archived,
 | 
				
			||||||
	//	Fn<void()> callback);
 | 
							Fn<void()> callback);
 | 
				
			||||||
	//void ungroupAllFromFeed(not_null<Data::Feed*> feed);
 | 
						//void ungroupAllFromFeed(not_null<Data::Feed*> feed); // #feed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	using RequestMessageDataCallback = Fn<void(ChannelData*, MsgId)>;
 | 
						using RequestMessageDataCallback = Fn<void(ChannelData*, MsgId)>;
 | 
				
			||||||
	void requestMessageData(
 | 
						void requestMessageData(
 | 
				
			||||||
| 
						 | 
					@ -651,8 +651,8 @@ private:
 | 
				
			||||||
	Fn<void(
 | 
						Fn<void(
 | 
				
			||||||
		const MTPchannels_ChannelParticipants&)> _channelMembersForAddCallback;
 | 
							const MTPchannels_ChannelParticipants&)> _channelMembersForAddCallback;
 | 
				
			||||||
	base::flat_map<
 | 
						base::flat_map<
 | 
				
			||||||
		not_null<ChannelData*>,
 | 
							not_null<History*>,
 | 
				
			||||||
		std::pair<mtpRequestId,Fn<void()>>> _channelGroupingRequests;
 | 
							std::pair<mtpRequestId,Fn<void()>>> _historyArchivedRequests;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	using KickRequest = std::pair<
 | 
						using KickRequest = std::pair<
 | 
				
			||||||
		not_null<ChannelData*>,
 | 
							not_null<ChannelData*>,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,6 +49,7 @@ addChildParentFlags('MTPDreplyKeyboardForceReply', 'MTPDreplyKeyboardMarkup');
 | 
				
			||||||
addChildParentFlags('MTPDinputPeerNotifySettings', 'MTPDpeerNotifySettings');
 | 
					addChildParentFlags('MTPDinputPeerNotifySettings', 'MTPDpeerNotifySettings');
 | 
				
			||||||
addChildParentFlags('MTPDpeerNotifySettings', 'MTPDinputPeerNotifySettings');
 | 
					addChildParentFlags('MTPDpeerNotifySettings', 'MTPDinputPeerNotifySettings');
 | 
				
			||||||
addChildParentFlags('MTPDchannelForbidden', 'MTPDchannel');
 | 
					addChildParentFlags('MTPDchannelForbidden', 'MTPDchannel');
 | 
				
			||||||
 | 
					addChildParentFlags('MTPDdialogFolder', 'MTPDdialog');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# this is a map (key flags -> map (flag name -> flag bit))
 | 
					# this is a map (key flags -> map (flag name -> flag bit))
 | 
				
			||||||
# each key flag of parentFlags should be a subset of the value flag here
 | 
					# each key flag of parentFlags should be a subset of the value flag here
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -306,27 +306,6 @@ void ChannelData::setAvailableMinId(MsgId availableMinId) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// #TODO archive
 | 
					 | 
				
			||||||
//void ChannelData::setFeed(not_null<Data::Feed*> feed) {
 | 
					 | 
				
			||||||
//	setFeedPointer(feed);
 | 
					 | 
				
			||||||
//}
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
//void ChannelData::clearFeed() {
 | 
					 | 
				
			||||||
//	setFeedPointer(nullptr);
 | 
					 | 
				
			||||||
//}
 | 
					 | 
				
			||||||
//
 | 
					 | 
				
			||||||
//void ChannelData::setFeedPointer(Data::Feed *feed) {
 | 
					 | 
				
			||||||
//	if (_feed != feed) {
 | 
					 | 
				
			||||||
//		const auto was = _feed;
 | 
					 | 
				
			||||||
//		_feed = feed;
 | 
					 | 
				
			||||||
//		if (was) {
 | 
					 | 
				
			||||||
//			was->unregisterOne(this);
 | 
					 | 
				
			||||||
//		}
 | 
					 | 
				
			||||||
//		if (_feed) {
 | 
					 | 
				
			||||||
//			_feed->registerOne(this);
 | 
					 | 
				
			||||||
//		}
 | 
					 | 
				
			||||||
//	}
 | 
					 | 
				
			||||||
//}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ChannelData::canBanMembers() const {
 | 
					bool ChannelData::canBanMembers() const {
 | 
				
			||||||
	return amCreator()
 | 
						return amCreator()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,6 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
 | 
				
			||||||
#include "auth_session.h"
 | 
					#include "auth_session.h"
 | 
				
			||||||
#include "apiwrap.h"
 | 
					#include "apiwrap.h"
 | 
				
			||||||
#include "mainwidget.h"
 | 
					#include "mainwidget.h"
 | 
				
			||||||
 | 
					#include "styles/style_dialogs.h" // st::dialogsArchiveUserpic
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Data {
 | 
					namespace Data {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,7 +36,7 @@ Folder::Folder(not_null<Data::Session*> owner, FolderId id)
 | 
				
			||||||
: Entry(this)
 | 
					: Entry(this)
 | 
				
			||||||
, _id(id)
 | 
					, _id(id)
 | 
				
			||||||
, _owner(owner)
 | 
					, _owner(owner)
 | 
				
			||||||
, _name(lang(lng_feed_name)) {
 | 
					, _name(lang(lng_archived_chats)) {
 | 
				
			||||||
	indexNameParts();
 | 
						indexNameParts();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -77,11 +78,12 @@ void Folder::indexNameParts() {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Folder::registerOne(not_null<PeerData*> peer) {
 | 
					void Folder::registerOne(not_null<History*> history) {
 | 
				
			||||||
	const auto history = owner().history(peer);
 | 
						if (base::contains(_histories, history)) {
 | 
				
			||||||
	if (!base::contains(_chats, history)) {
 | 
							return;
 | 
				
			||||||
		const auto invisible = empty(_chats);
 | 
						}
 | 
				
			||||||
		_chats.push_back(history);
 | 
						const auto invisible = empty(_histories);
 | 
				
			||||||
 | 
						_histories.push_back(history);
 | 
				
			||||||
	//session().storage().invalidate( // #feed
 | 
						//session().storage().invalidate( // #feed
 | 
				
			||||||
	//	Storage::FeedMessagesInvalidate(_id));
 | 
						//	Storage::FeedMessagesInvalidate(_id));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -103,13 +105,13 @@ void Folder::registerOne(not_null<PeerData*> peer) {
 | 
				
			||||||
			if (const auto count = history->unreadCount()) {
 | 
								if (const auto count = history->unreadCount()) {
 | 
				
			||||||
				unreadCountChanged(count, history->mute() ? count : 0);
 | 
									unreadCountChanged(count, history->mute() ? count : 0);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			} else if (!_settingChats) {
 | 
							} else if (!_settingHistories) {
 | 
				
			||||||
			session().api().requestDialogEntry(this);
 | 
								session().api().requestDialogEntry(this);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
		if (invisible && !empty(_chats)) {
 | 
						if (invisible && !empty(_histories)) {
 | 
				
			||||||
		updateChatListExistence();
 | 
							updateChatListExistence();
 | 
				
			||||||
			for (const auto history : _chats) {
 | 
							for (const auto history : _histories) {
 | 
				
			||||||
			history->updateChatListExistence();
 | 
								history->updateChatListExistence();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
| 
						 | 
					@ -117,14 +119,14 @@ void Folder::registerOne(not_null<PeerData*> peer) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_owner->notifyFolderUpdated(this, FolderUpdateFlag::List);
 | 
						_owner->notifyFolderUpdated(this, FolderUpdateFlag::List);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Folder::unregisterOne(not_null<PeerData*> peer) {
 | 
					void Folder::unregisterOne(not_null<History*> history) {
 | 
				
			||||||
	const auto history = owner().history(peer);
 | 
						const auto i = ranges::remove(_histories, history);
 | 
				
			||||||
	const auto i = ranges::remove(_chats, history);
 | 
						if (i == end(_histories)) {
 | 
				
			||||||
	if (i != end(_chats)) {
 | 
							return;
 | 
				
			||||||
		const auto visible = !empty(_chats);
 | 
						}
 | 
				
			||||||
		_chats.erase(i, end(_chats));
 | 
						const auto visible = !empty(_histories);
 | 
				
			||||||
 | 
						_histories.erase(i, end(_histories));
 | 
				
			||||||
	//session().storage().remove( // #feed
 | 
						//session().storage().remove( // #feed
 | 
				
			||||||
	//	Storage::FeedMessagesRemoveAll(_id, channel->bareId()));
 | 
						//	Storage::FeedMessagesRemoveAll(_id, channel->bareId()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -144,9 +146,9 @@ void Folder::unregisterOne(not_null<PeerData*> peer) {
 | 
				
			||||||
			session().api().requestDialogEntry(this);
 | 
								session().api().requestDialogEntry(this);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
		if (visible && empty(_chats)) {
 | 
						if (visible && empty(_histories)) {
 | 
				
			||||||
		updateChatListExistence();
 | 
							updateChatListExistence();
 | 
				
			||||||
			for (const auto history : _chats) {
 | 
							for (const auto history : _histories) {
 | 
				
			||||||
			history->updateChatListExistence();
 | 
								history->updateChatListExistence();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
| 
						 | 
					@ -154,7 +156,6 @@ void Folder::unregisterOne(not_null<PeerData*> peer) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_owner->notifyFolderUpdated(this, FolderUpdateFlag::List);
 | 
						_owner->notifyFolderUpdated(this, FolderUpdateFlag::List);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Folder::updateChatListMessage(not_null<HistoryItem*> item) {
 | 
					void Folder::updateChatListMessage(not_null<HistoryItem*> item) {
 | 
				
			||||||
	if (justUpdateChatListMessage(item)) {
 | 
						if (justUpdateChatListMessage(item)) {
 | 
				
			||||||
| 
						 | 
					@ -167,7 +168,7 @@ void Folder::updateChatListMessage(not_null<HistoryItem*> item) {
 | 
				
			||||||
void Folder::loadUserpic() {
 | 
					void Folder::loadUserpic() {
 | 
				
			||||||
	//constexpr auto kPaintUserpicsCount = 4; // #feed
 | 
						//constexpr auto kPaintUserpicsCount = 4; // #feed
 | 
				
			||||||
	//auto load = kPaintUserpicsCount;
 | 
						//auto load = kPaintUserpicsCount;
 | 
				
			||||||
	//for (const auto history : _chats) {
 | 
						//for (const auto history : _histories) {
 | 
				
			||||||
	//	history->peer->loadUserpic();
 | 
						//	history->peer->loadUserpic();
 | 
				
			||||||
	//	if (!--load) {
 | 
						//	if (!--load) {
 | 
				
			||||||
	//		break;
 | 
						//		break;
 | 
				
			||||||
| 
						 | 
					@ -180,10 +181,17 @@ void Folder::paintUserpic(
 | 
				
			||||||
		int x,
 | 
							int x,
 | 
				
			||||||
		int y,
 | 
							int y,
 | 
				
			||||||
		int size) const {
 | 
							int size) const {
 | 
				
			||||||
 | 
						p.setPen(Qt::NoPen);
 | 
				
			||||||
 | 
						p.setBrush(st::historyPeerArchiveUserpicBg);
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							PainterHighQualityEnabler hq(p);
 | 
				
			||||||
 | 
							p.drawRoundedRect(x, y, size, size, size / 3., size / 3.);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						st::dialogsArchiveUserpic.paintInCenter(p, { x, y, size, size });
 | 
				
			||||||
	//const auto small = (size - st::lineWidth) / 2; // #feed
 | 
						//const auto small = (size - st::lineWidth) / 2; // #feed
 | 
				
			||||||
	//const auto delta = size - small;
 | 
						//const auto delta = size - small;
 | 
				
			||||||
	//auto index = 0;
 | 
						//auto index = 0;
 | 
				
			||||||
	//for (const auto history : _chats) {
 | 
						//for (const auto history : _histories) {
 | 
				
			||||||
	//	history->peer->paintUserpic(p, x, y, small);
 | 
						//	history->peer->paintUserpic(p, x, y, small);
 | 
				
			||||||
	//	switch (++index) {
 | 
						//	switch (++index) {
 | 
				
			||||||
	//	case 1:
 | 
						//	case 1:
 | 
				
			||||||
| 
						 | 
					@ -194,76 +202,76 @@ void Folder::paintUserpic(
 | 
				
			||||||
	//}
 | 
						//}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const std::vector<not_null<History*>> &Folder::chats() const {
 | 
					const std::vector<not_null<History*>> &Folder::histories() const {
 | 
				
			||||||
	return _chats;
 | 
						return _histories;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int32 Folder::chatsHash() const {
 | 
					bool Folder::historiesLoaded() const {
 | 
				
			||||||
	const auto ordered = ranges::view::all(
 | 
						return _historiesLoaded;
 | 
				
			||||||
		_chats
 | 
					 | 
				
			||||||
	) | ranges::view::transform([](not_null<History*> history) {
 | 
					 | 
				
			||||||
		return history->peer->bareId();
 | 
					 | 
				
			||||||
	}) | ranges::to_vector | ranges::action::sort;
 | 
					 | 
				
			||||||
	return Api::CountHash(ordered);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Folder::chatsLoaded() const {
 | 
					void Folder::setHistoriesLoaded(bool loaded) {
 | 
				
			||||||
	return _chatsLoaded;
 | 
						if (_historiesLoaded != loaded) {
 | 
				
			||||||
}
 | 
							_historiesLoaded = loaded;
 | 
				
			||||||
 | 
					 | 
				
			||||||
void Folder::setChatsLoaded(bool loaded) {
 | 
					 | 
				
			||||||
	if (_chatsLoaded != loaded) {
 | 
					 | 
				
			||||||
		_chatsLoaded = loaded;
 | 
					 | 
				
			||||||
		_owner->notifyFolderUpdated(this, FolderUpdateFlag::List);
 | 
							_owner->notifyFolderUpdated(this, FolderUpdateFlag::List);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					// // #feed
 | 
				
			||||||
void Folder::setChats(std::vector<not_null<PeerData*>> chats) {
 | 
					//int32 Folder::chatsHash() const {
 | 
				
			||||||
	const auto remove = ranges::view::all(
 | 
					//	const auto ordered = ranges::view::all(
 | 
				
			||||||
		_chats
 | 
					//		_histories
 | 
				
			||||||
	) | ranges::view::transform([](not_null<History*> history) {
 | 
					//	) | ranges::view::transform([](not_null<History*> history) {
 | 
				
			||||||
		return history->peer;
 | 
					//		return history->peer->bareId();
 | 
				
			||||||
	}) | ranges::view::filter([&](not_null<PeerData*> peer) {
 | 
					//	}) | ranges::to_vector | ranges::action::sort;
 | 
				
			||||||
		return !base::contains(chats, peer);
 | 
					//	return Api::CountHash(ordered);
 | 
				
			||||||
	}) | ranges::to_vector;
 | 
					//}
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
	const auto add = ranges::view::all(
 | 
					//void Folder::setChats(std::vector<not_null<PeerData*>> chats) {
 | 
				
			||||||
		chats
 | 
					//	const auto remove = ranges::view::all(
 | 
				
			||||||
	) | ranges::view::filter([&](not_null<PeerData*> peer) {
 | 
					//		_histories
 | 
				
			||||||
		return ranges::find(
 | 
					//	) | ranges::view::transform([](not_null<History*> history) {
 | 
				
			||||||
			_chats,
 | 
					//		return history->peer;
 | 
				
			||||||
			peer,
 | 
					//	}) | ranges::view::filter([&](not_null<PeerData*> peer) {
 | 
				
			||||||
			[](auto history) { return history->peer; }
 | 
					//		return !base::contains(chats, peer);
 | 
				
			||||||
		) == end(_chats);
 | 
					//	}) | ranges::to_vector;
 | 
				
			||||||
	}) | ranges::view::transform([](PeerData *peer) {
 | 
					//
 | 
				
			||||||
		return not_null<PeerData*>(peer);
 | 
					//	const auto add = ranges::view::all(
 | 
				
			||||||
	}) | ranges::to_vector;
 | 
					//		chats
 | 
				
			||||||
 | 
					//	) | ranges::view::filter([&](not_null<PeerData*> peer) {
 | 
				
			||||||
	changeChatsList(add, remove);
 | 
					//		return ranges::find(
 | 
				
			||||||
 | 
					//			_histories,
 | 
				
			||||||
	setChatsLoaded(true);
 | 
					//			peer,
 | 
				
			||||||
}
 | 
					//			[](auto history) { return history->peer; }
 | 
				
			||||||
 | 
					//		) == end(_histories);
 | 
				
			||||||
void Folder::changeChatsList(
 | 
					//	}) | ranges::view::transform([](PeerData *peer) {
 | 
				
			||||||
		const std::vector<not_null<PeerData*>> &add,
 | 
					//		return not_null<PeerData*>(peer);
 | 
				
			||||||
		const std::vector<not_null<PeerData*>> &remove) {
 | 
					//	}) | ranges::to_vector;
 | 
				
			||||||
	_settingChats = true;
 | 
					//
 | 
				
			||||||
	const auto restore = gsl::finally([&] { _settingChats = false; });
 | 
					//	changeChatsList(add, remove);
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
	//for (const auto channel : remove) { // #TODO archive
 | 
					//	setChatsLoaded(true);
 | 
				
			||||||
 | 
					//}
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//void Folder::changeChatsList(
 | 
				
			||||||
 | 
					//		const std::vector<not_null<PeerData*>> &add,
 | 
				
			||||||
 | 
					//		const std::vector<not_null<PeerData*>> &remove) {
 | 
				
			||||||
 | 
					//	_settingChats = true;
 | 
				
			||||||
 | 
					//	const auto restore = gsl::finally([&] { _settingChats = false; });
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//	for (const auto channel : remove) {
 | 
				
			||||||
//		channel->clearFeed();
 | 
					//		channel->clearFeed();
 | 
				
			||||||
//	}
 | 
					//	}
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
	//// We assume the last message was correct before requesting the list.
 | 
					//	//// We assume the last message was correct before requesting the list.
 | 
				
			||||||
	//// So we save it and don't allow channels from the list to change it.
 | 
					//	//// So we save it and don't allow channels from the list to change it.
 | 
				
			||||||
	//// After that we restore it.
 | 
					//	//// After that we restore it.
 | 
				
			||||||
	const auto oldChatListMessage = base::take(_chatListMessage);
 | 
					//	const auto oldChatListMessage = base::take(_chatListMessage);
 | 
				
			||||||
//	for (const auto channel : add) {
 | 
					//	for (const auto channel : add) {
 | 
				
			||||||
//		_chatListMessage = std::nullopt;
 | 
					//		_chatListMessage = std::nullopt;
 | 
				
			||||||
//		channel->setFeed(this);
 | 
					//		channel->setFeed(this);
 | 
				
			||||||
//	}
 | 
					//	}
 | 
				
			||||||
	_chatListMessage = oldChatListMessage;
 | 
					//	_chatListMessage = oldChatListMessage;
 | 
				
			||||||
}
 | 
					//}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Folder::justUpdateChatListMessage(not_null<HistoryItem*> item) {
 | 
					bool Folder::justUpdateChatListMessage(not_null<HistoryItem*> item) {
 | 
				
			||||||
	if (!_chatListMessage) {
 | 
						if (!_chatListMessage) {
 | 
				
			||||||
| 
						 | 
					@ -298,7 +306,7 @@ void Folder::requestChatListMessage() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Folder::recountChatListMessage() {
 | 
					void Folder::recountChatListMessage() {
 | 
				
			||||||
	_chatListMessage = std::nullopt;
 | 
						_chatListMessage = std::nullopt;
 | 
				
			||||||
	for (const auto history : _chats) {
 | 
						for (const auto history : _histories) {
 | 
				
			||||||
		if (!history->chatListMessageKnown()) {
 | 
							if (!history->chatListMessageKnown()) {
 | 
				
			||||||
			requestChatListMessage();
 | 
								requestChatListMessage();
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
| 
						 | 
					@ -309,7 +317,7 @@ void Folder::recountChatListMessage() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Folder::setChatListMessageFromChannels() {
 | 
					void Folder::setChatListMessageFromChannels() {
 | 
				
			||||||
	_chatListMessage = nullptr;
 | 
						_chatListMessage = nullptr;
 | 
				
			||||||
	for (const auto history : _chats) {
 | 
						for (const auto history : _histories) {
 | 
				
			||||||
		if (const auto last = history->chatListMessage()) {
 | 
							if (const auto last = history->chatListMessage()) {
 | 
				
			||||||
			justUpdateChatListMessage(last);
 | 
								justUpdateChatListMessage(last);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -336,9 +344,9 @@ rpl::producer<int> Folder::unreadCountValue() const {
 | 
				
			||||||
bool Folder::unreadCountKnown() const {
 | 
					bool Folder::unreadCountKnown() const {
 | 
				
			||||||
	return !!_unreadCount;
 | 
						return !!_unreadCount;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// #feed
 | 
					
 | 
				
			||||||
//void Folder::applyDialog(const MTPDdialogFeed &data) {
 | 
					void Folder::applyDialog(const MTPDdialogFolder &data) {
 | 
				
			||||||
//	const auto addChannel = [&](ChannelId channelId) {
 | 
						//const auto addChannel = [&](ChannelId channelId) { // #feed
 | 
				
			||||||
	//	if (const auto channel = owner().channelLoaded(channelId)) {
 | 
						//	if (const auto channel = owner().channelLoaded(channelId)) {
 | 
				
			||||||
	//		channel->setFeed(this);
 | 
						//		channel->setFeed(this);
 | 
				
			||||||
	//	}
 | 
						//	}
 | 
				
			||||||
| 
						 | 
					@ -346,26 +354,28 @@ bool Folder::unreadCountKnown() const {
 | 
				
			||||||
	//for (const auto &channelId : data.vfeed_other_channels.v) {
 | 
						//for (const auto &channelId : data.vfeed_other_channels.v) {
 | 
				
			||||||
	//	addChannel(channelId.v);
 | 
						//	addChannel(channelId.v);
 | 
				
			||||||
	//}
 | 
						//}
 | 
				
			||||||
//
 | 
					
 | 
				
			||||||
//	_chatListMessage = nullptr;
 | 
						_chatListMessage = nullptr;
 | 
				
			||||||
//	if (const auto peerId = peerFromMTP(data.vpeer)) {
 | 
						if (const auto peerId = peerFromMTP(data.vpeer)) {
 | 
				
			||||||
//		if (const auto channelId = peerToChannel(peerId)) {
 | 
							owner().history(peerId)->setFolder(this);
 | 
				
			||||||
//			addChannel(channelId);
 | 
							const auto fullId = FullMsgId(
 | 
				
			||||||
//			const auto fullId = FullMsgId(channelId, data.vtop_message.v);
 | 
								peerToChannel(peerId),
 | 
				
			||||||
//			if (const auto item = App::histItemById(fullId)) {
 | 
								data.vtop_message.v);
 | 
				
			||||||
//				justUpdateChatListMessage(item);
 | 
							if (const auto item = App::histItemById(fullId)) {
 | 
				
			||||||
//			}
 | 
								justUpdateChatListMessage(item);
 | 
				
			||||||
//		}
 | 
							}
 | 
				
			||||||
//	}
 | 
						}
 | 
				
			||||||
//	updateChatListDate();
 | 
						updateChatListDate();
 | 
				
			||||||
//
 | 
						setUnreadCounts(
 | 
				
			||||||
//	setUnreadCounts(
 | 
							data.vunread_unmuted_messages_count.v,
 | 
				
			||||||
//		data.vunread_count.v,
 | 
							data.vunread_muted_messages_count.v);
 | 
				
			||||||
//		data.vunread_muted_count.v);
 | 
						//setUnreadMark(data.is_unread_mark());
 | 
				
			||||||
//	if (data.has_read_max_position()) {
 | 
						//setUnreadMentionsCount(data.vunread_mentions_count.v);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						//if (data.has_read_max_position()) { // #feed
 | 
				
			||||||
	//	setUnreadPosition(FeedPositionFromMTP(data.vread_max_position));
 | 
						//	setUnreadPosition(FeedPositionFromMTP(data.vread_max_position));
 | 
				
			||||||
	//}
 | 
						//}
 | 
				
			||||||
//}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Folder::changedInChatListHook(Dialogs::Mode list, bool added) {
 | 
					void Folder::changedInChatListHook(Dialogs::Mode list, bool added) {
 | 
				
			||||||
	if (list != Dialogs::Mode::All) {
 | 
						if (list != Dialogs::Mode::All) {
 | 
				
			||||||
| 
						 | 
					@ -444,12 +454,12 @@ void Folder::setUnreadCounts(int unreadNonMutedCount, int unreadMutedCount) {
 | 
				
			||||||
		_unreadMutedCount = unreadMutedCount;
 | 
							_unreadMutedCount = unreadMutedCount;
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					// #feed
 | 
				
			||||||
void Folder::setUnreadPosition(const MessagePosition &position) {
 | 
					//void Folder::setUnreadPosition(const MessagePosition &position) {
 | 
				
			||||||
	if (_unreadPosition.current() < position) {
 | 
					//	if (_unreadPosition.current() < position) {
 | 
				
			||||||
		_unreadPosition = position;
 | 
					//		_unreadPosition = position;
 | 
				
			||||||
	}
 | 
					//	}
 | 
				
			||||||
}
 | 
					//}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Folder::unreadCountChanged(int unreadCountDelta, int mutedCountDelta) {
 | 
					void Folder::unreadCountChanged(int unreadCountDelta, int mutedCountDelta) {
 | 
				
			||||||
	if (!unreadCountKnown()) {
 | 
						if (!unreadCountKnown()) {
 | 
				
			||||||
| 
						 | 
					@ -466,14 +476,38 @@ void Folder::unreadCountChanged(int unreadCountDelta, int mutedCountDelta) {
 | 
				
			||||||
		_unreadMutedCount += mutedCountDelta;
 | 
							_unreadMutedCount += mutedCountDelta;
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
MessagePosition Folder::unreadPosition() const {
 | 
					//void Folder::setUnreadMark(bool unread) {
 | 
				
			||||||
	return _unreadPosition.current();
 | 
					//	if (_unreadMark != unread) {
 | 
				
			||||||
}
 | 
					//		_unreadMark = unread;
 | 
				
			||||||
 | 
					//		if (!_unreadCount || !*_unreadCount) {
 | 
				
			||||||
rpl::producer<MessagePosition> Folder::unreadPositionChanges() const {
 | 
					//			if (inChatList(Dialogs::Mode::All)) {
 | 
				
			||||||
	return _unreadPosition.changes();
 | 
					//				const auto delta = _unreadMark ? 1 : -1;
 | 
				
			||||||
}
 | 
					//				_owner->unreadIncrement(delta, mute());
 | 
				
			||||||
 | 
					//				_owner->unreadEntriesChanged(
 | 
				
			||||||
 | 
					//					delta,
 | 
				
			||||||
 | 
					//					mute() ? delta : 0);
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//				updateChatListEntry();
 | 
				
			||||||
 | 
					//			}
 | 
				
			||||||
 | 
					//		}
 | 
				
			||||||
 | 
					//		Notify::peerUpdatedDelayed(
 | 
				
			||||||
 | 
					//			peer,
 | 
				
			||||||
 | 
					//			Notify::PeerUpdate::Flag::UnreadViewChanged);
 | 
				
			||||||
 | 
					//	}
 | 
				
			||||||
 | 
					//}
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//bool Folder::unreadMark() const {
 | 
				
			||||||
 | 
					//	return _unreadMark;
 | 
				
			||||||
 | 
					//}
 | 
				
			||||||
 | 
					// #feed
 | 
				
			||||||
 | 
					//MessagePosition Folder::unreadPosition() const {
 | 
				
			||||||
 | 
					//	return _unreadPosition.current();
 | 
				
			||||||
 | 
					//}
 | 
				
			||||||
 | 
					//
 | 
				
			||||||
 | 
					//rpl::producer<MessagePosition> Folder::unreadPositionChanges() const {
 | 
				
			||||||
 | 
					//	return _unreadPosition.changes();
 | 
				
			||||||
 | 
					//}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Folder::toImportant() const {
 | 
					bool Folder::toImportant() const {
 | 
				
			||||||
	return false; // TODO feeds workmode
 | 
						return false; // TODO feeds workmode
 | 
				
			||||||
| 
						 | 
					@ -484,7 +518,7 @@ bool Folder::useProxyPromotion() const {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool Folder::shouldBeInChatList() const {
 | 
					bool Folder::shouldBeInChatList() const {
 | 
				
			||||||
	return !empty(_chats);
 | 
						return !empty(_histories);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int Folder::chatListUnreadCount() const {
 | 
					int Folder::chatListUnreadCount() const {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,22 +41,26 @@ public:
 | 
				
			||||||
	AuthSession &session() const;
 | 
						AuthSession &session() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	FolderId id() const;
 | 
						FolderId id() const;
 | 
				
			||||||
	void registerOne(not_null<PeerData*> peer);
 | 
						void registerOne(not_null<History*> history);
 | 
				
			||||||
	void unregisterOne(not_null<PeerData*> peer);
 | 
						void unregisterOne(not_null<History*> history);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void updateChatListMessage(not_null<HistoryItem*> item);
 | 
						void updateChatListMessage(not_null<HistoryItem*> item);
 | 
				
			||||||
	void messageRemoved(not_null<HistoryItem*> item);
 | 
						void messageRemoved(not_null<HistoryItem*> item);
 | 
				
			||||||
	void historyCleared(not_null<History*> history);
 | 
						void historyCleared(not_null<History*> history);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	//void applyDialog(const MTPDdialogFeed &data); // #feed
 | 
						void applyDialog(const MTPDdialogFolder &data);
 | 
				
			||||||
	void setUnreadCounts(int unreadNonMutedCount, int unreadMutedCount);
 | 
						void setUnreadCounts(int unreadNonMutedCount, int unreadMutedCount);
 | 
				
			||||||
	void setUnreadPosition(const MessagePosition &position);
 | 
						//void setUnreadPosition(const MessagePosition &position); // #feed
 | 
				
			||||||
	void unreadCountChanged(
 | 
						void unreadCountChanged(
 | 
				
			||||||
		int unreadCountDelta,
 | 
							int unreadCountDelta,
 | 
				
			||||||
		int mutedCountDelta);
 | 
							int mutedCountDelta);
 | 
				
			||||||
	rpl::producer<int> unreadCountValue() const;
 | 
						rpl::producer<int> unreadCountValue() const;
 | 
				
			||||||
	MessagePosition unreadPosition() const;
 | 
						//MessagePosition unreadPosition() const; // #feed
 | 
				
			||||||
	rpl::producer<MessagePosition> unreadPositionChanges() const;
 | 
						//rpl::producer<MessagePosition> unreadPositionChanges() const; // #feed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						//void setUnreadMark(bool unread);
 | 
				
			||||||
 | 
						//bool unreadMark() const;
 | 
				
			||||||
 | 
						//int unreadCountForBadge() const; // unreadCount || unreadMark ? 1 : 0.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int unreadCount() const;
 | 
						int unreadCount() const;
 | 
				
			||||||
	bool unreadCountKnown() const;
 | 
						bool unreadCountKnown() const;
 | 
				
			||||||
| 
						 | 
					@ -82,11 +86,11 @@ public:
 | 
				
			||||||
		int y,
 | 
							int y,
 | 
				
			||||||
		int size) const override;
 | 
							int size) const override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const std::vector<not_null<History*>> &chats() const;
 | 
						const std::vector<not_null<History*>> &histories() const;
 | 
				
			||||||
	int32 chatsHash() const;
 | 
						bool historiesLoaded() const;
 | 
				
			||||||
	bool chatsLoaded() const;
 | 
						void setHistoriesLoaded(bool loaded);
 | 
				
			||||||
	void setChatsLoaded(bool loaded);
 | 
						//int32 chatsHash() const;
 | 
				
			||||||
	void setChats(std::vector<not_null<PeerData*>> chats);
 | 
						//void setChats(std::vector<not_null<PeerData*>> chats); // #feed
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	void indexNameParts();
 | 
						void indexNameParts();
 | 
				
			||||||
| 
						 | 
					@ -103,9 +107,9 @@ private:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	FolderId _id = 0;
 | 
						FolderId _id = 0;
 | 
				
			||||||
	not_null<Data::Session*> _owner;
 | 
						not_null<Data::Session*> _owner;
 | 
				
			||||||
	std::vector<not_null<History*>> _chats;
 | 
						std::vector<not_null<History*>> _histories;
 | 
				
			||||||
	bool _settingChats = false;
 | 
						bool _settingHistories = false;
 | 
				
			||||||
	bool _chatsLoaded = false;
 | 
						bool _historiesLoaded = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QString _name;
 | 
						QString _name;
 | 
				
			||||||
	base::flat_set<QString> _nameWords;
 | 
						base::flat_set<QString> _nameWords;
 | 
				
			||||||
| 
						 | 
					@ -116,6 +120,7 @@ private:
 | 
				
			||||||
	std::optional<int> _unreadCount;
 | 
						std::optional<int> _unreadCount;
 | 
				
			||||||
	rpl::event_stream<int> _unreadCountChanges;
 | 
						rpl::event_stream<int> _unreadCountChanges;
 | 
				
			||||||
	int _unreadMutedCount = 0;
 | 
						int _unreadMutedCount = 0;
 | 
				
			||||||
 | 
						//bool _unreadMark = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1281,8 +1281,8 @@ void Session::applyPinnedDialogs(const QVector<MTPDialog> &list) {
 | 
				
			||||||
			if (const auto peer = peerFromMTP(data.vpeer)) {
 | 
								if (const auto peer = peerFromMTP(data.vpeer)) {
 | 
				
			||||||
				setPinnedDialog(history(peer), true);
 | 
									setPinnedDialog(history(peer), true);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}, [&](const MTPDdialogFolder &data) { // #TODO archive
 | 
							}, [&](const MTPDdialogFolder &data) {
 | 
				
			||||||
			//setPinnedDialog(processFolder(data.vfolder), true);
 | 
								setPinnedDialog(processFolder(data.vfolder), true);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1294,9 +1294,9 @@ void Session::applyPinnedDialogs(const QVector<MTPDialogPeer> &list) {
 | 
				
			||||||
			if (const auto peerId = peerFromMTP(data.vpeer)) {
 | 
								if (const auto peerId = peerFromMTP(data.vpeer)) {
 | 
				
			||||||
				setPinnedDialog(history(peerId), true);
 | 
									setPinnedDialog(history(peerId), true);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}, [&](const MTPDdialogPeerFolder &data) { // #TODO archive
 | 
							}, [&](const MTPDdialogPeerFolder &data) {
 | 
				
			||||||
			//const auto folderId = data.vfolder_id.v;
 | 
								const auto folderId = data.vfolder_id.v;
 | 
				
			||||||
			//setPinnedDialog(folder(folderId), true);
 | 
								setPinnedDialog(folder(folderId), true);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -2801,6 +2801,21 @@ Folder *Session::folderLoaded(FolderId id) {
 | 
				
			||||||
	const auto it = _folders.find(id);
 | 
						const auto it = _folders.find(id);
 | 
				
			||||||
	return (it == end(_folders)) ? nullptr : it->second.get();
 | 
						return (it == end(_folders)) ? nullptr : it->second.get();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					not_null<Folder*> Session::processFolder(const MTPFolder &data) {
 | 
				
			||||||
 | 
						return data.match([&](const MTPDfolder &data) {
 | 
				
			||||||
 | 
							return processFolder(data);
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					not_null<Folder*> Session::processFolder(const MTPDfolder &data) {
 | 
				
			||||||
 | 
						const auto result = folder(data.vid.v);
 | 
				
			||||||
 | 
						//if (data.has_photo()) {
 | 
				
			||||||
 | 
						//	data.vphoto;
 | 
				
			||||||
 | 
						//}
 | 
				
			||||||
 | 
						//data.vtitle;
 | 
				
			||||||
 | 
						return result;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
// // #feed
 | 
					// // #feed
 | 
				
			||||||
//void Session::setDefaultFeedId(FeedId id) {
 | 
					//void Session::setDefaultFeedId(FeedId id) {
 | 
				
			||||||
//	_defaultFeedId = id;
 | 
					//	_defaultFeedId = id;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -154,6 +154,7 @@ dialogsBotIconActive: icon {{ "dialogs_bot", dialogsChatIconFgActive, point(1px,
 | 
				
			||||||
//dialogsFeedIcon: icon {{ "dialogs_feed", dialogsChatIconFg, point(4px, 4px) }}; // #feed
 | 
					//dialogsFeedIcon: icon {{ "dialogs_feed", dialogsChatIconFg, point(4px, 4px) }}; // #feed
 | 
				
			||||||
//dialogsFeedIconOver: icon {{ "dialogs_feed", dialogsChatIconFgOver, point(4px, 4px) }};
 | 
					//dialogsFeedIconOver: icon {{ "dialogs_feed", dialogsChatIconFgOver, point(4px, 4px) }};
 | 
				
			||||||
//dialogsFeedIconActive: icon {{ "dialogs_feed", dialogsChatIconFgActive, point(4px, 4px) }};
 | 
					//dialogsFeedIconActive: icon {{ "dialogs_feed", dialogsChatIconFgActive, point(4px, 4px) }};
 | 
				
			||||||
 | 
					dialogsArchiveUserpic: icon {{ "archive_userpic", historyPeerUserpicFg }};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dialogsSendStateSkip: 20px;
 | 
					dialogsSendStateSkip: 20px;
 | 
				
			||||||
dialogsSendingIcon: icon {{ "dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }};
 | 
					dialogsSendingIcon: icon {{ "dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,6 +36,9 @@ struct PositionChange {
 | 
				
			||||||
class Entry {
 | 
					class Entry {
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	Entry(const Key &key);
 | 
						Entry(const Key &key);
 | 
				
			||||||
 | 
						Entry(const Entry &other) = delete;
 | 
				
			||||||
 | 
						Entry &operator=(const Entry &other) = delete;
 | 
				
			||||||
 | 
						virtual ~Entry() = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	PositionChange adjustByPosInChatList(
 | 
						PositionChange adjustByPosInChatList(
 | 
				
			||||||
		Mode list,
 | 
							Mode list,
 | 
				
			||||||
| 
						 | 
					@ -100,8 +103,6 @@ public:
 | 
				
			||||||
		return _timeId;
 | 
							return _timeId;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	virtual ~Entry() = default;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	mutable const HistoryItem *textCachedFor = nullptr; // cache
 | 
						mutable const HistoryItem *textCachedFor = nullptr; // cache
 | 
				
			||||||
	mutable Text lastItemTextCache;
 | 
						mutable Text lastItemTextCache;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -108,11 +108,11 @@ DialogsInner::DialogsInner(QWidget *parent, not_null<Window::Controller*> contro
 | 
				
			||||||
		if (history->textCachedFor == item) {
 | 
							if (history->textCachedFor == item) {
 | 
				
			||||||
			history->updateChatListEntry();
 | 
								history->updateChatListEntry();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		//if (const auto folder = history->peer->folder()) { // #TODO archive
 | 
							if (const auto folder = history->folder()) {
 | 
				
			||||||
		//	if (folder->textCachedFor == item) {
 | 
								if (folder->textCachedFor == item) {
 | 
				
			||||||
		//		folder->updateChatListEntry();
 | 
									folder->updateChatListEntry();
 | 
				
			||||||
		//	}
 | 
								}
 | 
				
			||||||
		//}
 | 
							}
 | 
				
			||||||
	}, lifetime());
 | 
						}, lifetime());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Auth().data().sendActionAnimationUpdated(
 | 
						Auth().data().sendActionAnimationUpdated(
 | 
				
			||||||
| 
						 | 
					@ -1601,13 +1601,13 @@ void DialogsInner::contextMenuEvent(QContextMenuEvent *e) {
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			Window::PeerMenuSource::ChatsList);
 | 
								Window::PeerMenuSource::ChatsList);
 | 
				
			||||||
	} else if (const auto folder = row.key.folder()) {
 | 
						} else if (const auto folder = row.key.folder()) {
 | 
				
			||||||
		//Window::FillFolderMenu( // #TODO archive
 | 
							Window::FillFolderMenu(
 | 
				
			||||||
		//	_controller,
 | 
								_controller,
 | 
				
			||||||
		//	folder,
 | 
								folder,
 | 
				
			||||||
		//	[&](const QString &text, Fn<void()> callback) {
 | 
								[&](const QString &text, Fn<void()> callback) {
 | 
				
			||||||
		//		return _menu->addAction(text, std::move(callback));
 | 
									return _menu->addAction(text, std::move(callback));
 | 
				
			||||||
		//	},
 | 
								},
 | 
				
			||||||
		//	Window::PeerMenuSource::ChatsList);
 | 
								Window::PeerMenuSource::ChatsList);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	connect(_menu.get(), &QObject::destroyed, [=] {
 | 
						connect(_menu.get(), &QObject::destroyed, [=] {
 | 
				
			||||||
		if (_menuRow.key) {
 | 
							if (_menuRow.key) {
 | 
				
			||||||
| 
						 | 
					@ -1853,7 +1853,7 @@ void DialogsInner::dialogsReceived(const QVector<MTPDialog> &added) {
 | 
				
			||||||
		dialog.match([&](const MTPDdialog &data) {
 | 
							dialog.match([&](const MTPDdialog &data) {
 | 
				
			||||||
			applyDialog(data);
 | 
								applyDialog(data);
 | 
				
			||||||
		}, [&](const MTPDdialogFolder &data) {
 | 
							}, [&](const MTPDdialogFolder &data) {
 | 
				
			||||||
			//applyFolderDialog(data); // #TODO archive
 | 
								applyFolderDialog(data);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	refresh();
 | 
						refresh();
 | 
				
			||||||
| 
						 | 
					@ -1885,19 +1885,18 @@ void DialogsInner::applyDialog(const MTPDdialog &dialog) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// #feed
 | 
					
 | 
				
			||||||
//void DialogsInner::applyFeedDialog(const MTPDdialogFeed &dialog) {
 | 
					void DialogsInner::applyFolderDialog(const MTPDdialogFolder &dialog) {
 | 
				
			||||||
//	const auto feedId = dialog.vfeed_id.v;
 | 
						const auto folder = Auth().data().processFolder(dialog.vfolder);
 | 
				
			||||||
//	const auto feed = Auth().data().feed(feedId);
 | 
						folder->applyDialog(dialog);
 | 
				
			||||||
//	feed->applyDialog(dialog);
 | 
					
 | 
				
			||||||
//
 | 
						if (!folder->useProxyPromotion() && !folder->isPinnedDialog()) {
 | 
				
			||||||
//	if (!feed->useProxyPromotion() && !feed->isPinnedDialog()) {
 | 
							const auto date = folder->chatListTimeId();
 | 
				
			||||||
//		const auto date = feed->chatListDate();
 | 
							if (date != 0) {
 | 
				
			||||||
//		if (!date.isNull()) {
 | 
								addSavedPeersAfter(ParseDateTime(date));
 | 
				
			||||||
//			addSavedPeersAfter(date);
 | 
							}
 | 
				
			||||||
//		}
 | 
						}
 | 
				
			||||||
//	}
 | 
					}
 | 
				
			||||||
//}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DialogsInner::addSavedPeersAfter(const QDateTime &date) {
 | 
					void DialogsInner::addSavedPeersAfter(const QDateTime &date) {
 | 
				
			||||||
	auto &saved = cRefSavedPeersByTime();
 | 
						auto &saved = cRefSavedPeersByTime();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -202,7 +202,7 @@ private:
 | 
				
			||||||
	Dialogs::RowDescriptor chatListEntryLast() const;
 | 
						Dialogs::RowDescriptor chatListEntryLast() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void applyDialog(const MTPDdialog &dialog);
 | 
						void applyDialog(const MTPDdialog &dialog);
 | 
				
			||||||
//	void applyFeedDialog(const MTPDdialogFeed &dialog); // #feed
 | 
						void applyFolderDialog(const MTPDdialogFolder &dialog);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void itemRemoved(not_null<const HistoryItem*> item);
 | 
						void itemRemoved(not_null<const HistoryItem*> item);
 | 
				
			||||||
	enum class UpdateRowSection {
 | 
						enum class UpdateRowSection {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1603,7 +1603,7 @@ int History::unreadCount() const {
 | 
				
			||||||
	return _unreadCount ? *_unreadCount : 0;
 | 
						return _unreadCount ? *_unreadCount : 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int History::historiesUnreadCount() const {
 | 
					int History::unreadCountForBadge() const {
 | 
				
			||||||
	const auto result = unreadCount();
 | 
						const auto result = unreadCount();
 | 
				
			||||||
	return (!result && unreadMark()) ? 1 : result;
 | 
						return (!result && unreadMark()) ? 1 : result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1745,7 +1745,7 @@ bool History::changeMute(bool newMute) {
 | 
				
			||||||
	//	}
 | 
						//	}
 | 
				
			||||||
	//}
 | 
						//}
 | 
				
			||||||
	if (inChatList(Dialogs::Mode::All)) {
 | 
						if (inChatList(Dialogs::Mode::All)) {
 | 
				
			||||||
		if (const auto count = historiesUnreadCount()) {
 | 
							if (const auto count = unreadCountForBadge()) {
 | 
				
			||||||
			_owner->unreadMuteChanged(count, _mute);
 | 
								_owner->unreadMuteChanged(count, _mute);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			const auto entriesWithUnreadDelta = 0;
 | 
								const auto entriesWithUnreadDelta = 0;
 | 
				
			||||||
| 
						 | 
					@ -1807,6 +1807,32 @@ std::shared_ptr<AdminLog::LocalIdManager> History::adminLogIdManager() {
 | 
				
			||||||
	return result;
 | 
						return result;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Data::Folder *History::folder() const {
 | 
				
			||||||
 | 
						return _folder;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void History::setFolder(not_null<Data::Folder*> folder) {
 | 
				
			||||||
 | 
						setFolderPointer(folder);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void History::clearFolder() {
 | 
				
			||||||
 | 
						setFolderPointer(nullptr);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void History::setFolderPointer(Data::Folder *folder) {
 | 
				
			||||||
 | 
						if (_folder != folder) {
 | 
				
			||||||
 | 
							const auto was = _folder;
 | 
				
			||||||
 | 
							_folder = folder;
 | 
				
			||||||
 | 
							if (was) {
 | 
				
			||||||
 | 
								was->unregisterOne(this);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if (_folder) {
 | 
				
			||||||
 | 
								_folder->registerOne(this);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							updateChatListSortPosition();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TimeId History::adjustChatListTimeId() const {
 | 
					TimeId History::adjustChatListTimeId() const {
 | 
				
			||||||
	const auto result = chatListTimeId();
 | 
						const auto result = chatListTimeId();
 | 
				
			||||||
	if (const auto draft = cloudDraft()) {
 | 
						if (const auto draft = cloudDraft()) {
 | 
				
			||||||
| 
						 | 
					@ -2369,7 +2395,7 @@ bool History::useProxyPromotion() const {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool History::shouldBeInChatList() const {
 | 
					bool History::shouldBeInChatList() const {
 | 
				
			||||||
	if (peer->migrateTo()) {
 | 
						if (peer->migrateTo() || folder() != nullptr) {
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	} else if (isPinnedDialog()) {
 | 
						} else if (isPinnedDialog()) {
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
| 
						 | 
					@ -3014,7 +3040,7 @@ void History::applyGroupAdminChanges(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void History::changedInChatListHook(Dialogs::Mode list, bool added) {
 | 
					void History::changedInChatListHook(Dialogs::Mode list, bool added) {
 | 
				
			||||||
	if (list == Dialogs::Mode::All) {
 | 
						if (list == Dialogs::Mode::All) {
 | 
				
			||||||
		if (const auto delta = historiesUnreadCount() * (added ? 1 : -1)) {
 | 
							if (const auto delta = unreadCountForBadge() * (added ? 1 : -1)) {
 | 
				
			||||||
			_owner->unreadIncrement(delta, mute());
 | 
								_owner->unreadIncrement(delta, mute());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			const auto entriesDelta = added ? 1 : -1;
 | 
								const auto entriesDelta = added ? 1 : -1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,6 +28,7 @@ class AuthSession;
 | 
				
			||||||
namespace Data {
 | 
					namespace Data {
 | 
				
			||||||
struct Draft;
 | 
					struct Draft;
 | 
				
			||||||
class Session;
 | 
					class Session;
 | 
				
			||||||
 | 
					class Folder;
 | 
				
			||||||
} // namespace Data
 | 
					} // namespace Data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace Dialogs {
 | 
					namespace Dialogs {
 | 
				
			||||||
| 
						 | 
					@ -61,6 +62,7 @@ public:
 | 
				
			||||||
	History(not_null<Data::Session*> owner, PeerId peerId);
 | 
						History(not_null<Data::Session*> owner, PeerId peerId);
 | 
				
			||||||
	History(const History &) = delete;
 | 
						History(const History &) = delete;
 | 
				
			||||||
	History &operator=(const History &) = delete;
 | 
						History &operator=(const History &) = delete;
 | 
				
			||||||
 | 
						~History();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Data::Session &owner() const;
 | 
						Data::Session &owner() const;
 | 
				
			||||||
	AuthSession &session() const;
 | 
						AuthSession &session() const;
 | 
				
			||||||
| 
						 | 
					@ -170,7 +172,7 @@ public:
 | 
				
			||||||
	void changeUnreadCount(int delta);
 | 
						void changeUnreadCount(int delta);
 | 
				
			||||||
	void setUnreadMark(bool unread);
 | 
						void setUnreadMark(bool unread);
 | 
				
			||||||
	bool unreadMark() const;
 | 
						bool unreadMark() const;
 | 
				
			||||||
	int historiesUnreadCount() const; // unreadCount || unreadMark ? 1 : 0.
 | 
						int unreadCountForBadge() const; // unreadCount || unreadMark ? 1 : 0.
 | 
				
			||||||
	bool mute() const;
 | 
						bool mute() const;
 | 
				
			||||||
	bool changeMute(bool newMute);
 | 
						bool changeMute(bool newMute);
 | 
				
			||||||
	void addUnreadBar();
 | 
						void addUnreadBar();
 | 
				
			||||||
| 
						 | 
					@ -324,7 +326,9 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::shared_ptr<AdminLog::LocalIdManager> adminLogIdManager();
 | 
						std::shared_ptr<AdminLog::LocalIdManager> adminLogIdManager();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	virtual ~History();
 | 
						Data::Folder *folder() const;
 | 
				
			||||||
 | 
						void setFolder(not_null<Data::Folder*> folder);
 | 
				
			||||||
 | 
						void clearFolder();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Still public data.
 | 
						// Still public data.
 | 
				
			||||||
	std::deque<std::unique_ptr<HistoryBlock>> blocks;
 | 
						std::deque<std::unique_ptr<HistoryBlock>> blocks;
 | 
				
			||||||
| 
						 | 
					@ -461,6 +465,8 @@ private:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void createLocalDraftFromCloud();
 | 
						void createLocalDraftFromCloud();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						void setFolderPointer(Data::Folder *folder);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	not_null<Data::Session*> _owner;
 | 
						not_null<Data::Session*> _owner;
 | 
				
			||||||
	Flags _flags = 0;
 | 
						Flags _flags = 0;
 | 
				
			||||||
	bool _mute = false;
 | 
						bool _mute = false;
 | 
				
			||||||
| 
						 | 
					@ -472,6 +478,8 @@ private:
 | 
				
			||||||
	bool _loadedAtTop = false;
 | 
						bool _loadedAtTop = false;
 | 
				
			||||||
	bool _loadedAtBottom = true;
 | 
						bool _loadedAtBottom = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Data::Folder *_folder = nullptr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::optional<MsgId> _inboxReadBefore;
 | 
						std::optional<MsgId> _inboxReadBefore;
 | 
				
			||||||
	std::optional<MsgId> _outboxReadBefore;
 | 
						std::optional<MsgId> _outboxReadBefore;
 | 
				
			||||||
	std::optional<int> _unreadCount;
 | 
						std::optional<int> _unreadCount;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4014,6 +4014,12 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	} break;
 | 
						} break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case mtpc_updateFolderPeers: {
 | 
				
			||||||
 | 
							const auto &data = update.c_updateFolderPeers();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							ptsUpdateAndApply(data.vpts.v, data.vpts_count.v, update);
 | 
				
			||||||
 | 
						} break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Deleted messages.
 | 
						// Deleted messages.
 | 
				
			||||||
	case mtpc_updateDeleteMessages: {
 | 
						case mtpc_updateDeleteMessages: {
 | 
				
			||||||
		auto &d = update.c_updateDeleteMessages();
 | 
							auto &d = update.c_updateDeleteMessages();
 | 
				
			||||||
| 
						 | 
					@ -4287,8 +4293,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
 | 
				
			||||||
					return !session().data().historyLoaded(
 | 
										return !session().data().historyLoaded(
 | 
				
			||||||
						peerFromMTP(data.vpeer));
 | 
											peerFromMTP(data.vpeer));
 | 
				
			||||||
				}, [&](const MTPDdialogPeerFolder &data) {
 | 
									}, [&](const MTPDdialogPeerFolder &data) {
 | 
				
			||||||
					//return !session().data().folderLoaded(data.vfolder_id.v);
 | 
										return !session().data().folderLoaded(data.vfolder_id.v);
 | 
				
			||||||
					return true; // #TODO archive
 | 
					 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
			const auto allLoaded = ranges::find_if(order, notLoaded)
 | 
								const auto allLoaded = ranges::find_if(order, notLoaded)
 | 
				
			||||||
| 
						 | 
					@ -4317,17 +4322,16 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
 | 
				
			||||||
				_dialogs->loadPinnedDialogs();
 | 
									_dialogs->loadPinnedDialogs();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}, [&](const MTPDdialogPeerFolder &data) {
 | 
							}, [&](const MTPDdialogPeerFolder &data) {
 | 
				
			||||||
			// #TODO archive
 | 
								const auto id = data.vfolder_id.v;
 | 
				
			||||||
			//const auto id = data.vfolder_id.v;
 | 
								if (const auto folder = session().data().folderLoaded(id)) {
 | 
				
			||||||
			//if (const auto folder = session().data().folderLoaded(id)) {
 | 
									session().data().setPinnedDialog(folder, d.is_pinned());
 | 
				
			||||||
			//	session().data().setPinnedDialog(folder, d.is_pinned());
 | 
								} else {
 | 
				
			||||||
			//} else {
 | 
									DEBUG_LOG(("API Error: "
 | 
				
			||||||
			//	DEBUG_LOG(("API Error: "
 | 
										"pinned folder not loaded for folderId %1"
 | 
				
			||||||
			//		"pinned folder not loaded for feedId %1"
 | 
										).arg(id
 | 
				
			||||||
			//		).arg(folderId
 | 
										));
 | 
				
			||||||
			//		));
 | 
									_dialogs->loadPinnedDialogs();
 | 
				
			||||||
			//	_dialogs->loadPinnedDialogs();
 | 
								}
 | 
				
			||||||
			//}
 | 
					 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	} break;
 | 
						} break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue