Show unread archive chat names in bold.

This commit is contained in:
John Preston 2019-05-08 12:05:15 +03:00
parent e55e46a0f0
commit 64dd5139da
4 changed files with 38 additions and 14 deletions

View File

@ -102,7 +102,6 @@ void Folder::indexNameParts() {
}
void Folder::registerOne(not_null<History*> history) {
++_chatListViewVersion;
if (_chatsList.indexed()->size() == 1) {
updateChatListSortPosition();
if (!_cloudUnread.known) {
@ -118,9 +117,6 @@ void Folder::registerOne(not_null<History*> history) {
void Folder::unregisterOne(not_null<History*> history) {
if (_chatsList.empty()) {
updateChatListExistence();
} else {
++_chatListViewVersion;
updateChatListEntry();
}
if (_chatListMessage && _chatListMessage->history() == history) {
computeChatListMessage();
@ -360,6 +356,13 @@ void Folder::unreadStateChanged(
const Dialogs::Key &key,
const Dialogs::UnreadState &wasState,
const Dialogs::UnreadState &nowState) {
if (const auto history = key.history()) {
if (wasState.empty() != nowState.empty()) {
++_chatListViewVersion;
updateChatListEntry();
}
}
const auto updateCloudUnread = _cloudUnread.known && wasState.known;
const auto notify = _chatsList.loaded() || updateCloudUnread;
const auto notifier = unreadStateChangeNotifier(notify);

View File

@ -72,6 +72,15 @@ dialogsTextPaletteTakenOver: TextPalette(defaultTextPalette) {
dialogsTextPaletteTakenActive: TextPalette(defaultTextPalette) {
linkFg: dialogsDraftFgActive;
}
dialogsTextPaletteArchive: TextPalette(defaultTextPalette) {
linkFg: dialogsArchiveFg;
}
dialogsTextPaletteArchiveOver: TextPalette(defaultTextPalette) {
linkFg: dialogsArchiveFgOver;
}
dialogsTextPaletteArchiveActive: TextPalette(defaultTextPalette) {
linkFg: dialogsTextFgActive;
}
dialogsMenuToggle: IconButton {
width: 40px;

View File

@ -172,11 +172,17 @@ void PaintListEntryText(
return;
}
row->validateListEntryCache();
const auto &palette = active
? st::dialogsTextPaletteActive
: selected
? st::dialogsTextPaletteOver
: st::dialogsTextPalette;
const auto &palette = row->folder()
? (active
? st::dialogsTextPaletteArchiveActive
: selected
? st::dialogsTextPaletteArchiveOver
: st::dialogsTextPaletteArchive)
: (active
? st::dialogsTextPaletteActive
: selected
? st::dialogsTextPaletteOver
: st::dialogsTextPalette);
const auto &color = active
? st::dialogsTextFgActive
: selected

View File

@ -35,21 +35,27 @@ QString ComposeFolderListEntryText(not_null<Data::Folder*> folder) {
list
) | ranges::view::take(
list.size() - (throwAwayLastName ? 1 : 0)
) | ranges::view::transform([](not_null<History*> history) {
return history->peer;
});
);
const auto wrapName = [](not_null<History*> history) {
const auto name = TextUtilities::Clean(App::peerName(history->peer));
return (history->unreadCount() > 0)
? (textcmdStartSemibold()
+ textcmdLink(1, name)
+ textcmdStopSemibold())
: name;
};
const auto shown = int(peers.size());
const auto accumulated = [&] {
Expects(shown > 0);
auto i = peers.begin();
auto result = App::peerName(*i);
auto result = wrapName(*i);
for (++i; i != peers.end(); ++i) {
result = lng_archived_last_list(
lt_accumulated,
result,
lt_chat,
App::peerName(*i));
wrapName(*i));
}
return result;
}();