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

View File

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

View File

@ -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) {

View File

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

View File

@ -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() {

View File

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