Added reset button for profile to edit peer color box.

This commit is contained in:
23rd
2025-10-26 00:47:07 +03:00
parent e0991d9376
commit 3cda66f1f3
2 changed files with 24 additions and 0 deletions
+1
View File
@@ -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**?";
@@ -1802,6 +1802,29 @@ void EditPeerProfileColorSection(
},
true));
const auto resetWrap = container->add(
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
container,
object_ptr<Ui::VerticalLayout>(container)));
const auto resetInner = resetWrap->entity();
Ui::AddSkip(resetInner, st::settingsColorSampleSkip);
const auto resetButton = resetInner->add(
object_ptr<Ui::SettingsButton>(
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) {