/* This file is part of Telegram Desktop, the official desktop application for the Telegram messaging service. For license and copyright information please follow this link: https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once namespace Data { class Thread; struct NotifySound; enum class DefaultNotify; } // namespace Data namespace Main { class Session; } // namespace Main namespace Ui { class PopupMenu; class RpWidget; class Show; } // namespace Ui namespace MuteMenu { struct Descriptor { not_null session; Fn()> isMutedValue; Fn()> currentSound; Fn updateSound; Fn updateMutePeriod; }; [[nodiscard]] Descriptor ThreadDescriptor(not_null thread); [[nodiscard]] Descriptor DefaultDescriptor( not_null session, Data::DefaultNotify type); void FillMuteMenu( not_null menu, Descriptor descriptor, std::shared_ptr show); void SetupMuteMenu( not_null parent, rpl::producer<> triggers, Fn()> makeDescriptor, std::shared_ptr show); inline void FillMuteMenu( not_null menu, not_null thread, std::shared_ptr show) { FillMuteMenu(menu, ThreadDescriptor(thread), std::move(show)); } inline void SetupMuteMenu( not_null parent, rpl::producer<> triggers, Fn makeThread, std::shared_ptr show) { SetupMuteMenu(parent, std::move(triggers), [=] { const auto thread = makeThread(); return thread ? ThreadDescriptor(thread) : std::optional(); }, std::move(show)); } } // namespace MuteMenu