Disable delay for call and new secret chat notifications.
GitOrigin-RevId: a2c4baa804c84503c7c073dc1b6efae6d0590bc1
This commit is contained in:
parent
a86a9d2a00
commit
b623357695
|
@ -116,6 +116,9 @@ int32 NotificationManager::get_notification_delay_ms(DialogId dialog_id,
|
||||||
if (dialog_id.get_type() == DialogType::SecretChat) {
|
if (dialog_id.get_type() == DialogType::SecretChat) {
|
||||||
return 0; // there is no reason to delay notifications in secret chats
|
return 0; // there is no reason to delay notifications in secret chats
|
||||||
}
|
}
|
||||||
|
if (!notification.type->can_be_delayed()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
auto online_info = td_->contacts_manager_->get_my_online_status();
|
auto online_info = td_->contacts_manager_->get_my_online_status();
|
||||||
if (!online_info.is_online_local && online_info.is_online_remote) {
|
if (!online_info.is_online_local && online_info.is_online_remote) {
|
||||||
|
|
|
@ -12,6 +12,10 @@
|
||||||
namespace td {
|
namespace td {
|
||||||
|
|
||||||
class NotificationTypeMessage : public NotificationType {
|
class NotificationTypeMessage : public NotificationType {
|
||||||
|
bool can_be_delayed() const override {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const override {
|
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const override {
|
||||||
auto message_object = G()->td().get_actor_unsafe()->messages_manager_->get_message_object({dialog_id, message_id_});
|
auto message_object = G()->td().get_actor_unsafe()->messages_manager_->get_message_object({dialog_id, message_id_});
|
||||||
if (message_object == nullptr) {
|
if (message_object == nullptr) {
|
||||||
|
@ -36,6 +40,10 @@ class NotificationTypeMessage : public NotificationType {
|
||||||
};
|
};
|
||||||
|
|
||||||
class NotificationTypeSecretChat : public NotificationType {
|
class NotificationTypeSecretChat : public NotificationType {
|
||||||
|
bool can_be_delayed() const override {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const override {
|
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const override {
|
||||||
return td_api::make_object<td_api::notificationTypeNewSecretChat>();
|
return td_api::make_object<td_api::notificationTypeNewSecretChat>();
|
||||||
}
|
}
|
||||||
|
@ -54,6 +62,10 @@ class NotificationTypeSecretChat : public NotificationType {
|
||||||
};
|
};
|
||||||
|
|
||||||
class NotificationTypeCall : public NotificationType {
|
class NotificationTypeCall : public NotificationType {
|
||||||
|
bool can_be_delayed() const override {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const override {
|
td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const override {
|
||||||
return td_api::make_object<td_api::notificationTypeNewCall>(call_id_.get());
|
return td_api::make_object<td_api::notificationTypeNewCall>(call_id_.get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@ class NotificationType {
|
||||||
virtual ~NotificationType() {
|
virtual ~NotificationType() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual bool can_be_delayed() const = 0;
|
||||||
|
|
||||||
virtual td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const = 0;
|
virtual td_api::object_ptr<td_api::NotificationType> get_notification_type_object(DialogId dialog_id) const = 0;
|
||||||
|
|
||||||
virtual StringBuilder &to_string_builder(StringBuilder &string_builder) const = 0;
|
virtual StringBuilder &to_string_builder(StringBuilder &string_builder) const = 0;
|
||||||
|
|
Reference in New Issue
Block a user