Replace is_silent with sound_id in notifications.
This commit is contained in:
parent
b17a05f3fc
commit
3215bb0242
@ -3173,8 +3173,8 @@ notificationSounds notification_sounds:vector<notificationSound> = NotificationS
|
||||
|
||||
|
||||
//@description Contains information about a notification @id Unique persistent identifier of this notification @date Notification date
|
||||
//@is_silent True, if the notification was initially silent @type Notification type
|
||||
notification id:int32 date:int32 is_silent:Bool type:NotificationType = Notification;
|
||||
//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled @type Notification type
|
||||
notification id:int32 date:int32 sound_id:int64 type:NotificationType = Notification;
|
||||
|
||||
//@description Describes a group of notifications @id Unique persistent auto-incremented from 1 identifier of the notification group @type Type of the group
|
||||
//@chat_id Identifier of a chat to which all notifications in the group belong
|
||||
@ -3998,10 +3998,10 @@ updateNotification notification_group_id:int32 notification:notification = Updat
|
||||
//@type New type of the notification group
|
||||
//@chat_id Identifier of a chat to which all notifications in the group belong
|
||||
//@notification_settings_chat_id Chat identifier, which notification settings must be applied to the added notifications
|
||||
//@is_silent True, if the notifications must be shown without sound
|
||||
//@notification_sound_id Identifier of the notification sound to be played; 0 if sound is disabled
|
||||
//@total_count Total number of unread notifications in the group, can be bigger than number of active notifications
|
||||
//@added_notifications List of added group notifications, sorted by notification ID @removed_notification_ids Identifiers of removed group notifications, sorted by notification ID
|
||||
updateNotificationGroup notification_group_id:int32 type:NotificationGroupType chat_id:int53 notification_settings_chat_id:int53 is_silent:Bool total_count:int32 added_notifications:vector<notification> removed_notification_ids:vector<int32> = Update;
|
||||
updateNotificationGroup notification_group_id:int32 type:NotificationGroupType chat_id:int53 notification_settings_chat_id:int53 notification_sound_id:int64 total_count:int32 added_notifications:vector<notification> removed_notification_ids:vector<int32> = Update;
|
||||
|
||||
//@description Contains active notifications that was shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update @groups Lists of active notification groups
|
||||
updateActiveNotifications groups:vector<notificationGroup> = Update;
|
||||
|
@ -21200,6 +21200,16 @@ std::pair<bool, int32> MessagesManager::get_dialog_mute_until(DialogId dialog_id
|
||||
return {d->notification_settings.is_use_default_fixed, get_dialog_mute_until(d)};
|
||||
}
|
||||
|
||||
int64 MessagesManager::get_dialog_notification_ringtone_id(DialogId dialog_id, const Dialog *d) const {
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
if (d == nullptr || !d->notification_settings.is_synchronized || d->notification_settings.use_default_mute_until) {
|
||||
auto scope = get_dialog_notification_setting_scope(dialog_id);
|
||||
return get_notification_sound_ringtone_id(td_->notification_settings_manager_->get_scope_notification_sound(scope));
|
||||
}
|
||||
|
||||
return get_notification_sound_ringtone_id(d->notification_settings.sound);
|
||||
}
|
||||
|
||||
NotificationSettingsScope MessagesManager::get_dialog_notification_setting_scope(DialogId dialog_id) const {
|
||||
switch (dialog_id.get_type()) {
|
||||
case DialogType::User:
|
||||
@ -29929,10 +29939,12 @@ bool MessagesManager::add_new_message_notification(Dialog *d, Message *m, bool f
|
||||
} else if (td_->is_online() && d->is_opened) {
|
||||
min_delay_ms = 1000; // 1 second
|
||||
}
|
||||
auto ringtone_id = get_dialog_notification_ringtone_id(settings_dialog_id, settings_dialog);
|
||||
bool is_silent = m->disable_notification || m->message_id <= d->max_notification_message_id;
|
||||
send_closure_later(G()->notification_manager(), &NotificationManager::add_notification, notification_group_id,
|
||||
from_mentions ? NotificationGroupType::Mentions : NotificationGroupType::Messages, d->dialog_id,
|
||||
m->date, settings_dialog_id, m->disable_notification, is_silent, min_delay_ms, m->notification_id,
|
||||
m->date, settings_dialog_id, m->disable_notification ? 0 : ringtone_id,
|
||||
is_silent ? 0 : ringtone_id, min_delay_ms, m->notification_id,
|
||||
create_new_message_notification(m->message_id), "add_new_message_notification");
|
||||
return true;
|
||||
}
|
||||
@ -35792,9 +35804,10 @@ void MessagesManager::force_create_dialog(DialogId dialog_id, const char *source
|
||||
d->new_secret_chat_notification_id, "add_new_secret_chat");
|
||||
CHECK(is_changed);
|
||||
VLOG(notifications) << "Create " << d->new_secret_chat_notification_id << " with " << secret_chat_id;
|
||||
auto ringtone_id = get_dialog_notification_ringtone_id(dialog_id, d);
|
||||
send_closure_later(G()->notification_manager(), &NotificationManager::add_notification,
|
||||
notification_group_id, NotificationGroupType::SecretChat, dialog_id, date, dialog_id,
|
||||
false, false, 0, d->new_secret_chat_notification_id,
|
||||
ringtone_id, ringtone_id, 0, d->new_secret_chat_notification_id,
|
||||
create_new_secret_chat_notification(), "add_new_secret_chat_notification");
|
||||
}
|
||||
}
|
||||
|
@ -2841,6 +2841,8 @@ class MessagesManager final : public Actor {
|
||||
|
||||
std::pair<bool, int32> get_dialog_mute_until(DialogId dialog_id, const Dialog *d) const;
|
||||
|
||||
int64 get_dialog_notification_ringtone_id(DialogId dialog_id, const Dialog *d) const;
|
||||
|
||||
NotificationSettingsScope get_dialog_notification_setting_scope(DialogId dialog_id) const;
|
||||
|
||||
DialogNotificationSettings *get_dialog_notification_settings(DialogId dialog_id, bool force);
|
||||
|
@ -20,11 +20,11 @@ class Notification {
|
||||
public:
|
||||
NotificationId notification_id;
|
||||
int32 date = 0;
|
||||
bool is_silent = false;
|
||||
int64 ringtone_id = -1;
|
||||
unique_ptr<NotificationType> type;
|
||||
|
||||
Notification(NotificationId notification_id, int32 date, bool is_silent, unique_ptr<NotificationType> type)
|
||||
: notification_id(notification_id), date(date), is_silent(is_silent), type(std::move(type)) {
|
||||
Notification(NotificationId notification_id, int32 date, int64 ringtone_id, unique_ptr<NotificationType> type)
|
||||
: notification_id(notification_id), date(date), ringtone_id(ringtone_id), type(std::move(type)) {
|
||||
}
|
||||
};
|
||||
|
||||
@ -32,13 +32,13 @@ inline td_api::object_ptr<td_api::notification> get_notification_object(DialogId
|
||||
const Notification ¬ification) {
|
||||
CHECK(notification.type != nullptr);
|
||||
return td_api::make_object<td_api::notification>(notification.notification_id.get(), notification.date,
|
||||
notification.is_silent,
|
||||
notification.ringtone_id,
|
||||
notification.type->get_notification_type_object(dialog_id));
|
||||
}
|
||||
|
||||
inline StringBuilder &operator<<(StringBuilder &sb, const Notification ¬ification) {
|
||||
return sb << "notification[" << notification.notification_id << ", " << notification.date << ", "
|
||||
<< notification.is_silent << ", " << *notification.type << ']';
|
||||
<< notification.ringtone_id << ", " << *notification.type << ']';
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -855,7 +855,7 @@ int32 NotificationManager::get_notification_delay_ms(DialogId dialog_id, const P
|
||||
|
||||
void NotificationManager::add_notification(NotificationGroupId group_id, NotificationGroupType group_type,
|
||||
DialogId dialog_id, int32 date, DialogId notification_settings_dialog_id,
|
||||
bool initial_is_silent, bool is_silent, int32 min_delay_ms,
|
||||
int64 initial_ringtone_id, int64 ringtone_id, int32 min_delay_ms,
|
||||
NotificationId notification_id, unique_ptr<NotificationType> type,
|
||||
const char *source) {
|
||||
if (is_disabled() || max_notification_group_count_ == 0) {
|
||||
@ -870,7 +870,7 @@ void NotificationManager::add_notification(NotificationGroupId group_id, Notific
|
||||
CHECK(type != nullptr);
|
||||
VLOG(notifications) << "Add " << notification_id << " to " << group_id << " of type " << group_type << " in "
|
||||
<< dialog_id << " with settings from " << notification_settings_dialog_id
|
||||
<< (is_silent ? " silently" : " with sound") << ": " << *type;
|
||||
<< (ringtone_id == 0 ? " silently" : " with sound") << ": " << *type;
|
||||
|
||||
if (!type->is_temporary()) {
|
||||
remove_temporary_notifications(group_id, "add_notification");
|
||||
@ -904,8 +904,8 @@ void NotificationManager::add_notification(NotificationGroupId group_id, Notific
|
||||
PendingNotification notification;
|
||||
notification.date = date;
|
||||
notification.settings_dialog_id = notification_settings_dialog_id;
|
||||
notification.initial_is_silent = initial_is_silent;
|
||||
notification.is_silent = is_silent;
|
||||
notification.initial_ringtone_id = initial_ringtone_id;
|
||||
notification.ringtone_id = ringtone_id;
|
||||
notification.notification_id = notification_id;
|
||||
notification.type = std::move(type);
|
||||
|
||||
@ -943,8 +943,9 @@ StringBuilder &operator<<(StringBuilder &string_builder, const NotificationManag
|
||||
return string_builder << "update[" << NotificationGroupId(p->notification_group_id_) << " of type "
|
||||
<< get_notification_group_type(p->type_) << " from " << DialogId(p->chat_id_)
|
||||
<< " with settings from " << DialogId(p->notification_settings_chat_id_)
|
||||
<< (p->is_silent_ ? " silently" : " with sound") << "; total_count = " << p->total_count_
|
||||
<< ", add " << added_notification_ids << ", remove " << p->removed_notification_ids_;
|
||||
<< (p->notification_sound_id_ == 0 ? " silently" : " with sound")
|
||||
<< "; total_count = " << p->total_count_ << ", add " << added_notification_ids
|
||||
<< ", remove " << p->removed_notification_ids_;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@ -1142,8 +1143,8 @@ void NotificationManager::flush_pending_updates(int32 group_id, const char *sour
|
||||
first_add_notification_pos[notification_id] = cur_pos;
|
||||
}
|
||||
td::remove_if(update_ptr->added_notifications_, [](auto ¬ification) { return notification == nullptr; });
|
||||
if (update_ptr->added_notifications_.empty() && !update_ptr->is_silent_) {
|
||||
update_ptr->is_silent_ = true;
|
||||
if (update_ptr->added_notifications_.empty() && update_ptr->notification_sound_id_ != 0) {
|
||||
update_ptr->notification_sound_id_ = 0;
|
||||
is_changed = true;
|
||||
}
|
||||
|
||||
@ -1294,15 +1295,13 @@ void NotificationManager::flush_pending_updates(int32 group_id, const char *sour
|
||||
if ((last_update_ptr->notification_settings_chat_id_ == update_ptr->notification_settings_chat_id_ ||
|
||||
last_update_ptr->added_notifications_.empty()) &&
|
||||
!has_common_notifications(last_update_ptr->added_notifications_, update_ptr->removed_notification_ids_) &&
|
||||
!has_common_notifications(update_ptr->added_notifications_, last_update_ptr->removed_notification_ids_)) {
|
||||
!has_common_notifications(update_ptr->added_notifications_, last_update_ptr->removed_notification_ids_) &&
|
||||
last_update_ptr->notification_sound_id_ == update_ptr->notification_sound_id_) {
|
||||
// combine updates
|
||||
VLOG(notifications) << "Combine " << as_notification_update(last_update_ptr) << " and "
|
||||
<< as_notification_update(update_ptr);
|
||||
CHECK(last_update_ptr->notification_group_id_ == update_ptr->notification_group_id_);
|
||||
CHECK(last_update_ptr->chat_id_ == update_ptr->chat_id_);
|
||||
if (last_update_ptr->is_silent_ && !update_ptr->is_silent_) {
|
||||
last_update_ptr->is_silent_ = false;
|
||||
}
|
||||
last_update_ptr->notification_settings_chat_id_ = update_ptr->notification_settings_chat_id_;
|
||||
last_update_ptr->type_ = std::move(update_ptr->type_);
|
||||
last_update_ptr->total_count_ = update_ptr->total_count_;
|
||||
@ -1393,7 +1392,7 @@ bool NotificationManager::do_flush_pending_notifications(NotificationGroupKey &g
|
||||
added_notifications.reserve(pending_notifications.size());
|
||||
for (auto &pending_notification : pending_notifications) {
|
||||
Notification notification(pending_notification.notification_id, pending_notification.date,
|
||||
pending_notification.initial_is_silent, std::move(pending_notification.type));
|
||||
pending_notification.initial_ringtone_id, std::move(pending_notification.type));
|
||||
added_notifications.push_back(get_notification_object(group_key.dialog_id, notification));
|
||||
CHECK(added_notifications.back()->type_ != nullptr);
|
||||
|
||||
@ -1421,7 +1420,7 @@ bool NotificationManager::do_flush_pending_notifications(NotificationGroupKey &g
|
||||
if (!added_notifications.empty()) {
|
||||
add_update_notification_group(td_api::make_object<td_api::updateNotificationGroup>(
|
||||
group_key.group_id.get(), get_notification_group_type_object(group.type), group_key.dialog_id.get(),
|
||||
pending_notifications[0].settings_dialog_id.get(), pending_notifications[0].is_silent, group.total_count,
|
||||
pending_notifications[0].settings_dialog_id.get(), pending_notifications[0].ringtone_id, group.total_count,
|
||||
std::move(added_notifications), std::move(removed_notification_ids)));
|
||||
} else {
|
||||
CHECK(removed_notification_ids.empty());
|
||||
@ -1524,7 +1523,7 @@ void NotificationManager::flush_pending_notifications(NotificationGroupId group_
|
||||
group.total_count += narrow_cast<int32>(group.pending_notifications.size());
|
||||
for (auto &pending_notification : group.pending_notifications) {
|
||||
group.notifications.emplace_back(pending_notification.notification_id, pending_notification.date,
|
||||
pending_notification.initial_is_silent, std::move(pending_notification.type));
|
||||
pending_notification.initial_ringtone_id, std::move(pending_notification.type));
|
||||
}
|
||||
} else {
|
||||
if (!was_updated) {
|
||||
@ -1537,18 +1536,18 @@ void NotificationManager::flush_pending_notifications(NotificationGroupId group_
|
||||
}
|
||||
|
||||
DialogId notification_settings_dialog_id;
|
||||
bool is_silent = false;
|
||||
int64 ringtone_id = -1;
|
||||
|
||||
// split notifications by groups with common settings
|
||||
vector<PendingNotification> grouped_notifications;
|
||||
for (auto &pending_notification : group.pending_notifications) {
|
||||
if (notification_settings_dialog_id != pending_notification.settings_dialog_id ||
|
||||
is_silent != pending_notification.is_silent) {
|
||||
ringtone_id != pending_notification.ringtone_id) {
|
||||
if (do_flush_pending_notifications(group_key, group, grouped_notifications)) {
|
||||
force_update = true;
|
||||
}
|
||||
notification_settings_dialog_id = pending_notification.settings_dialog_id;
|
||||
is_silent = pending_notification.is_silent;
|
||||
ringtone_id = pending_notification.ringtone_id;
|
||||
}
|
||||
grouped_notifications.push_back(std::move(pending_notification));
|
||||
}
|
||||
@ -3438,10 +3437,13 @@ Status NotificationManager::process_push_notification_payload(string payload, bo
|
||||
std::move(promise));
|
||||
} else {
|
||||
bool is_from_scheduled = has_json_object_field(custom, "schedule");
|
||||
bool is_silent = has_json_object_field(custom, "silent");
|
||||
int64 ringtone_id = -1;
|
||||
if (has_json_object_field(custom, "silent")) {
|
||||
ringtone_id = 0;
|
||||
}
|
||||
add_message_push_notification(dialog_id, MessageId(server_message_id), random_id, sender_user_id, sender_dialog_id,
|
||||
std::move(sender_name), sent_date, is_from_scheduled, contains_mention, is_silent,
|
||||
is_silent, std::move(loc_key), std::move(arg), std::move(attached_photo),
|
||||
std::move(sender_name), sent_date, is_from_scheduled, contains_mention, ringtone_id,
|
||||
ringtone_id, std::move(loc_key), std::move(arg), std::move(attached_photo),
|
||||
std::move(attached_document), NotificationId(), 0, std::move(promise));
|
||||
}
|
||||
return Status::OK();
|
||||
@ -3458,7 +3460,7 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
||||
int32 date_;
|
||||
bool is_from_scheduled_;
|
||||
bool contains_mention_;
|
||||
bool is_silent_;
|
||||
int64 ringtone_id_;
|
||||
string loc_key_;
|
||||
string arg_;
|
||||
Photo photo_;
|
||||
@ -3475,9 +3477,11 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
||||
bool has_photo = !photo_.is_empty();
|
||||
bool has_document = !document_.empty();
|
||||
bool has_sender_dialog_id = sender_dialog_id_.is_valid();
|
||||
bool is_silent = ringtone_id_ == 0;
|
||||
bool has_ringtone_id = !is_silent && ringtone_id_ != -1;
|
||||
BEGIN_STORE_FLAGS();
|
||||
STORE_FLAG(contains_mention_);
|
||||
STORE_FLAG(is_silent_);
|
||||
STORE_FLAG(is_silent);
|
||||
STORE_FLAG(has_message_id);
|
||||
STORE_FLAG(has_random_id);
|
||||
STORE_FLAG(has_sender);
|
||||
@ -3487,6 +3491,7 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
||||
STORE_FLAG(has_document);
|
||||
STORE_FLAG(is_from_scheduled_);
|
||||
STORE_FLAG(has_sender_dialog_id);
|
||||
STORE_FLAG(has_ringtone_id);
|
||||
END_STORE_FLAGS();
|
||||
td::store(dialog_id_, storer);
|
||||
if (has_message_id) {
|
||||
@ -3516,6 +3521,9 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
||||
if (has_sender_dialog_id) {
|
||||
td::store(sender_dialog_id_, storer);
|
||||
}
|
||||
if (has_ringtone_id) {
|
||||
td::store(ringtone_id_, storer);
|
||||
}
|
||||
}
|
||||
|
||||
template <class ParserT>
|
||||
@ -3528,9 +3536,11 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
||||
bool has_photo;
|
||||
bool has_document;
|
||||
bool has_sender_dialog_id;
|
||||
bool is_silent;
|
||||
bool has_ringtone_id;
|
||||
BEGIN_PARSE_FLAGS();
|
||||
PARSE_FLAG(contains_mention_);
|
||||
PARSE_FLAG(is_silent_);
|
||||
PARSE_FLAG(is_silent);
|
||||
PARSE_FLAG(has_message_id);
|
||||
PARSE_FLAG(has_random_id);
|
||||
PARSE_FLAG(has_sender);
|
||||
@ -3540,6 +3550,7 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
||||
PARSE_FLAG(has_document);
|
||||
PARSE_FLAG(is_from_scheduled_);
|
||||
PARSE_FLAG(has_sender_dialog_id);
|
||||
PARSE_FLAG(has_ringtone_id);
|
||||
END_PARSE_FLAGS();
|
||||
td::parse(dialog_id_, parser);
|
||||
if (has_message_id) {
|
||||
@ -3571,16 +3582,21 @@ class NotificationManager::AddMessagePushNotificationLogEvent {
|
||||
if (has_sender_dialog_id) {
|
||||
td::parse(sender_dialog_id_, parser);
|
||||
}
|
||||
if (has_ringtone_id) {
|
||||
td::parse(ringtone_id_, parser);
|
||||
} else {
|
||||
ringtone_id_ = is_silent ? 0 : -1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void NotificationManager::add_message_push_notification(DialogId dialog_id, MessageId message_id, int64 random_id,
|
||||
UserId sender_user_id, DialogId sender_dialog_id,
|
||||
string sender_name, int32 date, bool is_from_scheduled,
|
||||
bool contains_mention, bool initial_is_silent, bool is_silent,
|
||||
string loc_key, string arg, Photo photo, Document document,
|
||||
NotificationId notification_id, uint64 log_event_id,
|
||||
Promise<Unit> promise) {
|
||||
bool contains_mention, int64 initial_ringtone_id,
|
||||
int64 ringtone_id, string loc_key, string arg, Photo photo,
|
||||
Document document, NotificationId notification_id,
|
||||
uint64 log_event_id, Promise<Unit> promise) {
|
||||
auto is_pinned = begins_with(loc_key, "PINNED_");
|
||||
auto r_info = td_->messages_manager_->get_message_push_notification_info(
|
||||
dialog_id, message_id, random_id, sender_user_id, sender_dialog_id, date, is_from_scheduled, contains_mention,
|
||||
@ -3643,7 +3659,7 @@ void NotificationManager::add_message_push_notification(DialogId dialog_id, Mess
|
||||
if (log_event_id == 0 && G()->parameters().use_message_db) {
|
||||
AddMessagePushNotificationLogEvent log_event{
|
||||
dialog_id, message_id, random_id, sender_user_id, sender_dialog_id, sender_name,
|
||||
date, is_from_scheduled, contains_mention, initial_is_silent, loc_key, arg,
|
||||
date, is_from_scheduled, contains_mention, initial_ringtone_id, loc_key, arg,
|
||||
photo, document, notification_id};
|
||||
log_event_id = binlog_add(G()->td_db()->get_binlog(), LogEvent::HandlerType::AddMessagePushNotification,
|
||||
get_log_event_storer(log_event));
|
||||
@ -3672,7 +3688,7 @@ void NotificationManager::add_message_push_notification(DialogId dialog_id, Mess
|
||||
<< group_type << " with settings from " << settings_dialog_id;
|
||||
|
||||
add_notification(
|
||||
group_id, group_type, dialog_id, date, settings_dialog_id, initial_is_silent, is_silent, 0, notification_id,
|
||||
group_id, group_type, dialog_id, date, settings_dialog_id, initial_ringtone_id, ringtone_id, 0, notification_id,
|
||||
create_new_push_message_notification(sender_user_id, sender_dialog_id, sender_name, is_outgoing, message_id,
|
||||
std::move(loc_key), std::move(arg), std::move(photo), std::move(document)),
|
||||
"add_message_push_notification");
|
||||
@ -4125,7 +4141,7 @@ void NotificationManager::on_binlog_events(vector<BinlogEvent> &&events) {
|
||||
add_message_push_notification(
|
||||
log_event.dialog_id_, log_event.message_id_, log_event.random_id_, log_event.sender_user_id_,
|
||||
log_event.sender_dialog_id_, log_event.sender_name_, log_event.date_, log_event.is_from_scheduled_,
|
||||
log_event.contains_mention_, log_event.is_silent_, true, log_event.loc_key_, log_event.arg_,
|
||||
log_event.contains_mention_, log_event.ringtone_id_, 0, log_event.loc_key_, log_event.arg_,
|
||||
log_event.photo_, log_event.document_, log_event.notification_id_, event.id_,
|
||||
PromiseCreator::lambda([](Result<Unit> result) {
|
||||
if (result.is_error() && result.error().code() != 200 && result.error().code() != 406) {
|
||||
|
@ -67,7 +67,7 @@ class NotificationManager final : public Actor {
|
||||
void load_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 initial_is_silent, bool is_silent,
|
||||
DialogId notification_settings_dialog_id, int64 initial_ringtone_id, int64 ringtone_id,
|
||||
int32 min_delay_ms, NotificationId notification_id, unique_ptr<NotificationType> type,
|
||||
const char *source);
|
||||
|
||||
@ -161,8 +161,8 @@ class NotificationManager final : public Actor {
|
||||
struct PendingNotification {
|
||||
int32 date = 0;
|
||||
DialogId settings_dialog_id;
|
||||
bool initial_is_silent = false;
|
||||
bool is_silent = false;
|
||||
int64 initial_ringtone_id = -1;
|
||||
int64 ringtone_id = -1;
|
||||
NotificationId notification_id;
|
||||
unique_ptr<NotificationType> type;
|
||||
|
||||
@ -170,7 +170,7 @@ class NotificationManager final : public Actor {
|
||||
return string_builder << "PendingNotification[" << pending_notification.notification_id << " of type "
|
||||
<< pending_notification.type << " sent at " << pending_notification.date
|
||||
<< " with settings from " << pending_notification.settings_dialog_id
|
||||
<< ", is_silent = " << pending_notification.is_silent << "]";
|
||||
<< ", ringtone_id = " << pending_notification.ringtone_id << "]";
|
||||
}
|
||||
};
|
||||
|
||||
@ -313,9 +313,9 @@ class NotificationManager final : public Actor {
|
||||
|
||||
void add_message_push_notification(DialogId dialog_id, MessageId message_id, int64 random_id, UserId sender_user_id,
|
||||
DialogId sender_dialog_id, string sender_name, int32 date, bool is_from_scheduled,
|
||||
bool contains_mention, bool initial_is_silent, bool is_silent, string loc_key,
|
||||
string arg, Photo photo, Document document, NotificationId notification_id,
|
||||
uint64 log_event_id, Promise<Unit> promise);
|
||||
bool contains_mention, int64 initial_ringtone_id, int64 ringtone_id,
|
||||
string loc_key, string arg, Photo photo, Document document,
|
||||
NotificationId notification_id, uint64 log_event_id, Promise<Unit> promise);
|
||||
|
||||
void edit_message_push_notification(DialogId dialog_id, MessageId message_id, int32 edit_date, string loc_key,
|
||||
string arg, Photo photo, Document document, uint64 log_event_id,
|
||||
|
@ -534,6 +534,11 @@ int32 NotificationSettingsManager::get_scope_mute_until(NotificationSettingsScop
|
||||
return get_scope_notification_settings(scope)->mute_until;
|
||||
}
|
||||
|
||||
const unique_ptr<NotificationSound> &NotificationSettingsManager::get_scope_notification_sound(
|
||||
NotificationSettingsScope scope) const {
|
||||
return get_scope_notification_settings(scope)->sound;
|
||||
}
|
||||
|
||||
bool NotificationSettingsManager::get_scope_disable_pinned_message_notifications(
|
||||
NotificationSettingsScope scope) const {
|
||||
return get_scope_notification_settings(scope)->disable_pinned_message_notifications;
|
||||
|
@ -40,6 +40,8 @@ class NotificationSettingsManager final : public Actor {
|
||||
|
||||
int32 get_scope_mute_until(NotificationSettingsScope scope) const;
|
||||
|
||||
const unique_ptr<NotificationSound> &get_scope_notification_sound(NotificationSettingsScope scope) const;
|
||||
|
||||
bool get_scope_disable_pinned_message_notifications(NotificationSettingsScope scope) const;
|
||||
|
||||
bool get_scope_disable_mention_notifications(NotificationSettingsScope scope) const;
|
||||
|
Loading…
Reference in New Issue
Block a user