Add NotificationGroupInfo::set_last_notification.
This commit is contained in:
parent
05b1bec6a9
commit
e667e45985
@ -15420,13 +15420,7 @@ void MessagesManager::remove_dialog_mention_notifications(Dialog *d) {
|
|||||||
bool MessagesManager::set_dialog_last_notification(DialogId dialog_id, NotificationGroupInfo &group_info,
|
bool MessagesManager::set_dialog_last_notification(DialogId dialog_id, NotificationGroupInfo &group_info,
|
||||||
int32 last_notification_date, NotificationId last_notification_id,
|
int32 last_notification_date, NotificationId last_notification_id,
|
||||||
const char *source) {
|
const char *source) {
|
||||||
if (group_info.last_notification_date_ != last_notification_date ||
|
if (group_info.set_last_notification(last_notification_date, last_notification_id, source)) {
|
||||||
group_info.last_notification_id_ != last_notification_id) {
|
|
||||||
VLOG(notifications) << "Set " << group_info.group_id_ << '/' << dialog_id << " last notification to "
|
|
||||||
<< last_notification_id << " sent at " << last_notification_date << " from " << source;
|
|
||||||
group_info.last_notification_date_ = last_notification_date;
|
|
||||||
group_info.last_notification_id_ = last_notification_id;
|
|
||||||
group_info.is_changed_ = true;
|
|
||||||
on_dialog_updated(dialog_id, "set_dialog_last_notification");
|
on_dialog_updated(dialog_id, "set_dialog_last_notification");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,25 @@
|
|||||||
//
|
//
|
||||||
#include "td/telegram/NotificationGroupInfo.h"
|
#include "td/telegram/NotificationGroupInfo.h"
|
||||||
|
|
||||||
|
#include "td/telegram/NotificationManager.h"
|
||||||
|
|
||||||
#include "td/utils/logging.h"
|
#include "td/utils/logging.h"
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
|
bool NotificationGroupInfo::set_last_notification(int32 last_notification_date, NotificationId last_notification_id,
|
||||||
|
const char *source) {
|
||||||
|
if (last_notification_date_ != last_notification_date || last_notification_id_ != last_notification_id) {
|
||||||
|
VLOG(notifications) << "Set " << group_id_ << " last notification to " << last_notification_id << " sent at "
|
||||||
|
<< last_notification_date << " from " << source;
|
||||||
|
last_notification_date_ = last_notification_date;
|
||||||
|
last_notification_id_ = last_notification_id;
|
||||||
|
is_changed_ = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void NotificationGroupInfo::try_reuse() {
|
void NotificationGroupInfo::try_reuse() {
|
||||||
CHECK(group_id_.is_valid());
|
CHECK(group_id_.is_valid());
|
||||||
CHECK(last_notification_date_ == 0);
|
CHECK(last_notification_date_ == 0);
|
||||||
|
@ -29,6 +29,8 @@ class NotificationGroupInfo {
|
|||||||
return group_id_.is_valid() && !try_reuse_;
|
return group_id_.is_valid() && !try_reuse_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool set_last_notification(int32 last_notification_date, NotificationId last_notification_id, const char *source);
|
||||||
|
|
||||||
void try_reuse();
|
void try_reuse();
|
||||||
|
|
||||||
void add_group_key_if_changed(vector<NotificationGroupKey> &group_keys, DialogId dialog_id);
|
void add_group_key_if_changed(vector<NotificationGroupKey> &group_keys, DialogId dialog_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user