Add dummy load_message_notifications_from_database.

GitOrigin-RevId: 9aad6c7f34c26b43fcc0f2693679237458f955f9
This commit is contained in:
levlam 2018-12-03 01:25:34 +03:00
parent 869a33541f
commit 2b5be01417
3 changed files with 21 additions and 18 deletions

View File

@ -17733,13 +17733,15 @@ void MessagesManager::remove_message_notification(DialogId dialog_id, Notificati
return;
}
G()->td_db()->get_messages_db_async()->get_messages_from_notification_id(
dialog_id, NotificationId(notification_id.get() + 1), 1,
PromiseCreator::lambda(
[dialog_id, notification_id, actor_id = actor_id(this)](vector<BufferSlice> result) mutable {
send_closure(actor_id, &MessagesManager::do_remove_message_notification, dialog_id, notification_id,
std::move(result));
}));
if (G()->parameters().use_message_db) {
G()->td_db()->get_messages_db_async()->get_messages_from_notification_id(
dialog_id, NotificationId(notification_id.get() + 1), 1,
PromiseCreator::lambda(
[dialog_id, notification_id, actor_id = actor_id(this)](vector<BufferSlice> result) mutable {
send_closure(actor_id, &MessagesManager::do_remove_message_notification, dialog_id, notification_id,
std::move(result));
}));
}
}
void MessagesManager::do_remove_message_notification(DialogId dialog_id, NotificationId notification_id,
@ -17750,14 +17752,8 @@ void MessagesManager::do_remove_message_notification(DialogId dialog_id, Notific
CHECK(result.size() == 1);
Dialog *d = get_dialog_force(dialog_id);
if (d == nullptr) {
LOG(ERROR) << "Can't find " << dialog_id;
return;
}
if (!d->message_notification_group_id.is_valid()) {
LOG(ERROR) << "There is no message notiication group in " << dialog_id;
return;
}
CHECK(d != nullptr);
CHECK(d->message_notification_group_id.is_valid());
auto m = on_get_message_from_database(dialog_id, d, std::move(result[0]));
if (m->notification_id == notification_id && is_message_has_active_notification(d, m)) {

View File

@ -244,6 +244,11 @@ int32 NotificationManager::load_message_notification_groups_from_database(int32
return result;
}
void NotificationManager::load_message_notifications_from_database(const NotificationGroupKey &group_key,
const NotificationGroup &group) {
// TODO
}
size_t NotificationManager::get_max_notification_group_size() const {
return max_notification_group_size_;
}
@ -1151,7 +1156,7 @@ void NotificationManager::remove_notification(NotificationGroupId group_id, Noti
added_notifications.pop_back();
}
} else {
// TODO preload more notifications in the group
load_message_notifications_from_database(group_it->first, group_it->second);
}
}
@ -1388,8 +1393,8 @@ void NotificationManager::on_notification_group_size_max_changed() {
}
}
if (new_max_notification_group_size_size_t > notification_count &&
static_cast<size_t>(group.total_count) > notification_count) {
// TODO load more notifications in the group from the message database
static_cast<size_t>(group.total_count) > notification_count && G()->parameters().use_message_db) {
load_message_notifications_from_database(group_key, group);
}
if (added_notifications.empty()) {
continue;

View File

@ -141,6 +141,8 @@ class NotificationManager : public Actor {
int32 load_message_notification_groups_from_database(int32 limit, bool send_update);
void load_message_notifications_from_database(const NotificationGroupKey &group_key, const NotificationGroup &group);
NotificationGroupKey get_last_updated_group_key() const;
void send_remove_group_update(const NotificationGroupKey &group_key, const NotificationGroup &group,