summaryrefslogtreecommitdiff
path: root/protocols/Telegram/tdlib/td/td/telegram/NotificationSettingsManager.h
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/tdlib/td/td/telegram/NotificationSettingsManager.h')
-rw-r--r--protocols/Telegram/tdlib/td/td/telegram/NotificationSettingsManager.h39
1 files changed, 35 insertions, 4 deletions
diff --git a/protocols/Telegram/tdlib/td/td/telegram/NotificationSettingsManager.h b/protocols/Telegram/tdlib/td/td/telegram/NotificationSettingsManager.h
index 95d2c7728f..09d97d999f 100644
--- a/protocols/Telegram/tdlib/td/td/telegram/NotificationSettingsManager.h
+++ b/protocols/Telegram/tdlib/td/td/telegram/NotificationSettingsManager.h
@@ -1,5 +1,5 @@
//
-// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
+// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2024
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -10,9 +10,10 @@
#include "td/telegram/DialogNotificationSettings.h"
#include "td/telegram/files/FileId.h"
#include "td/telegram/files/FileSourceId.h"
-#include "td/telegram/FullMessageId.h"
+#include "td/telegram/MessageFullId.h"
#include "td/telegram/MessageId.h"
#include "td/telegram/NotificationSettingsScope.h"
+#include "td/telegram/ReactionNotificationSettings.h"
#include "td/telegram/ScopeNotificationSettings.h"
#include "td/telegram/td_api.h"
#include "td/telegram/telegram_api.h"
@@ -26,6 +27,7 @@
#include "td/utils/Status.h"
#include <memory>
+#include <utility>
namespace td {
@@ -46,10 +48,16 @@ class NotificationSettingsManager final : public Actor {
int32 get_scope_mute_until(NotificationSettingsScope scope) const;
+ std::pair<bool, bool> get_scope_mute_stories(NotificationSettingsScope scope) const;
+
const unique_ptr<NotificationSound> &get_scope_notification_sound(NotificationSettingsScope scope) const;
+ const unique_ptr<NotificationSound> &get_scope_story_notification_sound(NotificationSettingsScope scope) const;
+
bool get_scope_show_preview(NotificationSettingsScope scope) const;
+ bool get_scope_hide_story_sender(NotificationSettingsScope scope) const;
+
bool get_scope_disable_pinned_message_notifications(NotificationSettingsScope scope) const;
bool get_scope_disable_mention_notifications(NotificationSettingsScope scope) const;
@@ -60,6 +68,8 @@ class NotificationSettingsManager final : public Actor {
void on_update_scope_notify_settings(NotificationSettingsScope scope,
tl_object_ptr<telegram_api::peerNotifySettings> &&peer_notify_settings);
+ void on_update_reaction_notification_settings(ReactionNotificationSettings reaction_notification_settings);
+
void add_saved_ringtone(td_api::object_ptr<td_api::InputFile> &&input_file,
Promise<td_api::object_ptr<td_api::notificationSound>> &&promise);
@@ -85,6 +95,8 @@ class NotificationSettingsManager final : public Actor {
Promise<Unit> &&promise);
void send_get_scope_notification_settings_query(NotificationSettingsScope scope, Promise<Unit> &&promise);
+ void send_get_reaction_notification_settings_query(Promise<Unit> &&promise);
+
void on_get_dialog_notification_settings_query_finished(DialogId dialog_id, MessageId top_thread_message_id,
Status &&status);
@@ -95,6 +107,8 @@ class NotificationSettingsManager final : public Actor {
td_api::object_ptr<td_api::scopeNotificationSettings> &&notification_settings)
TD_WARN_UNUSED_RESULT;
+ Status set_reaction_notification_settings(ReactionNotificationSettings &&notification_settings) TD_WARN_UNUSED_RESULT;
+
void reset_scope_notification_settings();
void reset_notify_settings(Promise<Unit> &&promise);
@@ -102,6 +116,8 @@ class NotificationSettingsManager final : public Actor {
void get_notify_settings_exceptions(NotificationSettingsScope scope, bool filter_scope, bool compare_sound,
Promise<Unit> &&promise);
+ void get_story_notification_settings_exceptions(Promise<td_api::object_ptr<td_api::chats>> &&promise);
+
void init();
void on_binlog_events(vector<BinlogEvent> &&events);
@@ -110,6 +126,7 @@ class NotificationSettingsManager final : public Actor {
private:
class UpdateScopeNotificationSettingsOnServerLogEvent;
+ class UpdateReactionNotificationSettingsOnServerLogEvent;
class RingtoneListLogEvent;
@@ -163,6 +180,9 @@ class NotificationSettingsManager final : public Actor {
td_api::object_ptr<td_api::updateScopeNotificationSettings> get_update_scope_notification_settings_object(
NotificationSettingsScope scope) const;
+ td_api::object_ptr<td_api::updateReactionNotificationSettings> get_update_reaction_notification_settings_object()
+ const;
+
td_api::object_ptr<td_api::updateSavedNotificationSounds> get_update_saved_notification_sounds_object() const;
void on_scope_unmute(NotificationSettingsScope scope);
@@ -179,10 +199,18 @@ class NotificationSettingsManager final : public Actor {
void update_scope_notification_settings_on_server(NotificationSettingsScope scope, uint64 log_event_id);
- void schedule_scope_unmute(NotificationSettingsScope scope, int32 mute_until);
+ void schedule_scope_unmute(NotificationSettingsScope scope, int32 mute_until, int32 unix_time);
void update_scope_unmute_timeout(NotificationSettingsScope scope, int32 &old_mute_until, int32 new_mute_until);
+ static string get_reaction_notification_settings_database_key();
+
+ void save_reaction_notification_settings() const;
+
+ uint64 save_update_reaction_notification_settings_on_server_log_event();
+
+ void update_reaction_notification_settings_on_server(uint64 log_event_id);
+
Td *td_;
ActorShared<> parent_;
@@ -194,6 +222,9 @@ class NotificationSettingsManager final : public Actor {
ScopeNotificationSettings chats_notification_settings_;
ScopeNotificationSettings channels_notification_settings_;
+ ReactionNotificationSettings reaction_notification_settings_;
+ bool have_reaction_notification_settings_ = false;
+
MultiTimeout scope_unmute_timeout_{"ScopeUnmuteTimeout"};
int64 saved_ringtone_hash_ = 0;
@@ -216,7 +247,7 @@ class NotificationSettingsManager final : public Actor {
vector<Promise<Unit>> reload_saved_ringtones_queries_;
vector<Promise<Unit>> repair_saved_ringtones_queries_;
- FlatHashMap<FullMessageId, vector<Promise<Unit>>, FullMessageIdHash> get_dialog_notification_settings_queries_;
+ FlatHashMap<MessageFullId, vector<Promise<Unit>>, MessageFullIdHash> get_dialog_notification_settings_queries_;
};
} // namespace td