Popup service

Merged username-removed-1496206 requested to merge popup-service into master

Created by: Jenselme

  • feat(Wait): add a static method to wait for a class

    This will allow us to wait for the popup to be displayed before trying to get its focus.

  • ref(game,popup): use a service to display popups

    Instead of injecting Game which is a page, we rely on a service Popup with a display method to display the popup.

    When the display method is called, it sends an event to aot-popup so it displays the popup. The method returns a promise so the API remains unchanged.

  • ref(popup): rename all occurences of done into defered

    This is a better name for this binding.

  • feat(popup): manage a stack of popup to display multiple popups sequentially

  • fix(popup): display transition popup on page reload

    Since services are instanciated first, we need to wait for aot-popup to be attached before trying to display a popup. To do that, we use a promise that is resolved once the AotPopupCustomElement emits aot:popup:ready. This event is emitted when the element is attached.

  • ref(popup): move cancel buttons on the right

    This is coherent with popups from other applications.

  • fix(popup): make cancel selectable with TAB on back-home popup

  • fix(popup): use a new instance of EventAggregatorSubscriptions

    It needs to be unique per service to work correctly.

  • feat(popup): close all opened popup when we change player

    Detect transition popup to close the opened popup (if any) and reset the stack of popup to an empty array. We the display the transition popup.

  • ref(popup): save full defered for displayed popupPromise

  • fix(popup): prevent error if no popups can be displayed

    If _displayNext was called without an opened popup and without a new popup to display, an error was thrown.

    This also prevent to register the callbacks on _displayedPopupDefered.promise more than once.

  • fix(popup): correct typo in variable name

  • test(popup): add tests for the popup service