diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 6cbc49457..e8a2bbbe1 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -3087,6 +3087,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_filters_menu_add" = "Add to folder"; "lng_filters_menu_remove" = "Remove from folder"; "lng_filters_add_box_title" = "Add to..."; +"lng_filters_toast_add" = "{chat} added to {folder} folder"; +"lng_filters_toast_remove" = "{chat} removed from {folder} folder"; "lng_chat_theme_change" = "Change colors"; "lng_chat_theme_none" = "No\nTheme"; diff --git a/Telegram/SourceFiles/boxes/choose_filter_box.cpp b/Telegram/SourceFiles/boxes/choose_filter_box.cpp index c38b34e80..5f951143e 100644 --- a/Telegram/SourceFiles/boxes/choose_filter_box.cpp +++ b/Telegram/SourceFiles/boxes/choose_filter_box.cpp @@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/choose_filter_box.h" #include "apiwrap.h" +#include "core/application.h" // primaryWindow #include "data/data_chat_filters.h" #include "data/data_session.h" #include "history/history.h" @@ -15,7 +16,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session.h" #include "ui/filter_icons.h" #include "ui/layers/generic_box.h" +#include "ui/text/text_utilities.h" // Ui::Text::Bold +#include "ui/toast/toast.h" #include "ui/widgets/buttons.h" +#include "window/window_session_controller.h" #include "styles/style_settings.h" #include "styles/style_payments.h" // paymentsSectionButton @@ -101,7 +105,24 @@ void ChangeFilterById( MTP_flags(MTPmessages_UpdateDialogFilter::Flag::f_filter), MTP_int(filter.id()), filter.tl() - )).fail([=](const MTP::Error &error) { + )).done([=, chat = history->peer->name, filterName = filter.title()] { + // Since only the primary window has dialogs list, + // We can safely show toast there. + if (const auto controller = Core::App().primaryWindow()) { + auto text = (add + ? tr::lng_filters_toast_add + : tr::lng_filters_toast_remove)( + tr::now, + lt_chat, + Ui::Text::Bold(chat), + lt_folder, + Ui::Text::Bold(filterName), + Ui::Text::WithEntities); + Ui::Toast::Show( + Window::Show(controller).toastParent(), + { .text = std::move(text), .st = &st::defaultToast }); + } + }).fail([=](const MTP::Error &error) { // Revert filter on fail. history->owner().chatsFilters().set(was); }).send(); diff --git a/Telegram/SourceFiles/boxes/ringtones_box.cpp b/Telegram/SourceFiles/boxes/ringtones_box.cpp index 3d82e4830..40e0c3eb9 100644 --- a/Telegram/SourceFiles/boxes/ringtones_box.cpp +++ b/Telegram/SourceFiles/boxes/ringtones_box.cpp @@ -260,7 +260,7 @@ void RingtonesBox( ? Data::NotifySound() : (value == kNoSoundValue) ? Data::NotifySound{ .none = true } - : Data::NotifySound{ .id = state->documentIds[value] }; + : Data::NotifySound{ .id = state->documentIds[value] }; save(sound); box->closeBox(); });