mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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_MessageSavingSaveForBots" = "Save in bot dialogs";
|
||||||
"ayu_QoLTogglesHeader" = "Useful features";
|
"ayu_QoLTogglesHeader" = "Useful features";
|
||||||
"ayu_KeepAliveService" = "AyuGram Push Service";
|
"ayu_KeepAliveService" = "AyuGram Push Service";
|
||||||
"ayu_DisableStories" = "Disable stories";
|
|
||||||
"ayu_DisableAds" = "Disable ads";
|
"ayu_DisableAds" = "Disable ads";
|
||||||
|
"ayu_DisableStories" = "Disable stories";
|
||||||
|
"ayu_DisableNotificationsDelay" = "Disable notify delay";
|
||||||
"ayu_LocalPremium" = "Local Telegram Premium";
|
"ayu_LocalPremium" = "Local Telegram Premium";
|
||||||
"ayu_CopyUsernameAsLink" = "Copy username as link";
|
"ayu_CopyUsernameAsLink" = "Copy username as link";
|
||||||
"ayu_CustomizationHeader" = "Customization";
|
"ayu_CustomizationHeader" = "Customization";
|
||||||
|
|
|
@ -235,6 +235,11 @@ void AyuGramSettings::set_disableStories(bool val)
|
||||||
disableStories = val;
|
disableStories = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AyuGramSettings::set_disableNotificationsDelay(bool val)
|
||||||
|
{
|
||||||
|
disableNotificationsDelay = val;
|
||||||
|
}
|
||||||
|
|
||||||
void AyuGramSettings::set_localPremium(bool val)
|
void AyuGramSettings::set_localPremium(bool val)
|
||||||
{
|
{
|
||||||
localPremium = val;
|
localPremium = val;
|
||||||
|
|
|
@ -52,6 +52,7 @@ public:
|
||||||
// ~ QoL toggles
|
// ~ QoL toggles
|
||||||
disableAds = true;
|
disableAds = true;
|
||||||
disableStories = false;
|
disableStories = false;
|
||||||
|
disableNotificationsDelay = false;
|
||||||
localPremium = false;
|
localPremium = false;
|
||||||
copyUsernameAsLink = true;
|
copyUsernameAsLink = true;
|
||||||
|
|
||||||
|
@ -91,6 +92,7 @@ public:
|
||||||
bool saveMessagesHistory;
|
bool saveMessagesHistory;
|
||||||
bool disableAds;
|
bool disableAds;
|
||||||
bool disableStories;
|
bool disableStories;
|
||||||
|
bool disableNotificationsDelay;
|
||||||
bool localPremium;
|
bool localPremium;
|
||||||
bool copyUsernameAsLink;
|
bool copyUsernameAsLink;
|
||||||
QString appIcon;
|
QString appIcon;
|
||||||
|
@ -132,6 +134,8 @@ public:
|
||||||
|
|
||||||
void set_disableStories(bool val);
|
void set_disableStories(bool val);
|
||||||
|
|
||||||
|
void set_disableNotificationsDelay(bool val);
|
||||||
|
|
||||||
void set_localPremium(bool val);
|
void set_localPremium(bool val);
|
||||||
|
|
||||||
void set_copyUsernameAsLink(bool val);
|
void set_copyUsernameAsLink(bool val);
|
||||||
|
@ -176,6 +180,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
|
||||||
saveMessagesHistory,
|
saveMessagesHistory,
|
||||||
disableAds,
|
disableAds,
|
||||||
disableStories,
|
disableStories,
|
||||||
|
disableNotificationsDelay,
|
||||||
localPremium,
|
localPremium,
|
||||||
copyUsernameAsLink,
|
copyUsernameAsLink,
|
||||||
appIcon,
|
appIcon,
|
||||||
|
|
|
@ -703,6 +703,22 @@ void Ayu::SetupQoLToggles(not_null<Ui::VerticalLayout *> container)
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, 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(
|
AddButton(
|
||||||
container,
|
container,
|
||||||
tr::ayu_LocalPremium(),
|
tr::ayu_LocalPremium(),
|
||||||
|
|
|
@ -40,6 +40,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
|
|
||||||
|
// AyuGram includes
|
||||||
|
#include "ayu/ayu_settings.h"
|
||||||
|
|
||||||
|
|
||||||
#if __has_include(<gio/gio.hpp>)
|
#if __has_include(<gio/gio.hpp>)
|
||||||
#include <gio/gio.hpp>
|
#include <gio/gio.hpp>
|
||||||
#endif // __has_include(<gio/gio.hpp>)
|
#endif // __has_include(<gio/gio.hpp>)
|
||||||
|
@ -301,6 +305,12 @@ System::Timing System::countTiming(
|
||||||
} else if (cOtherOnline() >= t) {
|
} else if (cOtherOnline() >= t) {
|
||||||
delay = config.notifyDefaultDelay;
|
delay = config.notifyDefaultDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto settings = &AyuSettings::getInstance();
|
||||||
|
if (settings->disableNotificationsDelay) {
|
||||||
|
delay = minimalDelay;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
.delay = delay,
|
.delay = delay,
|
||||||
.when = ms + delay,
|
.when = ms + delay,
|
||||||
|
|
Loading…
Add table
Reference in a new issue