Send update about new loaded from database group.

GitOrigin-RevId: d80f4746c36946eb9b5042c74b3c4ebdcefa876e
This commit is contained in:
levlam 2018-12-02 23:39:47 +03:00
parent 7bdad0c877
commit d9dcca7743
2 changed files with 13 additions and 1 deletions

View File

@ -17681,6 +17681,9 @@ vector<NotificationGroupKey> MessagesManager::get_message_notification_group_key
return {}; return {};
} }
VLOG(notifications) << "Load " << limit << " message notification groups from database from date "
<< from_last_notification_date << " and " << from_dialog_id;
Result<std::vector<BufferSlice>> r_dialogs = Result<std::vector<BufferSlice>> r_dialogs =
G()->td_db()->get_dialog_db_sync()->get_dialogs_by_last_notification_date(from_last_notification_date, G()->td_db()->get_dialog_db_sync()->get_dialogs_by_last_notification_date(from_last_notification_date,
from_dialog_id, limit); from_dialog_id, limit);

View File

@ -202,7 +202,15 @@ NotificationManager::NotificationGroups::iterator NotificationManager::get_group
VLOG(notifications) << "Finish to load " << group_id << " with total_count " << message_group.total_count VLOG(notifications) << "Finish to load " << group_id << " with total_count " << message_group.total_count
<< " and notifications " << group.notifications; << " and notifications " << group.notifications;
// TODO send update about the new group, if needed if (send_update && group_key.last_notification_date != 0) {
auto last_group_key = get_last_updated_group_key();
if (group_key < last_group_key) {
if (last_group_key.last_notification_date != 0) {
send_remove_group_update(last_group_key, groups_[last_group_key], vector<int32>());
}
send_add_group_update(group_key, group);
}
}
return add_group(std::move(group_key), std::move(group)); return add_group(std::move(group_key), std::move(group));
} }
@ -218,6 +226,7 @@ int32 NotificationManager::load_message_notification_groups_from_database(int32
// everything was already loaded // everything was already loaded
return 0; return 0;
} }
vector<NotificationGroupKey> group_keys = td_->messages_manager_->get_message_notification_group_keys_from_database( vector<NotificationGroupKey> group_keys = td_->messages_manager_->get_message_notification_group_keys_from_database(
last_loaded_notification_date_, last_loaded_notification_dialog_id_, limit); last_loaded_notification_date_, last_loaded_notification_dialog_id_, limit);
if (group_keys.empty()) { if (group_keys.empty()) {