diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 2b3fab37da..db91cb640a 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -998,6 +998,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_settings_color_apply" = "Apply Style"; "lng_settings_color_profile_emoji" = "Add icons to Profile"; "lng_settings_color_profile_emoji_channel" = "Profile Logo"; +"lng_settings_color_reset" = "Reset Profile Color"; "lng_suggest_hide_new_title" = "Hide new chats?"; "lng_suggest_hide_new_about" = "You are receiving lots of new chats from users who are not in your Contact List.\n\nDo you want to have such chats **automatically muted** and **archived**?"; diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp index e0a34e1214..19e7aa757d 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp @@ -1802,6 +1802,29 @@ void EditPeerProfileColorSection( }, true)); + const auto resetWrap = container->add( + object_ptr>( + container, + object_ptr(container))); + const auto resetInner = resetWrap->entity(); + + Ui::AddSkip(resetInner, st::settingsColorSampleSkip); + const auto resetButton = resetInner->add( + object_ptr( + resetInner, + tr::lng_settings_color_reset(), + st::settingsButtonLightNoIcon)); + resetButton->setClickedCallback([=] { + state->index = kUnsetColorIndex; + state->patternEmojiId = 0; + preview->setColorProfileIndex(std::nullopt); + preview->setPatternEmojiId(0); + }); + + resetWrap->toggleOn(state->index.value( + ) | rpl::map([](uint8 index) { return index != kUnsetColorIndex; })); + resetWrap->finishAnimating(); + state->index.value( ) | rpl::start_with_next([=](uint8 index) { if (state->selector) {