From d2c8780c0faf370ac75c1df4215fa8d44d075849 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 26 May 2021 01:22:55 +0300 Subject: [PATCH] Removed NotificationsDemoIsShown global variable from facades. --- Telegram/SourceFiles/facades.cpp | 4 ---- Telegram/SourceFiles/facades.h | 2 -- .../SourceFiles/settings/settings_notifications.cpp | 4 +--- Telegram/SourceFiles/window/notifications_manager.h | 1 + .../window/notifications_manager_default.cpp | 13 +++++++++---- .../window/notifications_manager_default.h | 1 + 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index 16cf6dcfeb..d0964a0f54 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -343,8 +343,6 @@ struct Data { Adaptive::ChatLayout AdaptiveChatLayout = Adaptive::ChatLayout::Normal; base::Observable AdaptiveChanged; - bool NotificationsDemoIsShown = false; - bool TryIPv6 = !Platform::IsWindows(); std::vector ProxiesList; MTP::ProxyData SelectedProxy; @@ -380,8 +378,6 @@ DefineVar(Global, Adaptive::WindowLayout, AdaptiveWindowLayout); DefineVar(Global, Adaptive::ChatLayout, AdaptiveChatLayout); DefineRefVar(Global, base::Observable, AdaptiveChanged); -DefineVar(Global, bool, NotificationsDemoIsShown); - DefineVar(Global, bool, TryIPv6); DefineVar(Global, std::vector, ProxiesList); DefineVar(Global, MTP::ProxyData, SelectedProxy); diff --git a/Telegram/SourceFiles/facades.h b/Telegram/SourceFiles/facades.h index 35c5ae2a31..a2648eabd6 100644 --- a/Telegram/SourceFiles/facades.h +++ b/Telegram/SourceFiles/facades.h @@ -115,8 +115,6 @@ DeclareVar(Adaptive::ChatLayout, AdaptiveChatLayout); DeclareVar(Adaptive::WindowLayout, AdaptiveWindowLayout); DeclareRefVar(base::Observable, AdaptiveChanged); -DeclareVar(bool, NotificationsDemoIsShown); - DeclareVar(bool, TryIPv6); DeclareVar(std::vector, ProxiesList); DeclareVar(MTP::ProxyData, SelectedProxy); diff --git a/Telegram/SourceFiles/settings/settings_notifications.cpp b/Telegram/SourceFiles/settings/settings_notifications.cpp index 5a7ae8052d..9362a27f75 100644 --- a/Telegram/SourceFiles/settings/settings_notifications.cpp +++ b/Telegram/SourceFiles/settings/settings_notifications.cpp @@ -356,7 +356,6 @@ void NotificationsCount::setOverCorner(ScreenCorner corner) { } else { _isOverCorner = true; setCursor(style::cur_pointer); - Global::SetNotificationsDemoIsShown(true); Core::App().notifications().notifySettingsChanged( ChangeType::DemoIsShown); } @@ -392,9 +391,8 @@ void NotificationsCount::clearOverCorner() { if (_isOverCorner) { _isOverCorner = false; setCursor(style::cur_default); - Global::SetNotificationsDemoIsShown(false); Core::App().notifications().notifySettingsChanged( - ChangeType::DemoIsShown); + ChangeType::DemoIsHidden); for_const (const auto &samples, _cornerSamples) { for_const (const auto widget, samples) { diff --git a/Telegram/SourceFiles/window/notifications_manager.h b/Telegram/SourceFiles/window/notifications_manager.h index 998618cf4c..006e233b22 100644 --- a/Telegram/SourceFiles/window/notifications_manager.h +++ b/Telegram/SourceFiles/window/notifications_manager.h @@ -53,6 +53,7 @@ enum class ChangeType { MaxCount, Corner, DemoIsShown, + DemoIsHidden, }; } // namespace Notifications diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index 48f937b0ea..0e77fc4480 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -131,9 +131,14 @@ void Manager::settingsChanged(ChangeType change) { showNextFromQueue(); } } - } else if (change == ChangeType::DemoIsShown) { - auto demoIsShown = Global::NotificationsDemoIsShown(); - _demoMasterOpacity.start([this] { demoMasterOpacityCallback(); }, demoIsShown ? 1. : 0., demoIsShown ? 0. : 1., st::notifyFastAnim); + } else if ((change == ChangeType::DemoIsShown) + || (change == ChangeType::DemoIsHidden)) { + _demoIsShown = (change == ChangeType::DemoIsShown); + _demoMasterOpacity.start( + [=] { demoMasterOpacityCallback(); }, + _demoIsShown ? 1. : 0., + _demoIsShown ? 0. : 1., + st::notifyFastAnim); } } @@ -147,7 +152,7 @@ void Manager::demoMasterOpacityCallback() { } float64 Manager::demoMasterOpacity() const { - return _demoMasterOpacity.value(Global::NotificationsDemoIsShown() ? 0. : 1.); + return _demoMasterOpacity.value(_demoIsShown ? 0. : 1.); } void Manager::checkLastInput() { diff --git a/Telegram/SourceFiles/window/notifications_manager_default.h b/Telegram/SourceFiles/window/notifications_manager_default.h index 6d973c317f..9dcd11ff2d 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.h +++ b/Telegram/SourceFiles/window/notifications_manager_default.h @@ -122,6 +122,7 @@ private: std::deque _queuedNotifications; Ui::Animations::Simple _demoMasterOpacity; + bool _demoIsShown = false; mutable QPixmap _hiddenUserpicPlaceholder;