feat: allow hiding message shot

This commit is contained in:
ZavaruKitsu 2024-02-04 17:05:26 +03:00
parent f6081db13f
commit 4a6ae07409
5 changed files with 32 additions and 1 deletions

View file

@ -4733,6 +4733,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"ayu_ShowKllButtonInDrawer" = "Show kill app button";
"ayu_SettingsShowID" = "Show peer ID";
"ayu_SettingsShowID_Hide" = "Hide";
"ayu_SettingsShowMessageShot" = "Show message shot";
"ayu_SettingsRecentStickersCount" = "Recent stickers count";
"ayu_SettingsCustomizationHint" = "After making changes to the \"Customization\" section, you must restart the application.";
"ayu_SettingsContextMenuTitle" = "Select item show type";

View file

@ -257,6 +257,7 @@ AyuGramSettings::AyuGramSettings()
*/
showPeerId = 2;
showMessageSeconds = false;
showMessageShot = true;
// ~ Confirmations
stickerConfirmation = false;
@ -492,6 +493,11 @@ void AyuGramSettings::set_showMessageSeconds(bool val)
showMessageSeconds = val;
}
void AyuGramSettings::set_showMessageShot(bool val)
{
showMessageShot = val;
}
void AyuGramSettings::set_stickerConfirmation(bool val)
{
stickerConfirmation = val;

View file

@ -71,6 +71,7 @@ public:
int showPeerId;
bool showMessageSeconds;
bool showMessageShot;
bool stickerConfirmation;
bool gifConfirmation;
@ -132,6 +133,7 @@ public:
void set_showPeerId(int val);
void set_showMessageSeconds(bool val);
void set_showMessageShot(bool val);
void set_stickerConfirmation(bool val);
void set_gifConfirmation(bool val);
@ -181,6 +183,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
hideAllChatsFolder,
showPeerId,
showMessageSeconds,
showMessageShot,
stickerConfirmation,
gifConfirmation,
voiceConfirmation

View file

@ -1236,6 +1236,24 @@ void SetupNerdSettings(not_null<Ui::VerticalLayout *> container, not_null<Window
AyuSettings::save();
}, container->lifetime());
AddButtonWithIcon(
container,
tr::ayu_SettingsShowMessageShot(),
st::settingsButtonNoIcon
)->toggleOn(
rpl::single(settings->showMessageShot)
)->toggledValue(
) | rpl::filter(
[=](bool enabled)
{
return (enabled != settings->showMessageShot);
}) | start_with_next(
[=](bool enabled)
{
settings->set_showMessageShot(enabled);
AyuSettings::save();
},
container->lifetime());
}
void SetupCustomization(not_null<Ui::VerticalLayout *> container,

View file

@ -1100,9 +1100,12 @@ void TopBarWidget::updateControlsVisibility() {
hideChildren();
return;
}
const auto settings = &AyuSettings::getInstance();
_clear->show();
_delete->setVisible(_canDelete);
_messageShot->setVisible(true);
_messageShot->setVisible(settings->showMessageShot);
_forward->setVisible(_canForward);
_sendNow->setVisible(_canSendNow);