mirror of https://github.com/nymea/nymea.git
Fix deprecation warning for notifications
parent
8f846434b9
commit
b01e8c8ee4
|
|
@ -744,14 +744,6 @@ void JsonRPCServerImplementation::sendNotification(const QVariantMap ¶ms)
|
|||
notification.insert("id", m_notificationId++);
|
||||
notification.insert("notification", handler->name() + "." + method.name());
|
||||
|
||||
// Add deprecation warning if necessary
|
||||
if (m_api.value("notifications").toMap().value(handler->name() + '.' + method.name()).toMap().contains("deprecated")) {
|
||||
QString deprecationMessage = m_api.value("notifications").toMap().value(handler->name() + '.' + method.name()).toMap().value("deprecated").toString();
|
||||
qCWarning(dcJsonRpc()) << "Client uses deprecated API. Please update client implementation!";
|
||||
qCWarning(dcJsonRpc()) << handler->name() + '.' + method.name() + ':' << deprecationMessage;
|
||||
notification.insert("deprecationWarning", deprecationMessage);
|
||||
}
|
||||
|
||||
foreach (const QUuid &clientId, m_clientNotifications.keys()) {
|
||||
|
||||
// Check if this client wants to be notified
|
||||
|
|
@ -759,6 +751,14 @@ void JsonRPCServerImplementation::sendNotification(const QVariantMap ¶ms)
|
|||
continue;
|
||||
}
|
||||
|
||||
// Add deprecation warning if necessary
|
||||
if (m_api.value("notifications").toMap().value(handler->name() + '.' + method.name()).toMap().contains("deprecated")) {
|
||||
QString deprecationMessage = m_api.value("notifications").toMap().value(handler->name() + '.' + method.name()).toMap().value("deprecated").toString();
|
||||
qCWarning(dcJsonRpc()) << "Client" << clientId << "uses deprecated API. Please update client implementation!";
|
||||
qCWarning(dcJsonRpc()) << handler->name() + '.' + method.name() + ':' << deprecationMessage;
|
||||
notification.insert("deprecationWarning", deprecationMessage);
|
||||
}
|
||||
|
||||
QLocale locale = m_clientLocales.value(clientId);
|
||||
QVariantMap translatedParams = handler->translateNotification(method.name(), params, locale);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue