From f2b67cfaae39ed489c1ea61f7874c7a19e3b8f89 Mon Sep 17 00:00:00 2001 From: finico Date: Tue, 18 Jun 2019 13:23:39 +0300 Subject: [PATCH 1/3] DEXW-1787: Hide mobile toaster if it was closed by user --- src/modules/ui/directives/footer/Footer.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/modules/ui/directives/footer/Footer.js b/src/modules/ui/directives/footer/Footer.js index c13da63b4b..dc29fee54b 100644 --- a/src/modules/ui/directives/footer/Footer.js +++ b/src/modules/ui/directives/footer/Footer.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - const controller = function (Base, $element) { + const controller = function (Base, $element, storage) { class FooterCtrl extends Base { @@ -20,6 +20,12 @@ * @type {string} */ lang; + /** + * @private + * @readonly + * @type {string} + */ + _toasterMobilesStorageKey = 'toasterMobilesHidden'; constructor() { super(); @@ -34,6 +40,12 @@ 'https://t.me/WavesCommunity'; this.lang = localStorage.getItem('lng') === 'ru' ? 'Ru' : 'Global'; + + storage.load(this._toasterMobilesStorageKey).then(wasHidden => { + if (wasHidden) { + $element.find('.toaster-mobiles').hide(); + } + }); } /** @@ -41,6 +53,8 @@ */ hideToaster() { $element.find('.toaster-mobiles').addClass('hidden-toaster'); + + storage.save(this._toasterMobilesStorageKey, true); } } @@ -48,7 +62,7 @@ return new FooterCtrl(); }; - controller.$inject = ['Base', '$element']; + controller.$inject = ['Base', '$element', 'storage']; angular.module('app.ui').component('wFooter', { templateUrl: 'modules/ui/directives/footer/footer.html', From 24484fed44a72e7518f11d0f665fd75e79ca9d00 Mon Sep 17 00:00:00 2001 From: finico Date: Tue, 18 Jun 2019 14:36:19 +0300 Subject: [PATCH 2/3] DEXW-1787: Use [ng-if] instead of hiding element --- src/modules/ui/directives/footer/Footer.js | 9 ++++++--- src/modules/ui/directives/footer/footer.html | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/modules/ui/directives/footer/Footer.js b/src/modules/ui/directives/footer/Footer.js index dc29fee54b..a6d1bb7df3 100644 --- a/src/modules/ui/directives/footer/Footer.js +++ b/src/modules/ui/directives/footer/Footer.js @@ -20,6 +20,11 @@ * @type {string} */ lang; + /** + * @public + * @type {boolean} + */ + isToasterMobilesVisible; /** * @private * @readonly @@ -42,9 +47,7 @@ this.lang = localStorage.getItem('lng') === 'ru' ? 'Ru' : 'Global'; storage.load(this._toasterMobilesStorageKey).then(wasHidden => { - if (wasHidden) { - $element.find('.toaster-mobiles').hide(); - } + this.isToasterMobilesVisible = !wasHidden; }); } diff --git a/src/modules/ui/directives/footer/footer.html b/src/modules/ui/directives/footer/footer.html index 0d98719ab7..42579a9e3a 100644 --- a/src/modules/ui/directives/footer/footer.html +++ b/src/modules/ui/directives/footer/footer.html @@ -92,7 +92,7 @@ -