2022-10-25 00:22:04 +02:00
|
|
|
//
|
2022-12-31 22:28:08 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
|
2022-10-25 00:22:04 +02:00
|
|
|
//
|
|
|
|
// 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)
|
|
|
|
//
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "td/telegram/NotificationSound.h"
|
|
|
|
#include "td/telegram/td_api.h"
|
|
|
|
#include "td/telegram/telegram_api.h"
|
|
|
|
|
|
|
|
#include "td/utils/common.h"
|
|
|
|
#include "td/utils/Status.h"
|
|
|
|
#include "td/utils/StringBuilder.h"
|
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
class ScopeNotificationSettings {
|
|
|
|
public:
|
|
|
|
int32 mute_until = 0;
|
|
|
|
unique_ptr<NotificationSound> sound;
|
2023-06-27 17:30:05 +02:00
|
|
|
unique_ptr<NotificationSound> story_sound;
|
2022-10-25 00:22:04 +02:00
|
|
|
bool show_preview = true;
|
2023-06-12 18:41:18 +02:00
|
|
|
bool mute_stories = false;
|
2023-06-27 17:30:05 +02:00
|
|
|
bool hide_story_sender = false;
|
2022-10-25 00:22:04 +02:00
|
|
|
bool is_synchronized = false;
|
|
|
|
|
|
|
|
// local settings
|
|
|
|
bool disable_pinned_message_notifications = false;
|
|
|
|
bool disable_mention_notifications = false;
|
|
|
|
|
|
|
|
ScopeNotificationSettings() = default;
|
|
|
|
|
|
|
|
ScopeNotificationSettings(int32 mute_until, unique_ptr<NotificationSound> &&sound, bool show_preview,
|
2023-06-27 17:30:05 +02:00
|
|
|
bool mute_stories, unique_ptr<NotificationSound> &&story_sound, bool hide_story_sender,
|
|
|
|
bool disable_pinned_message_notifications, bool disable_mention_notifications)
|
2022-10-25 00:22:04 +02:00
|
|
|
: mute_until(mute_until)
|
|
|
|
, sound(std::move(sound))
|
2023-06-27 17:30:05 +02:00
|
|
|
, story_sound(std::move(story_sound))
|
2022-10-25 00:22:04 +02:00
|
|
|
, show_preview(show_preview)
|
2023-06-12 18:41:18 +02:00
|
|
|
, mute_stories(mute_stories)
|
2023-06-27 17:30:05 +02:00
|
|
|
, hide_story_sender(hide_story_sender)
|
2022-10-25 00:22:04 +02:00
|
|
|
, is_synchronized(true)
|
|
|
|
, disable_pinned_message_notifications(disable_pinned_message_notifications)
|
|
|
|
, disable_mention_notifications(disable_mention_notifications) {
|
|
|
|
}
|
2023-06-09 14:08:00 +02:00
|
|
|
|
|
|
|
telegram_api::object_ptr<telegram_api::inputPeerNotifySettings> get_input_peer_notify_settings() const;
|
2022-10-25 00:22:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
StringBuilder &operator<<(StringBuilder &string_builder, const ScopeNotificationSettings ¬ification_settings);
|
|
|
|
|
|
|
|
td_api::object_ptr<td_api::scopeNotificationSettings> get_scope_notification_settings_object(
|
|
|
|
const ScopeNotificationSettings *notification_settings);
|
|
|
|
|
|
|
|
Result<ScopeNotificationSettings> get_scope_notification_settings(
|
|
|
|
td_api::object_ptr<td_api::scopeNotificationSettings> &¬ification_settings);
|
|
|
|
|
|
|
|
ScopeNotificationSettings get_scope_notification_settings(tl_object_ptr<telegram_api::peerNotifySettings> &&settings,
|
|
|
|
bool old_disable_pinned_message_notifications,
|
|
|
|
bool old_disable_mention_notifications);
|
|
|
|
|
|
|
|
} // namespace td
|