Removed NotificationsDemoIsShown global variable from facades.

This commit is contained in:
23rd 2021-05-26 01:22:55 +03:00
parent 54dd63d61a
commit d2c8780c0f
6 changed files with 12 additions and 13 deletions

View file

@ -343,8 +343,6 @@ struct Data {
Adaptive::ChatLayout AdaptiveChatLayout = Adaptive::ChatLayout::Normal; Adaptive::ChatLayout AdaptiveChatLayout = Adaptive::ChatLayout::Normal;
base::Observable<void> AdaptiveChanged; base::Observable<void> AdaptiveChanged;
bool NotificationsDemoIsShown = false;
bool TryIPv6 = !Platform::IsWindows(); bool TryIPv6 = !Platform::IsWindows();
std::vector<MTP::ProxyData> ProxiesList; std::vector<MTP::ProxyData> ProxiesList;
MTP::ProxyData SelectedProxy; MTP::ProxyData SelectedProxy;
@ -380,8 +378,6 @@ DefineVar(Global, Adaptive::WindowLayout, AdaptiveWindowLayout);
DefineVar(Global, Adaptive::ChatLayout, AdaptiveChatLayout); DefineVar(Global, Adaptive::ChatLayout, AdaptiveChatLayout);
DefineRefVar(Global, base::Observable<void>, AdaptiveChanged); DefineRefVar(Global, base::Observable<void>, AdaptiveChanged);
DefineVar(Global, bool, NotificationsDemoIsShown);
DefineVar(Global, bool, TryIPv6); DefineVar(Global, bool, TryIPv6);
DefineVar(Global, std::vector<MTP::ProxyData>, ProxiesList); DefineVar(Global, std::vector<MTP::ProxyData>, ProxiesList);
DefineVar(Global, MTP::ProxyData, SelectedProxy); DefineVar(Global, MTP::ProxyData, SelectedProxy);

View file

@ -115,8 +115,6 @@ DeclareVar(Adaptive::ChatLayout, AdaptiveChatLayout);
DeclareVar(Adaptive::WindowLayout, AdaptiveWindowLayout); DeclareVar(Adaptive::WindowLayout, AdaptiveWindowLayout);
DeclareRefVar(base::Observable<void>, AdaptiveChanged); DeclareRefVar(base::Observable<void>, AdaptiveChanged);
DeclareVar(bool, NotificationsDemoIsShown);
DeclareVar(bool, TryIPv6); DeclareVar(bool, TryIPv6);
DeclareVar(std::vector<MTP::ProxyData>, ProxiesList); DeclareVar(std::vector<MTP::ProxyData>, ProxiesList);
DeclareVar(MTP::ProxyData, SelectedProxy); DeclareVar(MTP::ProxyData, SelectedProxy);

View file

@ -356,7 +356,6 @@ void NotificationsCount::setOverCorner(ScreenCorner corner) {
} else { } else {
_isOverCorner = true; _isOverCorner = true;
setCursor(style::cur_pointer); setCursor(style::cur_pointer);
Global::SetNotificationsDemoIsShown(true);
Core::App().notifications().notifySettingsChanged( Core::App().notifications().notifySettingsChanged(
ChangeType::DemoIsShown); ChangeType::DemoIsShown);
} }
@ -392,9 +391,8 @@ void NotificationsCount::clearOverCorner() {
if (_isOverCorner) { if (_isOverCorner) {
_isOverCorner = false; _isOverCorner = false;
setCursor(style::cur_default); setCursor(style::cur_default);
Global::SetNotificationsDemoIsShown(false);
Core::App().notifications().notifySettingsChanged( Core::App().notifications().notifySettingsChanged(
ChangeType::DemoIsShown); ChangeType::DemoIsHidden);
for_const (const auto &samples, _cornerSamples) { for_const (const auto &samples, _cornerSamples) {
for_const (const auto widget, samples) { for_const (const auto widget, samples) {

View file

@ -53,6 +53,7 @@ enum class ChangeType {
MaxCount, MaxCount,
Corner, Corner,
DemoIsShown, DemoIsShown,
DemoIsHidden,
}; };
} // namespace Notifications } // namespace Notifications

View file

@ -131,9 +131,14 @@ void Manager::settingsChanged(ChangeType change) {
showNextFromQueue(); showNextFromQueue();
} }
} }
} else if (change == ChangeType::DemoIsShown) { } else if ((change == ChangeType::DemoIsShown)
auto demoIsShown = Global::NotificationsDemoIsShown(); || (change == ChangeType::DemoIsHidden)) {
_demoMasterOpacity.start([this] { demoMasterOpacityCallback(); }, demoIsShown ? 1. : 0., demoIsShown ? 0. : 1., st::notifyFastAnim); _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 { float64 Manager::demoMasterOpacity() const {
return _demoMasterOpacity.value(Global::NotificationsDemoIsShown() ? 0. : 1.); return _demoMasterOpacity.value(_demoIsShown ? 0. : 1.);
} }
void Manager::checkLastInput() { void Manager::checkLastInput() {

View file

@ -122,6 +122,7 @@ private:
std::deque<QueuedNotification> _queuedNotifications; std::deque<QueuedNotification> _queuedNotifications;
Ui::Animations::Simple _demoMasterOpacity; Ui::Animations::Simple _demoMasterOpacity;
bool _demoIsShown = false;
mutable QPixmap _hiddenUserpicPlaceholder; mutable QPixmap _hiddenUserpicPlaceholder;