mirror of https://github.com/procxx/kepka.git
Update archive row on chat list name change.
This commit is contained in:
parent
9ff02707bf
commit
3dd2a6bb5b
|
@ -17,9 +17,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
//#include "storage/storage_feed_messages.h" // #feed
|
//#include "storage/storage_feed_messages.h" // #feed
|
||||||
#include "auth_session.h"
|
#include "auth_session.h"
|
||||||
|
#include "observer_peer.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "styles/style_dialogs.h" // st::dialogsArchiveUserpic
|
#include "styles/style_dialogs.h"
|
||||||
|
|
||||||
namespace Data {
|
namespace Data {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -55,6 +56,18 @@ Folder::Folder(not_null<Data::Session*> owner, FolderId id)
|
||||||
, _chatsList(PinnedDialogsInFolderMaxValue())
|
, _chatsList(PinnedDialogsInFolderMaxValue())
|
||||||
, _name(lang(lng_archived_name)) {
|
, _name(lang(lng_archived_name)) {
|
||||||
indexNameParts();
|
indexNameParts();
|
||||||
|
|
||||||
|
Notify::PeerUpdateViewer(
|
||||||
|
Notify::PeerUpdate::Flag::NameChanged
|
||||||
|
) | rpl::start_with_next([=](const Notify::PeerUpdate &update) {
|
||||||
|
for (const auto history : _unreadHistoriesLast) {
|
||||||
|
if (history->peer == update.peer) {
|
||||||
|
++_chatListViewVersion;
|
||||||
|
updateChatListEntry();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
FolderId Folder::id() const {
|
FolderId Folder::id() const {
|
||||||
|
@ -227,9 +240,21 @@ void Folder::paintUserpic(
|
||||||
p.setBrush(st::historyPeerArchiveUserpicBg);
|
p.setBrush(st::historyPeerArchiveUserpicBg);
|
||||||
{
|
{
|
||||||
PainterHighQualityEnabler hq(p);
|
PainterHighQualityEnabler hq(p);
|
||||||
p.drawRoundedRect(x, y, size, size, size / 3., size / 3.);
|
p.drawEllipse(x, y, size, size);
|
||||||
|
}
|
||||||
|
if (size == st::dialogsPhotoSize) {
|
||||||
|
st::dialogsArchiveUserpic.paintInCenter(p, { x, y, size, size });
|
||||||
|
} else {
|
||||||
|
p.save();
|
||||||
|
const auto ratio = size / float64(st::dialogsPhotoSize);
|
||||||
|
p.translate(x + size / 2., y + size / 2.);
|
||||||
|
p.scale(ratio, ratio);
|
||||||
|
const auto skip = st::dialogsPhotoSize;
|
||||||
|
st::dialogsArchiveUserpic.paintInCenter(
|
||||||
|
p,
|
||||||
|
{ -skip, -skip, 2 * skip, 2 * skip });
|
||||||
|
p.restore();
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
|
|
@ -108,6 +108,8 @@ private:
|
||||||
uint32 _chatListViewVersion = 0;
|
uint32 _chatListViewVersion = 0;
|
||||||
//rpl::variable<MessagePosition> _unreadPosition;
|
//rpl::variable<MessagePosition> _unreadPosition;
|
||||||
|
|
||||||
|
rpl::lifetime _lifetime;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
|
@ -115,7 +115,7 @@ void PeerData::updateNameDelayed(
|
||||||
const QString &newName,
|
const QString &newName,
|
||||||
const QString &newNameOrPhone,
|
const QString &newNameOrPhone,
|
||||||
const QString &newUsername) {
|
const QString &newUsername) {
|
||||||
if (name == newName) {
|
if (name == newName && nameVersion > 1) {
|
||||||
if (isUser()) {
|
if (isUser()) {
|
||||||
if (asUser()->nameOrPhone == newNameOrPhone
|
if (asUser()->nameOrPhone == newNameOrPhone
|
||||||
&& asUser()->username == newUsername) {
|
&& asUser()->username == newUsername) {
|
||||||
|
@ -129,15 +129,14 @@ void PeerData::updateNameDelayed(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++nameVersion;
|
|
||||||
name = newName;
|
name = newName;
|
||||||
nameText.setText(st::msgNameStyle, name, Ui::NameTextOptions());
|
nameText.setText(st::msgNameStyle, name, Ui::NameTextOptions());
|
||||||
refreshEmptyUserpic();
|
refreshEmptyUserpic();
|
||||||
|
|
||||||
Notify::PeerUpdate update(this);
|
Notify::PeerUpdate update(this);
|
||||||
update.flags |= UpdateFlag::NameChanged;
|
if (nameVersion++ > 1) {
|
||||||
update.oldNameFirstLetters = nameFirstLetters();
|
update.flags |= UpdateFlag::NameChanged;
|
||||||
|
update.oldNameFirstLetters = nameFirstLetters();
|
||||||
|
}
|
||||||
if (isUser()) {
|
if (isUser()) {
|
||||||
if (asUser()->username != newUsername) {
|
if (asUser()->username != newUsername) {
|
||||||
asUser()->username = newUsername;
|
asUser()->username = newUsername;
|
||||||
|
@ -157,7 +156,9 @@ void PeerData::updateNameDelayed(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fillNames();
|
fillNames();
|
||||||
Notify::PeerUpdated().notify(update, true);
|
if (update.flags) {
|
||||||
|
Notify::PeerUpdated().notify(update, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Ui::EmptyUserpic> PeerData::createEmptyUserpic() const {
|
std::unique_ptr<Ui::EmptyUserpic> PeerData::createEmptyUserpic() const {
|
||||||
|
|
|
@ -2016,7 +2016,7 @@ void DialogsInner::refresh(bool toTop) {
|
||||||
loadPeerPhotos();
|
loadPeerPhotos();
|
||||||
}
|
}
|
||||||
_controller->dialogsListDisplayForced().set(
|
_controller->dialogsListDisplayForced().set(
|
||||||
_searchInChat || !_filter.isEmpty(),
|
_openedFolder || _searchInChat || !_filter.isEmpty(),
|
||||||
true);
|
true);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
@ -2058,6 +2058,9 @@ void DialogsInner::searchInChat(Dialogs::Key key, UserData *from) {
|
||||||
_searchInChat = key;
|
_searchInChat = key;
|
||||||
_searchFromUser = from;
|
_searchFromUser = from;
|
||||||
if (_searchInChat) {
|
if (_searchInChat) {
|
||||||
|
if (_openedFolder) {
|
||||||
|
changeOpenedFolder(nullptr);
|
||||||
|
}
|
||||||
onHashtagFilterUpdate(QStringRef());
|
onHashtagFilterUpdate(QStringRef());
|
||||||
_cancelSearchInChat->show();
|
_cancelSearchInChat->show();
|
||||||
refreshSearchInChatLabel();
|
refreshSearchInChatLabel();
|
||||||
|
@ -2070,7 +2073,7 @@ void DialogsInner::searchInChat(Dialogs::Key key, UserData *from) {
|
||||||
_cancelSearchFromUser->hide();
|
_cancelSearchFromUser->hide();
|
||||||
}
|
}
|
||||||
_controller->dialogsListDisplayForced().set(
|
_controller->dialogsListDisplayForced().set(
|
||||||
_searchInChat || !_filter.isEmpty(),
|
_openedFolder || _searchInChat || !_filter.isEmpty(),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue