mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Decrease indentation in notification manager creation
This commit is contained in:
parent
df0bca077e
commit
82d78e7c45
1 changed files with 28 additions and 25 deletions
|
@ -718,39 +718,42 @@ void Create(Window::Notifications::System *system) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!ServiceRegistered) {
|
||||||
|
CurrentServerInformation = std::nullopt;
|
||||||
|
CurrentCapabilities = QStringList{};
|
||||||
|
InhibitionSupported = false;
|
||||||
|
managerSetter();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// There are some asserts that manager is not nullptr,
|
||||||
|
// avoid crashes until some real manager is created
|
||||||
if (!system->managerType().has_value()) {
|
if (!system->managerType().has_value()) {
|
||||||
using DummyManager = Window::Notifications::DummyManager;
|
using DummyManager = Window::Notifications::DummyManager;
|
||||||
system->setManager(std::make_unique<DummyManager>(system));
|
system->setManager(std::make_unique<DummyManager>(system));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ServiceRegistered) {
|
const auto counter = std::make_shared<int>(3);
|
||||||
const auto counter = std::make_shared<int>(3);
|
const auto oneReady = [=] {
|
||||||
const auto oneReady = [=] {
|
if (!--*counter) {
|
||||||
if (!--*counter) {
|
managerSetter();
|
||||||
managerSetter();
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
GetServerInformation([=](std::optional<ServerInformation> result) {
|
GetServerInformation([=](std::optional<ServerInformation> result) {
|
||||||
CurrentServerInformation = result;
|
CurrentServerInformation = result;
|
||||||
oneReady();
|
oneReady();
|
||||||
});
|
});
|
||||||
|
|
||||||
GetCapabilities([=](QStringList result) {
|
GetCapabilities([=](QStringList result) {
|
||||||
CurrentCapabilities = result;
|
CurrentCapabilities = result;
|
||||||
oneReady();
|
oneReady();
|
||||||
});
|
});
|
||||||
|
|
||||||
GetInhibitionSupported([=](bool result) {
|
GetInhibitionSupported([=](bool result) {
|
||||||
InhibitionSupported = result;
|
InhibitionSupported = result;
|
||||||
oneReady();
|
oneReady();
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
CurrentServerInformation = std::nullopt;
|
|
||||||
CurrentCapabilities = QStringList{};
|
|
||||||
InhibitionSupported = false;
|
|
||||||
managerSetter();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Manager::Private {
|
class Manager::Private {
|
||||||
|
|
Loading…
Add table
Reference in a new issue