Merge lp:~tiagosh/telephony-service/skip_notifications into lp:telephony-service

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Bill Filler
Approved revision: 938
Merged at revision: 938
Proposed branch: lp:~tiagosh/telephony-service/skip_notifications
Merge into: lp:telephony-service
Diff against target: 57 lines (+21/-2)
2 files modified
indicator/textchannelobserver.cpp (+20/-2)
indicator/textchannelobserver.h (+1/-0)
To merge this branch: bzr merge lp:~tiagosh/telephony-service/skip_notifications
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+235045@code.launchpad.net

Commit message

Avoid displaying on screen notifications for messages if the message thread is open.

Description of the change

Avoid displaying on screen notifications for messages if the message thread is open.

--Checklist--
Are there any related MPs required for this MP to build/function as expected? Please list.
No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/telephony-service) on device or emulator?
Yes

If you changed the UI, was the change specified/approved by design?
N/A

If you changed UI labels, did you update the pot file?
N/A

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/<package-name>) on device or emulator?
yes

Did CI run pass? If not, please explain why.
yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'indicator/textchannelobserver.cpp'
--- indicator/textchannelobserver.cpp 2014-09-11 20:57:34 +0000
+++ indicator/textchannelobserver.cpp 2014-09-17 20:24:21 +0000
@@ -230,6 +230,14 @@
230230
231 // add the message to the messaging menu (use hex format to avoid invalid characters)231 // add the message to the messaging menu (use hex format to avoid invalid characters)
232 QByteArray token(message.messageToken().toUtf8());232 QByteArray token(message.messageToken().toUtf8());
233
234 // if the message was already read, just play the ringtone and return
235 // ignore logic if we are in greeter mode
236 if (!mUnreadMessages.contains(token) && !GreeterContacts::isGreeterMode()) {
237 Ringtone::instance()->playIncomingMessageSound();
238 return;
239 }
240
233 MessagingMenu::instance()->addMessage(contact->id(), token.toHex(), message.received(), messageText);241 MessagingMenu::instance()->addMessage(contact->id(), token.toHex(), message.received(), messageText);
234242
235 QString title = QString::fromUtf8(C::gettext("Message from %1")).arg(contact->alias());243 QString title = QString::fromUtf8(C::gettext("Message from %1")).arg(contact->alias());
@@ -381,14 +389,24 @@
381 }389 }
382390
383 if (!message.isScrollback() && !message.isDeliveryReport() && !message.isRescued()) {391 if (!message.isScrollback() && !message.isDeliveryReport() && !message.isRescued()) {
384 showNotificationForMessage(message);392 QTimer *timer = new QTimer(this);
385 Metrics::instance()->increment(Metrics::ReceivedMessages);393 timer->setInterval(1500);
394 timer->setSingleShot(true);
395 QByteArray token(message.messageToken().toUtf8());
396 mUnreadMessages.append(token);
397 QObject::connect(timer, &QTimer::timeout, [=]() {
398 showNotificationForMessage(message);
399 Metrics::instance()->increment(Metrics::ReceivedMessages);
400 timer->deleteLater();
401 });
402 timer->start();
386 }403 }
387}404}
388405
389void TextChannelObserver::onPendingMessageRemoved(const Tp::ReceivedMessage &message)406void TextChannelObserver::onPendingMessageRemoved(const Tp::ReceivedMessage &message)
390{407{
391 QByteArray token(message.messageToken().toUtf8());408 QByteArray token(message.messageToken().toUtf8());
409 mUnreadMessages.removeAll(token);
392 MessagingMenu::instance()->removeMessage(token.toHex());410 MessagingMenu::instance()->removeMessage(token.toHex());
393}411}
394412
395413
=== modified file 'indicator/textchannelobserver.h'
--- indicator/textchannelobserver.h 2014-04-07 19:19:09 +0000
+++ indicator/textchannelobserver.h 2014-09-17 20:24:21 +0000
@@ -57,6 +57,7 @@
57 QList<Tp::TextChannelPtr> mChannels;57 QList<Tp::TextChannelPtr> mChannels;
58 QList<Tp::TextChannelPtr> mFlashChannels;58 QList<Tp::TextChannelPtr> mFlashChannels;
59 QMap<NotifyNotification*, NotificationData*> mNotifications;59 QMap<NotifyNotification*, NotificationData*> mNotifications;
60 QList<QByteArray> mUnreadMessages;
60};61};
6162
62#endif // TEXTCHANNELOBSERVER_H63#endif // TEXTCHANNELOBSERVER_H

Subscribers

People subscribed via source and target branches