Add source to NotificationManager::add_notification.

GitOrigin-RevId: e832fbe7ba970f18524e9937add84e341d528b10
This commit is contained in:
levlam 2019-04-03 02:02:18 +03:00
parent 0171ae53ae
commit 39b83ebe07
3 changed files with 13 additions and 10 deletions

View File

@ -19213,7 +19213,7 @@ bool MessagesManager::add_new_message_notification(Dialog *d, Message *m, bool f
send_closure_later(G()->notification_manager(), &NotificationManager::add_notification, notification_group_id, send_closure_later(G()->notification_manager(), &NotificationManager::add_notification, notification_group_id,
from_mentions ? NotificationGroupType::Mentions : NotificationGroupType::Messages, d->dialog_id, from_mentions ? NotificationGroupType::Mentions : NotificationGroupType::Messages, d->dialog_id,
m->date, settings_dialog_id, is_silent, min_delay_ms, m->notification_id, m->date, settings_dialog_id, is_silent, min_delay_ms, m->notification_id,
create_new_message_notification(m->message_id)); create_new_message_notification(m->message_id), "add_new_message_notification");
return true; return true;
} }
@ -23359,7 +23359,8 @@ void MessagesManager::force_create_dialog(DialogId dialog_id, const char *source
VLOG(notifications) << "Create " << d->new_secret_chat_notification_id << " with " << secret_chat_id; VLOG(notifications) << "Create " << d->new_secret_chat_notification_id << " with " << secret_chat_id;
send_closure_later(G()->notification_manager(), &NotificationManager::add_notification, send_closure_later(G()->notification_manager(), &NotificationManager::add_notification,
notification_group_id, NotificationGroupType::SecretChat, dialog_id, date, dialog_id, notification_group_id, NotificationGroupType::SecretChat, dialog_id, date, dialog_id,
false, 0, d->new_secret_chat_notification_id, create_new_secret_chat_notification()); false, 0, d->new_secret_chat_notification_id, create_new_secret_chat_notification(),
"add_new_secret_chat_notification");
} }
} }
} }

View File

@ -823,7 +823,7 @@ int32 NotificationManager::get_notification_delay_ms(DialogId dialog_id, const P
void NotificationManager::add_notification(NotificationGroupId group_id, NotificationGroupType group_type, void NotificationManager::add_notification(NotificationGroupId group_id, NotificationGroupType group_type,
DialogId dialog_id, int32 date, DialogId notification_settings_dialog_id, DialogId dialog_id, int32 date, DialogId notification_settings_dialog_id,
bool is_silent, int32 min_delay_ms, NotificationId notification_id, bool is_silent, int32 min_delay_ms, NotificationId notification_id,
unique_ptr<NotificationType> type) { unique_ptr<NotificationType> type, const char *source) {
if (is_disabled() || max_notification_group_count_ == 0) { if (is_disabled() || max_notification_group_count_ == 0) {
on_notification_removed(notification_id); on_notification_removed(notification_id);
return; return;
@ -832,7 +832,7 @@ void NotificationManager::add_notification(NotificationGroupId group_id, Notific
CHECK(group_id.is_valid()); CHECK(group_id.is_valid());
CHECK(dialog_id.is_valid()); CHECK(dialog_id.is_valid());
CHECK(notification_settings_dialog_id.is_valid()); CHECK(notification_settings_dialog_id.is_valid());
CHECK(notification_id.is_valid()); LOG_CHECK(notification_id.is_valid()) << notification_id << " " << source;
CHECK(type != nullptr); CHECK(type != nullptr);
VLOG(notifications) << "Add " << notification_id << " to " << group_id << " of type " << group_type << " in " VLOG(notifications) << "Add " << notification_id << " to " << group_id << " of type " << group_type << " in "
<< dialog_id << " with settings from " << notification_settings_dialog_id << dialog_id << " with settings from " << notification_settings_dialog_id
@ -883,7 +883,7 @@ void NotificationManager::add_notification(NotificationGroupId group_id, Notific
flush_pending_notifications_timeout_.set_timeout_at(group_id.get(), group.pending_notifications_flush_time); flush_pending_notifications_timeout_.set_timeout_at(group_id.get(), group.pending_notifications_flush_time);
} }
if (group.pending_notifications.empty()) { if (group.pending_notifications.empty()) {
on_delayed_notification_update_count_changed(1, group_id.get(), "add_notification"); on_delayed_notification_update_count_changed(1, group_id.get(), source);
} }
group.pending_notifications.push_back(std::move(notification)); group.pending_notifications.push_back(std::move(notification));
} }
@ -2236,7 +2236,7 @@ void NotificationManager::add_call_notification(DialogId dialog_id, CallId call_
active_notifications.push_back(ActiveCallNotification{call_id, notification_id}); active_notifications.push_back(ActiveCallNotification{call_id, notification_id});
add_notification(group_id, NotificationGroupType::Calls, dialog_id, G()->unix_time() + 120, dialog_id, false, 0, add_notification(group_id, NotificationGroupType::Calls, dialog_id, G()->unix_time() + 120, dialog_id, false, 0,
notification_id, create_new_call_notification(call_id)); notification_id, create_new_call_notification(call_id), "add_call_notification");
} }
void NotificationManager::remove_call_notification(DialogId dialog_id, CallId call_id) { void NotificationManager::remove_call_notification(DialogId dialog_id, CallId call_id) {
@ -3204,6 +3204,8 @@ void NotificationManager::process_message_push_notification(DialogId dialog_id,
if (!notification_id.is_valid()) { if (!notification_id.is_valid()) {
return promise.set_value(Unit()); return promise.set_value(Unit());
} }
} else {
CHECK(logevent_id != 0);
} }
if (sender_user_id.is_valid() && !td_->contacts_manager_->have_user(sender_user_id)) { if (sender_user_id.is_valid() && !td_->contacts_manager_->have_user(sender_user_id)) {
@ -3239,9 +3241,9 @@ void NotificationManager::process_message_push_notification(DialogId dialog_id,
<< " with arg " << arg << " to " << group_id << " of type " << group_type << " with arg " << arg << " to " << group_id << " of type " << group_type
<< " with settings from " << settings_dialog_id; << " with settings from " << settings_dialog_id;
add_notification( add_notification(group_id, group_type, dialog_id, date, settings_dialog_id, is_silent, 0, notification_id,
group_id, group_type, dialog_id, date, settings_dialog_id, is_silent, 0, notification_id, create_new_push_message_notification(sender_user_id, message_id, std::move(loc_key), std::move(arg)),
create_new_push_message_notification(sender_user_id, message_id, std::move(loc_key), std::move(arg))); "add_push_notification");
} }
Result<int64> NotificationManager::get_push_receiver_id(string payload) { Result<int64> NotificationManager::get_push_receiver_id(string payload) {

View File

@ -65,7 +65,7 @@ class NotificationManager : public Actor {
void add_notification(NotificationGroupId group_id, NotificationGroupType group_type, DialogId dialog_id, int32 date, void add_notification(NotificationGroupId group_id, NotificationGroupType group_type, DialogId dialog_id, int32 date,
DialogId notification_settings_dialog_id, bool is_silent, int32 min_delay_ms, DialogId notification_settings_dialog_id, bool is_silent, int32 min_delay_ms,
NotificationId notification_id, unique_ptr<NotificationType> type); NotificationId notification_id, unique_ptr<NotificationType> type, const char *source);
void edit_notification(NotificationGroupId group_id, NotificationId notification_id, void edit_notification(NotificationGroupId group_id, NotificationId notification_id,
unique_ptr<NotificationType> type); unique_ptr<NotificationType> type);