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_ShowKllButtonInDrawer" = "Show kill app button";
"ayu_SettingsShowID" = "Show peer ID"; "ayu_SettingsShowID" = "Show peer ID";
"ayu_SettingsShowID_Hide" = "Hide"; "ayu_SettingsShowID_Hide" = "Hide";
"ayu_SettingsShowMessageShot" = "Show message shot";
"ayu_SettingsRecentStickersCount" = "Recent stickers count"; "ayu_SettingsRecentStickersCount" = "Recent stickers count";
"ayu_SettingsCustomizationHint" = "After making changes to the \"Customization\" section, you must restart the application."; "ayu_SettingsCustomizationHint" = "After making changes to the \"Customization\" section, you must restart the application.";
"ayu_SettingsContextMenuTitle" = "Select item show type"; "ayu_SettingsContextMenuTitle" = "Select item show type";

View file

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

View file

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

View file

@ -1236,6 +1236,24 @@ void SetupNerdSettings(not_null<Ui::VerticalLayout *> container, not_null<Window
AyuSettings::save(); AyuSettings::save();
}, container->lifetime()); }, 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, void SetupCustomization(not_null<Ui::VerticalLayout *> container,

View file

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