Commit 46d53af3 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Kateryna Kostiuk

smartlist: fix lag on message notifications

- Previously, a delay was introduced to prevent excessive
  smartlist reloading during message status changes. This patch
  removes the timer and updates only the corresponding
  conversation item.

Change-Id: I3e7330038b3f2efd92e82ed579ee104c470d05f4
Reviewed-by: Kateryna Kostiuk's avatarKateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
parent b688e27f
......@@ -57,7 +57,6 @@
bool selectorIsPresent;
QMetaObject::Connection modelSortedConnection_, modelUpdatedConnection_, filterChangedConnection_, newConversationConnection_, conversationRemovedConnection_, interactionStatusUpdatedConnection_, conversationClearedConnection;
NSTimer* statusUpdateDebounceTimer;
lrc::api::ConversationModel* model_;
std::string selectedUid_;
......@@ -233,18 +232,7 @@ NSInteger const REQUEST_SEG = 1;
[self] (const std::string& convUid) {
if (convUid != selectedUid_)
return;
auto it = getConversationFromUid(selectedUid_, *model_);
if (it != model_->allFilteredConversations().end()) {
// The following mechanism is here to debounce the interactionStatusUpdated so
// we do not redraw the conversation list for each message status changing
if (statusUpdateDebounceTimer != nil) {
[statusUpdateDebounceTimer invalidate];
}
statusUpdateDebounceTimer = [NSTimer timerWithTimeInterval:1.0 repeats:NO block:^(NSTimer * _Nonnull timer) {
[self reloadData];
}];
[[NSRunLoop mainRunLoop] addTimer:statusUpdateDebounceTimer forMode:NSRunLoopCommonModes];
}
[self reloadConversationWithUid: [NSString stringWithUTF8String:convUid.c_str()]];
});
model_->setFilter(""); // Reset the filter
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment