From 6c591ab04c9b35db64d0368a8bb0c711ac15074a Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Tue, 23 Mar 2021 17:30:43 +0100
Subject: [PATCH] [enh] Settings: Allow to disable UI Effects

---
 www/i18n/locale-en-GB.json                 | 1 +
 www/i18n/locale-en.json                    | 1 +
 www/i18n/locale-fr-FR.json                 | 5 +++--
 www/js/controllers/settings-controllers.js | 3 +++
 www/js/services/settings-services.js       | 5 ++---
 www/js/services/utils-services.js          | 2 +-
 www/templates/settings/settings.html       | 6 ++++--
 7 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json
index 11fe846af..0c45db49c 100644
--- a/www/i18n/locale-en-GB.json
+++ b/www/i18n/locale-en-GB.json
@@ -154,6 +154,7 @@
     "ENABLE_HELPTIP": "Enable contextual help tips",
     "DISABLE_HELPTIP": "Disable contextual help tips",
     "ENABLE_UI_EFFECTS": "Enable visual effects",
+    "ENABLE_UI_EFFECTS_HELP": "Transition between pages, animation of lists",
     "HISTORY_SETTINGS": "Account operations",
     "DISPLAY_UD_HISTORY": "Display produced dividends?",
     "TX_HISTORY_AUTO_REFRESH": "Enable automatic refresh?",
diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json
index 3e5f959f2..c96c2d635 100644
--- a/www/i18n/locale-en.json
+++ b/www/i18n/locale-en.json
@@ -154,6 +154,7 @@
     "ENABLE_HELPTIP": "Enable contextual help tips",
     "DISABLE_HELPTIP": "Disable contextual help tips",
     "ENABLE_UI_EFFECTS": "Enable visual effects",
+    "ENABLE_UI_EFFECTS_HELP": "Transition between pages, animation of list",
     "HISTORY_SETTINGS": "Account operations",
     "DISPLAY_UD_HISTORY": "Display produced dividends?",
     "TX_HISTORY_AUTO_REFRESH": "Enable automatic refresh?",
diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json
index 51421335c..af01a10aa 100644
--- a/www/i18n/locale-fr-FR.json
+++ b/www/i18n/locale-fr-FR.json
@@ -151,9 +151,10 @@
     "WALLETS_SETTINGS": "Mes portefeuilles",
     "USE_WALLETS_ENCRYPTION": "Sécuriser la liste ?",
     "USE_WALLETS_ENCRYPTION_HELP": "Permet de sécuriser la liste de vos portefeuilles (par chiffrement), en exigeant une authentification pour y accéder.",
-    "ENABLE_HELPTIP": "Activer les bulles d'aide contextuelles",
+    "ENABLE_HELPTIP": "Activer les bulles d'aide contextuelles ?",
     "DISABLE_HELPTIP": "Désactiver les bulles d'aide contextuelles",
-    "ENABLE_UI_EFFECTS": "Activer les effets visuels",
+    "ENABLE_UI_EFFECTS": "Activer les effets visuels ?",
+    "ENABLE_UI_EFFECTS_HELP": "Transition entre les pages, animation des listes, etc.",
     "HISTORY_SETTINGS": "Mes opérations",
     "DISPLAY_UD_HISTORY": "Afficher les dividendes produits ?",
     "TX_HISTORY_AUTO_REFRESH": "Rafraîchir automatiquement",
diff --git a/www/js/controllers/settings-controllers.js b/www/js/controllers/settings-controllers.js
index 0239a70f4..2e7082d32 100644
--- a/www/js/controllers/settings-controllers.js
+++ b/www/js/controllers/settings-controllers.js
@@ -291,6 +291,9 @@ function SettingsController($scope, $q, $window, $ionicHistory, $ionicPopup, $ti
       // Applying
       csSettings.apply($scope.formData);
 
+      // Applying UI effect
+      UIUtils.setEffects($scope.formData.uiEffects);
+
       // Store
       return csSettings.store();
 
diff --git a/www/js/services/settings-services.js b/www/js/services/settings-services.js
index 26d7199be..c79925b2a 100644
--- a/www/js/services/settings-services.js
+++ b/www/js/services/settings-services.js
@@ -163,7 +163,7 @@ angular.module('cesium.settings.services', ['ngApi', 'cesium.config'])
 
   store = function() {
     if (!started) {
-      console.debug('[setting] Waiting start finished...');
+      console.debug('[settings] Waiting start finished...');
       return (startPromise || start()).then(store);
     }
 
@@ -190,7 +190,7 @@ angular.module('cesium.settings.services', ['ngApi', 'cesium.config'])
     return promise
       .then(function() {
         if (data.useLocalStorage) {
-          console.debug('[setting] Saved locally');
+          console.debug('[settings] Saved locally');
         }
 
         // Emit event on store
@@ -232,7 +232,6 @@ angular.module('cesium.settings.services', ['ngApi', 'cesium.config'])
     if (localeChanged) {
       $translate.use(data.locale.id);
     }
-
   },
 
   restore = function() {
diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js
index 215863dc9..764fd5777 100644
--- a/www/js/services/utils-services.js
+++ b/www/js/services/utils-services.js
@@ -713,7 +713,7 @@ angular.module('cesium.utils.services', ['angular-fullscreen-toggle'])
   }
 
   function setEffects(enable) {
-    if (exports.motion.enable === enable) return; // same
+    if (exports.motion.enable === enable) return; // unchanged
     console.debug('[UI] [effects] ' + (enable ? 'Enable' : 'Disable'));
 
     exports.motion.enable = enable;
diff --git a/www/templates/settings/settings.html b/www/templates/settings/settings.html
index 85edf849b..450db38b3 100644
--- a/www/templates/settings/settings.html
+++ b/www/templates/settings/settings.html
@@ -63,16 +63,18 @@
           </label>
         </div>
 
-        <!--div class="item item-toggle dark item-text-wrap">
+        <div class="item item-toggle dark item-text-wrap">
           <div class="input-label" ng-bind-html="'SETTINGS.ENABLE_UI_EFFECTS' | translate">
           </div>
+          <h4 class="gray" ng-bind-html="'SETTINGS.ENABLE_UI_EFFECTS_HELP' | translate">
+          </h4>
           <label class="toggle toggle-royal">
             <input type="checkbox" ng-model="formData.uiEffects" >
             <div class="track">
               <div class="handle"></div>
             </div>
           </label>
-        </div-->
+        </div>
 
         <span class="item item-divider" translate>SETTINGS.STORAGE_DIVIDER</span>
 
-- 
GitLab