mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Pre-normalize notification daemon versions
This commit is contained in:
parent
886847f457
commit
0ec5181566
1 changed files with 11 additions and 11 deletions
|
@ -117,17 +117,16 @@ void StartServiceAsync(Gio::DBusConnection connection, Fn<void()> callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetImageKey(const QVersionNumber &specificationVersion) {
|
std::string GetImageKey() {
|
||||||
const auto normalizedVersion = specificationVersion.normalized();
|
const auto &specVersion = CurrentServerInformation.specVersion;
|
||||||
|
if (specVersion.isNull()) {
|
||||||
if (normalizedVersion.isNull()) {
|
|
||||||
LOG(("Native Notification Error: specification version is null"));
|
LOG(("Native Notification Error: specification version is null"));
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (normalizedVersion >= QVersionNumber(1, 2)) {
|
if (specVersion >= QVersionNumber(1, 2)) {
|
||||||
return "image-data";
|
return "image-data";
|
||||||
} else if (normalizedVersion == QVersionNumber(1, 1)) {
|
} else if (specVersion == QVersionNumber(1, 1)) {
|
||||||
return "image_data";
|
return "image_data";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +209,8 @@ NotificationData::NotificationData(
|
||||||
, _guid(_application ? std::string(Gio::dbus_generate_guid()) : std::string())
|
, _guid(_application ? std::string(Gio::dbus_generate_guid()) : std::string())
|
||||||
, _proxy(proxy)
|
, _proxy(proxy)
|
||||||
, _interface(proxy)
|
, _interface(proxy)
|
||||||
, _hints(GLib::VariantDict::new_()) {
|
, _hints(GLib::VariantDict::new_())
|
||||||
|
, _imageKey(GetImageKey()) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool NotificationData::init(
|
bool NotificationData::init(
|
||||||
|
@ -267,8 +267,6 @@ bool NotificationData::init(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_imageKey = GetImageKey(CurrentServerInformation.specVersion);
|
|
||||||
|
|
||||||
if (HasCapability("body-markup")) {
|
if (HasCapability("body-markup")) {
|
||||||
_title = title.toStdString();
|
_title = title.toStdString();
|
||||||
|
|
||||||
|
@ -706,9 +704,11 @@ void Create(Window::Notifications::System *system) {
|
||||||
std::get<1>(*result),
|
std::get<1>(*result),
|
||||||
std::get<2>(*result),
|
std::get<2>(*result),
|
||||||
QVersionNumber::fromString(
|
QVersionNumber::fromString(
|
||||||
QString::fromStdString(std::get<3>(*result))),
|
QString::fromStdString(std::get<3>(*result))
|
||||||
|
).normalized(),
|
||||||
QVersionNumber::fromString(
|
QVersionNumber::fromString(
|
||||||
QString::fromStdString(std::get<4>(*result))),
|
QString::fromStdString(std::get<4>(*result))
|
||||||
|
).normalized(),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
Gio::DBusErrorNS_::strip_remote_error(result.error());
|
Gio::DBusErrorNS_::strip_remote_error(result.error());
|
||||||
|
|
Loading…
Add table
Reference in a new issue