Add and use NotificationManager::have_group_force.

This commit is contained in:
levlam 2023-08-23 19:16:57 +03:00
parent 2fc806785f
commit fbc74dc8f4
3 changed files with 12 additions and 2 deletions

View File

@ -28944,7 +28944,7 @@ NotificationGroupId MessagesManager::get_dialog_notification_group_id(DialogId d
if (!next_notification_group_id.is_valid()) {
return NotificationGroupId();
}
} while (get_message_notification_group_force(next_notification_group_id).dialog_id.is_valid());
} while (td_->notification_manager_->have_group_force(next_notification_group_id));
group_info = NotificationGroupInfo(next_notification_group_id);
VLOG(notifications) << "Assign " << next_notification_group_id << " to " << dialog_id;
on_dialog_updated(dialog_id, "get_dialog_notification_group_id");

View File

@ -392,10 +392,18 @@ void NotificationManager::load_group_force(NotificationGroupId group_id) {
return;
}
auto group_it = get_group_force(group_id, true);
auto group_it = get_group_force(group_id);
CHECK(group_it != groups_.end());
}
bool NotificationManager::have_group_force(NotificationGroupId group_id) {
if (is_disabled()) {
return false;
}
return td::contains(call_notification_group_ids_, group_id) || get_group_force(group_id) != groups_.end();
}
NotificationManager::NotificationGroups::iterator NotificationManager::get_group_force(NotificationGroupId group_id,
bool send_update) {
auto group_it = get_group(group_id);

View File

@ -67,6 +67,8 @@ class NotificationManager final : public Actor {
void load_group_force(NotificationGroupId group_id);
bool have_group_force(NotificationGroupId group_id);
void add_notification(NotificationGroupId group_id, NotificationGroupType group_type, DialogId dialog_id, int32 date,
DialogId notification_settings_dialog_id, bool disable_notification, int64 ringtone_id,
int32 min_delay_ms, NotificationId notification_id, unique_ptr<NotificationType> type,