Fix lagging chat list update in support.

This commit is contained in:
John Preston 2018-12-30 13:16:50 +04:00
parent 30e8f17b37
commit c11b977f1d
10 changed files with 18 additions and 23 deletions

View File

@ -73,6 +73,7 @@ void Entry::updateChatListSortPosition() {
if (Auth().supportMode()
&& _sortKeyInChatList != 0
&& Auth().settings().supportFixChatsOrder()) {
updateChatListEntry();
return;
}
_sortKeyInChatList = useProxyPromotion()
@ -199,6 +200,10 @@ void Entry::updateChatListEntry() const {
mainChatListLink(Mode::Important));
}
}
if (Auth().supportMode()
&& !Auth().settings().supportAllSearchResults()) {
main->repaintDialogRow({ _key, FullMsgId() });
}
}
}

View File

@ -1346,13 +1346,8 @@ void DialogsInner::repaintDialogRow(
}
}
void DialogsInner::repaintDialogRow(
not_null<History*> history,
MsgId messageId) {
updateDialogRow({
history,
FullMsgId(history->channelId(), messageId)
});
void DialogsInner::repaintDialogRow(Dialogs::RowDescriptor row) {
updateDialogRow(row);
}
void DialogsInner::updateSearchResult(not_null<PeerData*> peer) {
@ -1439,8 +1434,7 @@ void DialogsInner::updateDialogRow(
const auto add = searchedOffset();
auto index = 0;
for (const auto &result : _searchResults) {
auto item = result->item();
if (item->fullId() == row.fullId) {
if (isSearchResultActive(result.get(), row)) {
updateRow(add + index * st::dialogsRowHeight);
break;
}

View File

@ -55,7 +55,7 @@ public:
void createDialog(Dialogs::Key key);
void removeDialog(Dialogs::Key key);
void repaintDialogRow(Dialogs::Mode list, not_null<Dialogs::Row*> row);
void repaintDialogRow(not_null<History*> history, MsgId messageId);
void repaintDialogRow(Dialogs::RowDescriptor row);
void dragLeft();

View File

@ -319,10 +319,8 @@ void DialogsWidget::repaintDialogRow(
_inner->repaintDialogRow(list, row);
}
void DialogsWidget::repaintDialogRow(
not_null<History*> history,
MsgId messageId) {
_inner->repaintDialogRow(history, messageId);
void DialogsWidget::repaintDialogRow(Dialogs::RowDescriptor row) {
_inner->repaintDialogRow(row);
}
void DialogsWidget::dialogsToUp() {

View File

@ -61,7 +61,7 @@ public:
void createDialog(Dialogs::Key key);
void removeDialog(Dialogs::Key key);
void repaintDialogRow(Dialogs::Mode list, not_null<Dialogs::Row*> row);
void repaintDialogRow(not_null<History*> history, MsgId messageId);
void repaintDialogRow(Dialogs::RowDescriptor row);
void dialogsToUp();

View File

@ -1725,7 +1725,7 @@ void History::outboxRead(MsgId upTo) {
if (const auto last = lastMessage()) {
if (last->out() && IsServerMsgId(last->id) && last->id <= upTo) {
if (const auto main = App::main()) {
main->repaintDialogRow(this, last->id);
main->repaintDialogRow({ this, last->fullId() });
}
}
}

View File

@ -217,7 +217,7 @@ ReplyKeyboard *HistoryItem::inlineReplyKeyboard() {
void HistoryItem::invalidateChatsListEntry() {
if (const auto main = App::main()) {
// #TODO feeds search results
main->repaintDialogRow(history(), id);
main->repaintDialogRow({ history(), fullId() });
}
// invalidate cache for drawInDialog

View File

@ -691,7 +691,7 @@ void HistoryService::updateDependentText() {
}
if (const auto main = App::main()) {
// #TODO feeds search results
main->repaintDialogRow(history(), id);
main->repaintDialogRow({ history(), fullId() });
}
App::historyUpdateDependent(this);
}

View File

@ -2209,10 +2209,8 @@ void MainWidget::repaintDialogRow(
_dialogs->repaintDialogRow(list, row);
}
void MainWidget::repaintDialogRow(
not_null<History*> history,
MsgId messageId) {
_dialogs->repaintDialogRow(history, messageId);
void MainWidget::repaintDialogRow(Dialogs::RowDescriptor row) {
_dialogs->repaintDialogRow(row);
}
void MainWidget::windowShown() {

View File

@ -116,7 +116,7 @@ public:
void createDialog(Dialogs::Key key);
void removeDialog(Dialogs::Key key);
void repaintDialogRow(Dialogs::Mode list, not_null<Dialogs::Row*> row);
void repaintDialogRow(not_null<History*> history, MsgId messageId);
void repaintDialogRow(Dialogs::RowDescriptor row);
void windowShown();