Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Server Notifications on the Client #4567

Merged
merged 44 commits into from
Apr 4, 2016
Merged

Show Server Notifications on the Client #4567

merged 44 commits into from
Apr 4, 2016

Conversation

dragotin
Copy link
Contributor

This patch grew big already, before it grows even bigger, here is the pull request.

It implements the notifications from the server as requested in #3733

Still missing:

  • Proper icon
  • A regular check on new notifications
  • Make the notification widget disappear after a while when a button was clicked.

@danimo @ogoffart @ckamm @guruz

It is needed to easily send delete requests which happen
through the notify API.
It displays a server notification that can come with a dynamic
set of buttons next to a message and a subject (=header)
As interaction is required, the notifications are displayed in a
separate widget above the server activity list.

Note that design and also where we display the notifications can
still be discussed and changed.
Parse the replyCode from the button action calls and disable
buttons accordingly.
The isValid check should be used everywhere the capabilities
are used as the loading of the capabilities is happening
in parallel of the startup, so it is not guaranteed to be
available always.
Show a GUI notification once an hour if no new notifications arrive
to not annoy users.
Created a activitydata.h header (only) for the basic data, plus
a separate file for the model. Cleans up the widget source.
Add the hostname from where the notification comes, as well as
the name of the application to the header.
@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @guruz, @ogoffart and @ckamm to be potential reviewers

@guruz guruz added this to the 2.2.0-current milestone Mar 11, 2016
// restart the gui log timer now that we show a notification
_guiLogTimer.restart();

// Assemble a tray notification
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you can build strings this way. Even with translator comments This will break in all kind of funny ways e.g. with RTL languages. Also, with too many notifiers, the message cannot be parsed fast enough, so we should probably limit the amount of displayed notification sources (?) as well. You at have to account for three cases, with the n=2 one being optional:

  • n =1: tr("You received %n notifications from %1").arg(notifier)
  • n = 2: tr("You received %n notifications from %1 and %2").arg(notifiers.at(0), notifiers.at(1))
  • n > 2: tr("You received %n notifications from %1, %2 and others").arg(notifiers.at(0), notifiers.at(1) (ideally, we would specify a quantity for "others", but we cannot have more than one plural form in one tr()...

{
QList<AccountStatePtr> accounts = AccountManager::instance()->accounts();

foreach (AccountStatePtr asp, accounts) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const AccountStatePtr &

@dragotin
Copy link
Contributor Author

Thanks @ogoffart and @ckamm I think I reworked all according to your feedback.

@ogoffart
Copy link
Contributor

ogoffart commented Apr 4, 2016

👍

@dragotin dragotin merged commit 885f8b3 into master Apr 4, 2016
@ogoffart ogoffart deleted the notifications branch April 21, 2016 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants