Add scopeNotificationSettings.mute_stories.
This commit is contained in:
parent
686f0eabe6
commit
0791baa6c1
@ -1319,9 +1319,10 @@ chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_so
|
|||||||
//@mute_for Time left before notifications will be unmuted, in seconds
|
//@mute_for Time left before notifications will be unmuted, in seconds
|
||||||
//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled
|
//@sound_id Identifier of the notification sound to be played; 0 if sound is disabled
|
||||||
//@show_preview True, if message content must be displayed in notifications
|
//@show_preview True, if message content must be displayed in notifications
|
||||||
|
//@mute_stories True, if story notifications are received without sound
|
||||||
//@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message
|
//@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message
|
||||||
//@disable_mention_notifications True, if notifications for messages with mentions will be created as for an ordinary unread message
|
//@disable_mention_notifications True, if notifications for messages with mentions will be created as for an ordinary unread message
|
||||||
scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings;
|
scopeNotificationSettings mute_for:int32 sound_id:int64 show_preview:Bool mute_stories:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings;
|
||||||
|
|
||||||
|
|
||||||
//@description Contains information about a message draft
|
//@description Contains information about a message draft
|
||||||
|
@ -540,7 +540,7 @@ void NotificationSettingsManager::init() {
|
|||||||
if (!channels_notification_settings_.is_synchronized && is_authorized) {
|
if (!channels_notification_settings_.is_synchronized && is_authorized) {
|
||||||
channels_notification_settings_ = ScopeNotificationSettings(
|
channels_notification_settings_ = ScopeNotificationSettings(
|
||||||
chats_notification_settings_.mute_until, dup_notification_sound(chats_notification_settings_.sound),
|
chats_notification_settings_.mute_until, dup_notification_sound(chats_notification_settings_.sound),
|
||||||
chats_notification_settings_.show_preview, false, false);
|
chats_notification_settings_.show_preview, chats_notification_settings_.mute_stories, false, false);
|
||||||
channels_notification_settings_.is_synchronized = false;
|
channels_notification_settings_.is_synchronized = false;
|
||||||
send_get_scope_notification_settings_query(NotificationSettingsScope::Channel, Promise<>());
|
send_get_scope_notification_settings_query(NotificationSettingsScope::Channel, Promise<>());
|
||||||
}
|
}
|
||||||
|
@ -15,17 +15,19 @@ namespace td {
|
|||||||
telegram_api::object_ptr<telegram_api::inputPeerNotifySettings>
|
telegram_api::object_ptr<telegram_api::inputPeerNotifySettings>
|
||||||
ScopeNotificationSettings::get_input_peer_notify_settings() const {
|
ScopeNotificationSettings::get_input_peer_notify_settings() const {
|
||||||
int32 flags = telegram_api::inputPeerNotifySettings::MUTE_UNTIL_MASK |
|
int32 flags = telegram_api::inputPeerNotifySettings::MUTE_UNTIL_MASK |
|
||||||
telegram_api::inputPeerNotifySettings::SHOW_PREVIEWS_MASK;
|
telegram_api::inputPeerNotifySettings::SHOW_PREVIEWS_MASK |
|
||||||
|
telegram_api::inputPeerNotifySettings::STORIES_MUTED_MASK;
|
||||||
if (sound != nullptr) {
|
if (sound != nullptr) {
|
||||||
flags |= telegram_api::inputPeerNotifySettings::SOUND_MASK;
|
flags |= telegram_api::inputPeerNotifySettings::SOUND_MASK;
|
||||||
}
|
}
|
||||||
return telegram_api::make_object<telegram_api::inputPeerNotifySettings>(
|
return telegram_api::make_object<telegram_api::inputPeerNotifySettings>(
|
||||||
flags, show_preview, false, mute_until, get_input_notification_sound(sound), false, false, nullptr);
|
flags, show_preview, false, mute_until, get_input_notification_sound(sound), mute_stories, false, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder &operator<<(StringBuilder &string_builder, const ScopeNotificationSettings ¬ification_settings) {
|
StringBuilder &operator<<(StringBuilder &string_builder, const ScopeNotificationSettings ¬ification_settings) {
|
||||||
return string_builder << "[" << notification_settings.mute_until << ", " << notification_settings.sound << ", "
|
return string_builder << "[" << notification_settings.mute_until << ", " << notification_settings.sound << ", "
|
||||||
<< notification_settings.show_preview << ", " << notification_settings.is_synchronized << ", "
|
<< notification_settings.show_preview << ", " << notification_settings.mute_stories << ", "
|
||||||
|
<< notification_settings.is_synchronized << ", "
|
||||||
<< notification_settings.disable_pinned_message_notifications << ", "
|
<< notification_settings.disable_pinned_message_notifications << ", "
|
||||||
<< notification_settings.disable_mention_notifications << "]";
|
<< notification_settings.disable_mention_notifications << "]";
|
||||||
}
|
}
|
||||||
@ -36,7 +38,7 @@ td_api::object_ptr<td_api::scopeNotificationSettings> get_scope_notification_set
|
|||||||
return td_api::make_object<td_api::scopeNotificationSettings>(
|
return td_api::make_object<td_api::scopeNotificationSettings>(
|
||||||
max(0, notification_settings->mute_until - G()->unix_time()),
|
max(0, notification_settings->mute_until - G()->unix_time()),
|
||||||
get_notification_sound_ringtone_id(notification_settings->sound), notification_settings->show_preview,
|
get_notification_sound_ringtone_id(notification_settings->sound), notification_settings->show_preview,
|
||||||
notification_settings->disable_pinned_message_notifications,
|
notification_settings->mute_stories, notification_settings->disable_pinned_message_notifications,
|
||||||
notification_settings->disable_mention_notifications);
|
notification_settings->disable_mention_notifications);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +63,7 @@ Result<ScopeNotificationSettings> get_scope_notification_settings(
|
|||||||
|
|
||||||
auto mute_until = get_mute_until(notification_settings->mute_for_);
|
auto mute_until = get_mute_until(notification_settings->mute_for_);
|
||||||
return ScopeNotificationSettings(mute_until, get_notification_sound(false, notification_settings->sound_id_),
|
return ScopeNotificationSettings(mute_until, get_notification_sound(false, notification_settings->sound_id_),
|
||||||
notification_settings->show_preview_,
|
notification_settings->show_preview_, notification_settings->mute_stories_,
|
||||||
notification_settings->disable_pinned_message_notifications_,
|
notification_settings->disable_pinned_message_notifications_,
|
||||||
notification_settings->disable_mention_notifications_);
|
notification_settings->disable_mention_notifications_);
|
||||||
}
|
}
|
||||||
@ -77,8 +79,9 @@ ScopeNotificationSettings get_scope_notification_settings(tl_object_ptr<telegram
|
|||||||
mute_until = 0;
|
mute_until = 0;
|
||||||
}
|
}
|
||||||
auto show_preview = settings->show_previews_;
|
auto show_preview = settings->show_previews_;
|
||||||
return {mute_until, get_notification_sound(settings.get()), show_preview, old_disable_pinned_message_notifications,
|
auto mute_stories = settings->stories_muted_;
|
||||||
old_disable_mention_notifications};
|
return {mute_until, get_notification_sound(settings.get()), show_preview,
|
||||||
|
mute_stories, old_disable_pinned_message_notifications, old_disable_mention_notifications};
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace td
|
} // namespace td
|
||||||
|
@ -21,6 +21,7 @@ class ScopeNotificationSettings {
|
|||||||
int32 mute_until = 0;
|
int32 mute_until = 0;
|
||||||
unique_ptr<NotificationSound> sound;
|
unique_ptr<NotificationSound> sound;
|
||||||
bool show_preview = true;
|
bool show_preview = true;
|
||||||
|
bool mute_stories = false;
|
||||||
bool is_synchronized = false;
|
bool is_synchronized = false;
|
||||||
|
|
||||||
// local settings
|
// local settings
|
||||||
@ -30,10 +31,12 @@ class ScopeNotificationSettings {
|
|||||||
ScopeNotificationSettings() = default;
|
ScopeNotificationSettings() = default;
|
||||||
|
|
||||||
ScopeNotificationSettings(int32 mute_until, unique_ptr<NotificationSound> &&sound, bool show_preview,
|
ScopeNotificationSettings(int32 mute_until, unique_ptr<NotificationSound> &&sound, bool show_preview,
|
||||||
bool disable_pinned_message_notifications, bool disable_mention_notifications)
|
bool mute_stories, bool disable_pinned_message_notifications,
|
||||||
|
bool disable_mention_notifications)
|
||||||
: mute_until(mute_until)
|
: mute_until(mute_until)
|
||||||
, sound(std::move(sound))
|
, sound(std::move(sound))
|
||||||
, show_preview(show_preview)
|
, show_preview(show_preview)
|
||||||
|
, mute_stories(mute_stories)
|
||||||
, is_synchronized(true)
|
, is_synchronized(true)
|
||||||
, disable_pinned_message_notifications(disable_pinned_message_notifications)
|
, disable_pinned_message_notifications(disable_pinned_message_notifications)
|
||||||
, disable_mention_notifications(disable_mention_notifications) {
|
, disable_mention_notifications(disable_mention_notifications) {
|
||||||
|
@ -28,6 +28,7 @@ void store(const ScopeNotificationSettings ¬ification_settings, StorerT &stor
|
|||||||
STORE_FLAG(notification_settings.disable_pinned_message_notifications);
|
STORE_FLAG(notification_settings.disable_pinned_message_notifications);
|
||||||
STORE_FLAG(notification_settings.disable_mention_notifications);
|
STORE_FLAG(notification_settings.disable_mention_notifications);
|
||||||
STORE_FLAG(has_ringtone_support);
|
STORE_FLAG(has_ringtone_support);
|
||||||
|
STORE_FLAG(notification_settings.mute_stories);
|
||||||
END_STORE_FLAGS();
|
END_STORE_FLAGS();
|
||||||
if (is_muted) {
|
if (is_muted) {
|
||||||
store(notification_settings.mute_until, storer);
|
store(notification_settings.mute_until, storer);
|
||||||
@ -52,6 +53,7 @@ void parse(ScopeNotificationSettings ¬ification_settings, ParserT &parser) {
|
|||||||
PARSE_FLAG(notification_settings.disable_pinned_message_notifications);
|
PARSE_FLAG(notification_settings.disable_pinned_message_notifications);
|
||||||
PARSE_FLAG(notification_settings.disable_mention_notifications);
|
PARSE_FLAG(notification_settings.disable_mention_notifications);
|
||||||
PARSE_FLAG(has_ringtone_support);
|
PARSE_FLAG(has_ringtone_support);
|
||||||
|
PARSE_FLAG(notification_settings.mute_stories);
|
||||||
END_PARSE_FLAGS();
|
END_PARSE_FLAGS();
|
||||||
(void)silent_send_message_ignored;
|
(void)silent_send_message_ignored;
|
||||||
if (is_muted) {
|
if (is_muted) {
|
||||||
|
@ -5487,15 +5487,16 @@ class CliClient final : public Actor {
|
|||||||
string mute_for;
|
string mute_for;
|
||||||
int64 sound_id;
|
int64 sound_id;
|
||||||
string show_preview;
|
string show_preview;
|
||||||
|
string mute_stories;
|
||||||
string disable_pinned_message_notifications;
|
string disable_pinned_message_notifications;
|
||||||
string disable_mention_notifications;
|
string disable_mention_notifications;
|
||||||
get_args(args, scope, mute_for, sound_id, show_preview, disable_pinned_message_notifications,
|
get_args(args, scope, mute_for, sound_id, show_preview, mute_stories, disable_pinned_message_notifications,
|
||||||
disable_mention_notifications);
|
disable_mention_notifications);
|
||||||
if (op == "ssns") {
|
if (op == "ssns") {
|
||||||
send_request(td_api::make_object<td_api::setScopeNotificationSettings>(
|
send_request(td_api::make_object<td_api::setScopeNotificationSettings>(
|
||||||
as_notification_settings_scope(scope),
|
as_notification_settings_scope(scope),
|
||||||
td_api::make_object<td_api::scopeNotificationSettings>(
|
td_api::make_object<td_api::scopeNotificationSettings>(
|
||||||
to_integer<int32>(mute_for), sound_id, as_bool(show_preview),
|
to_integer<int32>(mute_for), sound_id, as_bool(show_preview), as_bool(mute_stories),
|
||||||
as_bool(disable_pinned_message_notifications), as_bool(disable_mention_notifications))));
|
as_bool(disable_pinned_message_notifications), as_bool(disable_mention_notifications))));
|
||||||
} else {
|
} else {
|
||||||
auto settings = td_api::make_object<td_api::chatNotificationSettings>(
|
auto settings = td_api::make_object<td_api::chatNotificationSettings>(
|
||||||
|
Loading…
Reference in New Issue
Block a user