Skip to content
Snippets Groups Projects
Commit 6dcf2669 authored by Fadi Shehadeh's avatar Fadi Shehadeh Committed by Sébastien Blin
Browse files

notifications : update format

-added accountId for or multi accounts
-file display name instead of path

GitLab: #905

Change-Id: Ia0179022c0f1ef23d42b67a458cb65376d4d27e8
parent 56297cdc
No related branches found
No related tags found
No related merge requests found
daemon @ a204b717
Subproject commit c1b1aaf0136aa03132ff1c7101583d3210844c93
Subproject commit a204b71769f168f4ece750e0faf369f4b91f7ce2
......@@ -127,6 +127,7 @@ CallAdapter::onCallStatusChanged(const QString& accountId, const QString& callId
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(accountId);
auto& callModel = accInfo.callModel;
const auto call = callModel->getCall(callId);
auto to = lrcInstance_->accountModel().bestNameForAccount(accountId);
const auto& convInfo = lrcInstance_->getConversationFromCallId(callId, accountId);
if (convInfo.uid.isEmpty() || call.isOutgoing)
......@@ -149,7 +150,7 @@ CallAdapter::onCallStatusChanged(const QString& accountId, const QString& callId
auto from = accInfo.conversationModel->title(convInfo.uid);
auto notifId = QString("%1;%2").arg(accountId).arg(convInfo.uid);
systemTray_->showNotification(notifId,
tr("Missed call"),
tr("%1 missed call").arg(to),
tr("Missed call with %1").arg(from),
NotificationType::CHAT,
Utils::QImageToByteArray(convAvatar));
......@@ -569,6 +570,7 @@ CallAdapter::showNotification(const QString& accountId, const QString& convUid)
{
auto& accInfo = lrcInstance_->getAccountInfo(accountId);
auto title = accInfo.conversationModel->title(convUid);
auto to = lrcInstance_->accountModel().bestNameForAccount(accountId);
auto preferences = accInfo.conversationModel->getConversationPreferences(convUid);
// Ignore notifications for this conversation
......@@ -579,7 +581,7 @@ CallAdapter::showNotification(const QString& accountId, const QString& convUid)
auto convAvatar = Utils::conversationAvatar(lrcInstance_, convUid, QSize(50, 50), accountId);
auto notifId = QString("%1;%2").arg(accountId).arg(convUid);
systemTray_->showNotification(notifId,
tr("Incoming call"),
tr("%1 incoming call").arg(to),
tr("%1 is calling you").arg(title),
NotificationType::CALL,
Utils::QImageToByteArray(convAvatar));
......
......@@ -164,11 +164,17 @@ ConversationsAdapter::onNewUnreadInteraction(const QString& accountId,
const interaction::Info& interaction)
{
if (!QApplication::focusWindow() || accountId != lrcInstance_->get_currentAccountId()
|| convUid != lrcInstance_->get_selectedConvUid()) {
|| convUid != lrcInstance_->get_selectedConvUid()) {
auto& accountInfo = lrcInstance_->getAccountInfo(accountId);
if (interaction.authorUri == accountInfo.profileInfo.uri)
return;
auto from = accountInfo.contactModel->bestNameForContact(interaction.authorUri);
auto to = lrcInstance_->accountModel().bestNameForAccount(accountId);
auto body_ = interaction.body;
if (interaction.type == interaction::Type::DATA_TRANSFER) {
body_ = interaction.commit.value("displayName");
}
auto preferences = accountInfo.conversationModel->getConversationPreferences(convUid);
// Ignore notifications for this conversation
......@@ -181,8 +187,8 @@ ConversationsAdapter::onNewUnreadInteraction(const QString& accountId,
accountId);
auto notifId = QString("%1;%2;%3").arg(accountId).arg(convUid).arg(interactionId);
systemTray_->showNotification(notifId,
tr("New message"),
from + ": " + interaction.body,
tr("%1 received a new message").arg(to),
from + ": " + body_,
NotificationType::CHAT,
Utils::QImageToByteArray(contactPhoto));
......@@ -232,6 +238,7 @@ ConversationsAdapter::onNewTrustRequest(const QString& accountId,
}
auto& accInfo = lrcInstance_->getAccountInfo(accountId);
auto from = accInfo.contactModel->bestNameForContact(peerUri);
auto to = lrcInstance_->accountModel().bestNameForAccount(accountId);
auto preferences = accInfo.conversationModel->getConversationPreferences(convId);
// Ignore notifications for this conversation
......@@ -240,7 +247,7 @@ ConversationsAdapter::onNewTrustRequest(const QString& accountId,
auto contactPhoto = Utils::contactPhoto(lrcInstance_, peerUri, QSize(50, 50), accountId);
auto notifId = QString("%1;%2").arg(accountId).arg(conv);
systemTray_->showNotification(notifId,
tr("Trust request"),
tr("%1 received a new trust request").arg(to),
"New request from " + from,
NotificationType::REQUEST,
Utils::QImageToByteArray(contactPhoto));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment