Added mute menu to button for notifications in profile.

This commit is contained in:
23rd 2022-03-27 16:18:02 +03:00 committed by John Preston
parent 3f6c693c3f
commit 4d0b0bbf66

View file

@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/peers/add_bot_to_chat_box.h" #include "boxes/peers/add_bot_to_chat_box.h"
#include "boxes/peers/edit_contact_box.h" #include "boxes/peers/edit_contact_box.h"
#include "lang/lang_keys.h" #include "lang/lang_keys.h"
#include "menu/menu_mute.h"
#include "info/info_controller.h" #include "info/info_controller.h"
#include "info/info_memento.h" #include "info/info_memento.h"
#include "info/profile/info_profile_icon.h" #include "info/profile/info_profile_icon.h"
@ -374,14 +375,11 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupMuteToggle() {
_wrap, _wrap,
tr::lng_profile_enable_notifications(), tr::lng_profile_enable_notifications(),
st::infoNotificationsButton); st::infoNotificationsButton);
result->toggleOn( result->toggleOn(NotificationsEnabledValue(peer), true);
NotificationsEnabledValue(peer) MuteMenu::SetupMuteMenu(
)->addClickHandler([=] { result.data(),
const auto muteForSeconds = peer->owner().notifyIsMuted(peer) result->clicks() | rpl::to_empty,
? 0 peer);
: Data::NotifySettings::kDefaultMutePeriod;
peer->owner().updateNotifySettings(peer, muteForSeconds);
});
object_ptr<FloatingIcon>( object_ptr<FloatingIcon>(
result, result,
st::infoIconNotifications, st::infoIconNotifications,