mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
feat: disable notifications delay
Telegram built-in function that delays notifications on the current client instance if you're online from another client
This commit is contained in:
parent
3f74919ba6
commit
474de0cc46
5 changed files with 38 additions and 1 deletions
|
@ -4167,8 +4167,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
"ayu_MessageSavingSaveForBots" = "Save in bot dialogs";
|
||||
"ayu_QoLTogglesHeader" = "Useful features";
|
||||
"ayu_KeepAliveService" = "AyuGram Push Service";
|
||||
"ayu_DisableStories" = "Disable stories";
|
||||
"ayu_DisableAds" = "Disable ads";
|
||||
"ayu_DisableStories" = "Disable stories";
|
||||
"ayu_DisableNotificationsDelay" = "Disable notify delay";
|
||||
"ayu_LocalPremium" = "Local Telegram Premium";
|
||||
"ayu_CopyUsernameAsLink" = "Copy username as link";
|
||||
"ayu_CustomizationHeader" = "Customization";
|
||||
|
|
|
@ -235,6 +235,11 @@ void AyuGramSettings::set_disableStories(bool val)
|
|||
disableStories = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_disableNotificationsDelay(bool val)
|
||||
{
|
||||
disableNotificationsDelay = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_localPremium(bool val)
|
||||
{
|
||||
localPremium = val;
|
||||
|
|
|
@ -52,6 +52,7 @@ public:
|
|||
// ~ QoL toggles
|
||||
disableAds = true;
|
||||
disableStories = false;
|
||||
disableNotificationsDelay = false;
|
||||
localPremium = false;
|
||||
copyUsernameAsLink = true;
|
||||
|
||||
|
@ -91,6 +92,7 @@ public:
|
|||
bool saveMessagesHistory;
|
||||
bool disableAds;
|
||||
bool disableStories;
|
||||
bool disableNotificationsDelay;
|
||||
bool localPremium;
|
||||
bool copyUsernameAsLink;
|
||||
QString appIcon;
|
||||
|
@ -132,6 +134,8 @@ public:
|
|||
|
||||
void set_disableStories(bool val);
|
||||
|
||||
void set_disableNotificationsDelay(bool val);
|
||||
|
||||
void set_localPremium(bool val);
|
||||
|
||||
void set_copyUsernameAsLink(bool val);
|
||||
|
@ -176,6 +180,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
|
|||
saveMessagesHistory,
|
||||
disableAds,
|
||||
disableStories,
|
||||
disableNotificationsDelay,
|
||||
localPremium,
|
||||
copyUsernameAsLink,
|
||||
appIcon,
|
||||
|
|
|
@ -703,6 +703,22 @@ void Ayu::SetupQoLToggles(not_null<Ui::VerticalLayout *> container)
|
|||
AyuSettings::save();
|
||||
}, container->lifetime());
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
tr::ayu_DisableNotificationsDelay(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->disableNotificationsDelay)
|
||||
)->toggledValue(
|
||||
) | rpl::filter([=](bool enabled)
|
||||
{
|
||||
return (enabled != settings->disableNotificationsDelay);
|
||||
}) | start_with_next([=](bool enabled)
|
||||
{
|
||||
settings->set_disableNotificationsDelay(enabled);
|
||||
AyuSettings::save();
|
||||
}, container->lifetime());
|
||||
|
||||
AddButton(
|
||||
container,
|
||||
tr::ayu_LocalPremium(),
|
||||
|
|
|
@ -40,6 +40,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include <QtGui/QWindow>
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/ayu_settings.h"
|
||||
|
||||
|
||||
#if __has_include(<gio/gio.hpp>)
|
||||
#include <gio/gio.hpp>
|
||||
#endif // __has_include(<gio/gio.hpp>)
|
||||
|
@ -301,6 +305,12 @@ System::Timing System::countTiming(
|
|||
} else if (cOtherOnline() >= t) {
|
||||
delay = config.notifyDefaultDelay;
|
||||
}
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
if (settings->disableNotificationsDelay) {
|
||||
delay = minimalDelay;
|
||||
}
|
||||
|
||||
return {
|
||||
.delay = delay,
|
||||
.when = ms + delay,
|
||||
|
|
Loading…
Add table
Reference in a new issue