From e0aea2ad1ffeb350ff0d161e3a6dc96e759e201c Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Wed, 6 May 2020 10:15:58 +0200
Subject: [PATCH] [enh] Home : change application name and welcome message, on
 readonly mode. [fix] Readonly mode: hide user menu items, in small device
 [fix] Help tour: Fix last help tour message, on readonly mode [fix] Help:
 HIde login/join help entries, on readonly mode

---
 app/config.json                           |  5 +++++
 resources/web-ext/manifest.json           |  2 +-
 scss/ionic.app.scss                       |  4 ++++
 www/i18n/locale-en-GB.json                |  7 +++++--
 www/i18n/locale-en.json                   |  7 +++++--
 www/i18n/locale-es-ES.json                |  5 +++--
 www/i18n/locale-fr-FR.json                |  5 +++--
 www/i18n/locale-it-IT.json                |  3 ++-
 www/js/config.js                          | 20 +++++++-------------
 www/js/controllers/help-controllers.js    |  2 +-
 www/plugins/es/templates/menu_extend.html |  2 +-
 www/templates/help/help.html              |  8 +++++++-
 www/templates/home/home.html              | 12 ++++++------
 www/templates/menu.html                   |  3 ++-
 14 files changed, 52 insertions(+), 33 deletions(-)

diff --git a/app/config.json b/app/config.json
index 3a4bc7ea1..0c3c148c5 100644
--- a/app/config.json
+++ b/app/config.json
@@ -2,6 +2,7 @@
   "default": {
     "cacheTimeMs": 300000,
     "demo": false,
+    "readonly": false,
     "fallbackLanguage": "en",
     "rememberMe": true,
     "showUDHistory": true,
@@ -111,6 +112,7 @@
   "default_fr": {
     "cacheTimeMs": 300000,
     "demo": false,
+    "readonly": false,
     "fallbackLanguage": "fr",
     "rememberMe": true,
     "showUDHistory": true,
@@ -217,6 +219,7 @@
   "g1-test": {
     "cacheTimeMs": 300000,
     "demo": false,
+    "readonly": false,
     "fallbackLanguage": "en",
     "rememberMe": true,
     "timeout": 300000,
@@ -273,6 +276,7 @@
   "dev": {
     "cacheTimeMs": 300000,
     "demo": false,
+    "readonly": false,
     "fallbackLanguage": "fr-FR",
     "defaultLanguage": "fr-FR",
     "rememberMe": true,
@@ -347,6 +351,7 @@
   "dev_g1": {
     "cacheTimeMs": 300000,
     "demo": false,
+    "readonly": false,
     "fallbackLanguage": "en",
     "rememberMe": true,
     "showUDHistory": true,
diff --git a/resources/web-ext/manifest.json b/resources/web-ext/manifest.json
index e29a8c6bb..626b6dbbe 100644
--- a/resources/web-ext/manifest.json
+++ b/resources/web-ext/manifest.json
@@ -1,7 +1,7 @@
 {
   "name": "Cesium",
   "short_name": "Cesium",
-  "version": "1.6.6",
+  "version": "1.6.7",
   "description": "Manage your Duniter Wallet on a libre currency, like Äž1",
   "background": {
     "scripts": ["background.js"]
diff --git a/scss/ionic.app.scss b/scss/ionic.app.scss
index ccded5817..0a544a5fc 100644
--- a/scss/ionic.app.scss
+++ b/scss/ionic.app.scss
@@ -936,6 +936,10 @@ html, body {
     font-size: 16px;
   }
 }
+#home h4.welcome .badge {
+  display: inline-block !important;
+  vertical-align: bottom;
+}
 #home .logo {
   margin-top: 15px;
   width: 100%;
diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json
index 9ff0a235e..34ff885a5 100644
--- a/www/i18n/locale-en-GB.json
+++ b/www/i18n/locale-en-GB.json
@@ -117,8 +117,10 @@
   },
   "HOME": {
     "TITLE": "Cesium",
-    "WELCOME": "Welcome to the Cesium Application!",
+    "WELCOME": "Welcome to the Cesium application!",
+    "WELCOME_READONLY": "Welcome to Cesium <span class='badge badge-balanced'>Monit</span> !",
     "MESSAGE": "Receive and send libre currency {{currency|abbreviate}}",
+    "MESSAGE_READONLY": "Libre currency {{currency|abbreviate}} real-time monitoring",
     "BTN_CURRENCY": "Explore currency",
     "BTN_ABOUT": "about",
     "BTN_HELP": "Help",
@@ -917,7 +919,8 @@
       "HEADER_BAR_BTN_PROFILE": "Click here to access your <b>user profile</b>",
       "SETTINGS_CHANGE_UNIT": "You can <b>change the display unit</b> of amounts by clicking here.<br/><br/>- Deactivate the option to show amounts in {{currency|capitalize}}.<br/>- Activate the option for relative amounts in {{'COMMON.UD'|translate}}<sub>{{currency|abbreviate}}</sub> (<b>divided</b> by the current Universal Dividend).",
       "END_LOGIN": "This guided visit has <b>ended</b>.<br/><br/>Welcome to the <b>free economy</b>!",
-      "END_NOT_LOGIN": "This guided visit has <b>ended</b>.<br/><br/>If you wish to join the currency {{currency|capitalize}}, simply click <b>{{'LOGIN.CREATE_FREE_ACCOUNT'|translate}}</b> below."
+      "END_NOT_LOGIN": "This guided visit has <b>ended</b>.<br/><br/>If you wish to join the currency {{currency|capitalize}}, simply click <b>{{'LOGIN.CREATE_FREE_ACCOUNT'|translate}}</b> below.",
+      "END_READONLY": "This guided visit has <b>ended</b>.<br/><br/>{{'MODE.READONLY.INSTALL_HELP'|translate}}."
     }
   },
   "API" :{
diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json
index 54bf66b23..e2bf4f5a6 100644
--- a/www/i18n/locale-en.json
+++ b/www/i18n/locale-en.json
@@ -117,8 +117,10 @@
   },
   "HOME": {
     "TITLE": "Cesium",
-    "WELCOME": "Welcome to the Cesium Application!",
+    "WELCOME": "Welcome to the Cesium application!",
+    "WELCOME_READONLY": "Welcome to Cesium <span class='badge badge-balanced'>Monit</span> !",
     "MESSAGE": "Receive and send libre currency {{currency|abbreviate}}",
+    "MESSAGE_READONLY": "Libre currency {{currency|abbreviate}} real-time monitoring",
     "BTN_CURRENCY": "Explore currency",
     "BTN_ABOUT": "about",
     "BTN_HELP": "Help",
@@ -917,7 +919,8 @@
       "HEADER_BAR_BTN_PROFILE": "Click here to access your <b>user profile</b>",
       "SETTINGS_CHANGE_UNIT": "You can <b>change the display unit</b> of amounts by clicking here.<br/><br/>- Deactivate the option to show amounts in {{currency|capitalize}}.<br/>- Activate the option for relative amounts in {{'COMMON.UD'|translate}}<sub>{{currency|abbreviate}}</sub> (<b>divided</b> by the current Universal Dividend).",
       "END_LOGIN": "This guided visit has <b>ended</b>.<br/><br/>Welcome to the <b>free economy</b>!",
-      "END_NOT_LOGIN": "This guided visit has <b>ended</b>.<br/><br/>If you wish to join the currency {{currency|capitalize}}, simply click <b>{{'LOGIN.CREATE_FREE_ACCOUNT'|translate}}</b> below."
+      "END_NOT_LOGIN": "This guided visit has <b>ended</b>.<br/><br/>If you wish to join the currency {{currency|capitalize}}, simply click <b>{{'LOGIN.CREATE_FREE_ACCOUNT'|translate}}</b> below.",
+      "END_READONLY": "This guided visit has <b>ended</b>.<br/><br/>{{'MODE.READONLY.INSTALL_HELP'|translate}}."
     }
   },
   "API" :{
diff --git a/www/i18n/locale-es-ES.json b/www/i18n/locale-es-ES.json
index 434951ef7..e8c61e74e 100644
--- a/www/i18n/locale-es-ES.json
+++ b/www/i18n/locale-es-ES.json
@@ -1008,8 +1008,9 @@
       "MENU_BTN_SETTINGS": "En <b>{{'MENU.SETTINGS'|translate}}</b> podrá configurar la aplicación.",
       "HEADER_BAR_BTN_PROFILE": "Haga clic aquí para acceder a su <b>perfil</b>",
       "SETTINGS_CHANGE_UNIT": "Podrá <b>cambiar la unidad de visualización</b> de los importes haciendo clic aquí.<br/><br/>- Desactive la opción para mostrar los importes en {{currency|capitalize}}.<br/>- Actívela para importes relativos al {{'COMMON.UD'|translate}}<sub>{{currency|abbreviate}}</sub> (las cantidades de los importes se mostrarán <b>divididos</b> entre el Dividendo Universal actual).",
-      "END_LOGIN": "¡La visita guiada ha <b>terminado</b>!<br/><br/>¡Buena suerte en este nuevo mundo de la <b>economía libre</b> !",
-      "END_NOT_LOGIN": "¡La visita guiada ha <b>terminado</b>!<br/><br/>Si quiere utilizar la moneda {{currency|capitalize}}, tiene que hacer un clic en <b>{{'LOGIN.CREATE_ACCOUNT'|translate}}</b> más abajo."
+      "END_LOGIN": "La visita guiada ha <b>terminado</b>.<br/><br/>¡Buena suerte en este nuevo mundo de la <b>economía libre</b> !",
+      "END_NOT_LOGIN": "La visita guiada ha <b>terminado</b>.<br/><br/>Si quiere utilizar la moneda {{currency|capitalize}}, tiene que hacer un clic en <b>{{'LOGIN.CREATE_ACCOUNT'|translate}}</b> más abajo.",
+      "END_READONLY": "La visita guiada ha <b>terminado</b>.<br/><br/>{{'MODE.READONLY.INSTALL_HELP'|translate}}."
     }
   }
 }
diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json
index 3882270c3..8697651df 100644
--- a/www/i18n/locale-fr-FR.json
+++ b/www/i18n/locale-fr-FR.json
@@ -118,7 +118,7 @@
   "HOME": {
     "TITLE": "Cesium",
     "WELCOME": "Bienvenue dans l'application Cesium !",
-    "WELCOME_READONLY": "Bienvenue dans Cesium Monit !",
+    "WELCOME_READONLY": "Bienvenue dans Cesium <span class='badge badge-balanced'>Monit</span> !",
     "MESSAGE": "Recevez et envoyez de la monnaie libre {{currency|abbreviate}}",
     "MESSAGE_READONLY": "Suivez l'état de la monnaie libre {{currency|abbreviate}} en temps réel.",
     "BTN_CURRENCY": "Explorer la monnaie {{currency|abbreviate}}",
@@ -923,7 +923,8 @@
       "HEADER_BAR_BTN_PROFILE": "Cliquez ici pour accéder à votre <b>profil utilisateur.</b>",
       "SETTINGS_CHANGE_UNIT": "Vous pourrez <b>changer d'unité d'affichage</b> des montants en cliquant ci-dessus.<br/><br/>- Désactivez l'option pour un affichage des montants en {{currency|capitalize}}.<br/>- Activez l'option pour un affichage relatif en {{'COMMON.UD'|translate}}<sub>{{currency|abbreviate}}</sub> (tous les montants seront <b>divisés</b> par le Dividende Universel courant).",
       "END_LOGIN": "Cette visite guidée est <b>terminée</b> !<br/><br/>Bonne continuation à vous, dans le nouveau monde de l'<b>économie libre</b> !",
-      "END_NOT_LOGIN": "Cette visite guidée est <b>terminée</b> !<br/><br/>Si vous souhaitez rejoindre la monnaie {{currency|capitalize}}, il vous suffira de cliquer sur <b>{{'LOGIN.CREATE_FREE_ACCOUNT'|translate}}</b> ci-dessous."
+      "END_NOT_LOGIN": "Cette visite guidée est <b>terminée</b> !<br/><br/>Si vous souhaitez rejoindre la monnaie {{currency|capitalize}}, il vous suffira de cliquer sur <b>{{'LOGIN.CREATE_FREE_ACCOUNT'|translate}}</b> ci-dessous.",
+      "END_READONLY": "Cette visite guidée est <b>terminée</b>.<br/><br/>{{'MODE.READONLY.INSTALL_HELP'|translate}}."
     }
   },
   "API" :{
diff --git a/www/i18n/locale-it-IT.json b/www/i18n/locale-it-IT.json
index 3d02036c2..12ad7c43a 100644
--- a/www/i18n/locale-it-IT.json
+++ b/www/i18n/locale-it-IT.json
@@ -828,7 +828,8 @@
        "HEADER_BAR_BTN_PROFILE": "Clicca qui per entrare nel <b>tuo profilo utente</b>",
        "SETTINGS_CHANGE_UNIT": "Puoi cambiare <b>l'unità</b> della moneta cliccando qui.<br/><br/>- Disabilita questa opzione per vedere gli importi in {{currency|capitalize}}.<br/>- Abilita l'opzione per importi relativi in {{'COMMON.UD'|translate}}<sub>{{currency|abbreviate}}</sub> (<b>divisi</b> dal attuale Dividendo Universale).",
        "END_LOGIN": "Il tour guidato <b>è finito</b>.<br/><br/>Benvenuto nel <b>economia libera</b>!",
-       "END_NOT_LOGIN": "Il tour guidato <b>è finito</b>.<br/><br/>Se desideri entrare nella Web of Trust {{currency|capitalize}}, basta cliccare <b>{{'LOGIN.CREATE_ACCOUNT'|translate}}</b> qui sotto."
+       "END_NOT_LOGIN": "Il tour guidato <b>è finito</b>.<br/><br/>Se desideri entrare nella Web of Trust {{currency|capitalize}}, basta cliccare <b>{{'LOGIN.CREATE_ACCOUNT'|translate}}</b> qui sotto.",
+       "END_READONLY": "Il tour guidato <b>è finito</b>.<br/><br/>{{'MODE.READONLY.INSTALL_HELP'|translate}}."
      }
    },
   "API" :{
diff --git a/www/js/config.js b/www/js/config.js
index ab9233e59..c18ad1bc1 100644
--- a/www/js/config.js
+++ b/www/js/config.js
@@ -10,12 +10,12 @@ angular.module("cesium.config", [])
 
 .constant("csConfig", {
 	"cacheTimeMs": 300000,
-	"demo": false,
+	"demo": true,
   "readonly": true,
-	"fallbackLanguage": "en",
+	"fallbackLanguage": "fr",
 	"rememberMe": true,
 	"showUDHistory": true,
-	"timeout": 40000,
+	"timeout": 300000,
 	"timeWarningExpireMembership": 5184000,
 	"timeWarningExpire": 7776000,
 	"keepAuthIdle": 600,
@@ -24,7 +24,7 @@ angular.module("cesium.config", [])
 	"expertMode": false,
 	"decimalCount": 2,
 	"httpsMode": false,
-	"shareBaseUrl": "https://demo.cesium.app",
+	"shareBaseUrl": "https://demo.cesium.app/",
 	"helptip": {
 		"enable": true,
 		"installDocUrl": {
@@ -33,8 +33,8 @@ angular.module("cesium.config", [])
 		}
 	},
 	"license": {
-		"en": "license/license_g1-en",
 		"fr-FR": "license/license_g1-fr-FR",
+		"en": "license/license_g1-en",
 		"es-ES": "license/license_g1-es-ES",
 		"eo-EO": "license/license_g1-eo-EO"
 	},
@@ -83,12 +83,6 @@ angular.module("cesium.config", [])
 			"port": 443
 		}
 	],
-	"developers": [
-		{
-			"name": "Benoit Lavenier",
-			"pubkey": "38MEAZN68Pz1DTvT3tqgxx4yQP6snJCQhPqEFxbDk4aE"
-		}
-	],
 	"plugins": {
 		"es": {
 			"enable": true,
@@ -119,8 +113,8 @@ angular.module("cesium.config", [])
 			"defaultCountry": "France"
 		}
 	},
-	"version": "1.6.6",
-	"build": "2020-05-01T15:36:33.163Z",
+	"version": "1.6.7",
+	"build": "2020-05-05T19:19:12.082Z",
 	"newIssueUrl": "https://git.duniter.org/clients/cesium-grp/cesium/issues/new"
 })
 
diff --git a/www/js/controllers/help-controllers.js b/www/js/controllers/help-controllers.js
index 9d567d409..eeb7336a8 100644
--- a/www/js/controllers/help-controllers.js
+++ b/www/js/controllers/help-controllers.js
@@ -1213,7 +1213,7 @@ function HelpTipController($scope, $state, $window, $ionicSideMenuDelegate, $tim
         .then(function(){
           return $scope.showHelpTip('helptip-home-logo', {
            bindings: {
-             content: 'HELP.TIP.END_NOT_LOGIN',
+             content: !csConfig.readonly ? 'HELP.TIP.END_NOT_LOGIN' : 'HELP.TIP.END_READONLY',
              contentParams: contentParams,
              hasNext: false
            }
diff --git a/www/plugins/es/templates/menu_extend.html b/www/plugins/es/templates/menu_extend.html
index d82eae374..1efa88069 100644
--- a/www/plugins/es/templates/menu_extend.html
+++ b/www/plugins/es/templates/menu_extend.html
@@ -39,7 +39,7 @@
 </div>
 
 <!-- Left menu: User section -->
-<div ng-if=":state:enable && extensionPoint === 'menu-user'" class="visible-xs visible-sm">
+<div ng-if=":state:enable && extensionPoint === 'menu-user' && !$root.config.readonly" class="visible-xs visible-sm">
 
   <a menu-close class="item item-icon-left" active-link="active"
      ng-if="login && walletData.isMember"
diff --git a/www/templates/help/help.html b/www/templates/help/help.html
index 40c81e485..bf346d745 100644
--- a/www/templates/help/help.html
+++ b/www/templates/help/help.html
@@ -20,7 +20,8 @@
   </div>
 </div>
 
-<a name="join"></a>
+<div class="hidden-readonly">
+  <a name="join"></a>
   <h2 translate>HELP.JOIN.SECTION</h2>
 
     <a name="join-salt"></a>
@@ -43,7 +44,9 @@
       <div class="col col-20" translate>ACCOUNT.NEW.PSEUDO</div>
       <div class="col" translate>HELP.JOIN.PSEUDO</div>
     </div>
+</div>
 
+<div class="hidden-readonly">
   <a name="login"></a>
   <h2 translate>HELP.LOGIN.SECTION</h2>
 
@@ -60,7 +63,9 @@
     <div class="col col-20" translate>HELP.LOGIN.METHOD</div>
     <div class="col" translate>HELP.LOGIN.METHOD_DEF</div>
   </div>
+</div>
 
+<div>
   <a name="glossary"></a>
   <h2 translate>HELP.GLOSSARY.SECTION</h2>
 
@@ -113,3 +118,4 @@
     <div class="col col-20" translate>HELP.GLOSSARY.DISTANCE_RULE</div>
     <div class="col" translate>HELP.GLOSSARY.DISTANCE_RULE_DEF</div>
   </div>
+</div>
diff --git a/www/templates/home/home.html b/www/templates/home/home.html
index a30058c89..08daf0f11 100644
--- a/www/templates/home/home.html
+++ b/www/templates/home/home.html
@@ -13,7 +13,8 @@
     </button>
   </ion-nav-buttons>
 
-  <ion-content class="positive-900-bg circle-bg-dark">
+  <ion-content class="circle-bg-dark"
+  ng-class="::{'positive-900-bg': !$root.config.readonly, 'balanced-900-bg': $root.config.readonly}">
 
     <div class="ribbon" ng-if="::$root.config.demo || $root.config.readonly">
       <a class="badge badge-assertive" ng-if="$root.config.demo"  ng-click="showHelpModal('demo')">{{:locale:'MODE.DEMO.BADGE'|translate}}</a>
@@ -29,13 +30,12 @@
         <div id="helptip-home-logo" class="logo">
         </div>
 
-        <h4 ng-if="::!$root.config.readonly">
-          <span class="hidden-xs" translate>HOME.WELCOME</span>
+        <h4 class="welcome" ng-if="::!$root.config.readonly">
+          <p class="hidden-xs" translate>HOME.WELCOME</p>
           <b ng-show="!loading" translate-values=":currency:{currency: $root.currency.name}" translate>HOME.MESSAGE</b>
         </h4>
-
-        <h4 ng-if="::$root.config.readonly">
-          <span class="hidden-xs" translate>HOME.WELCOME_READONLY</span>
+        <h4 class="welcome" ng-if="::$root.config.readonly">
+          <p translate>HOME.WELCOME_READONLY</p>
           <b ng-show="!loading" translate-values=":currency:{currency: $root.currency.name}" translate>HOME.MESSAGE_READONLY</b>
         </h4>
 
diff --git a/www/templates/menu.html b/www/templates/menu.html
index 79b34e896..a3c126cbd 100644
--- a/www/templates/menu.html
+++ b/www/templates/menu.html
@@ -32,7 +32,8 @@
 
         <!-- profile -->
         <a id="helptip-header-bar-btn-profile"
-           class="button button-icon button-clear hidden-xs hidden-sm hidden-readonly"
+           class="button button-icon button-clear hidden-xs hidden-sm"
+           ng-if="::!$root.config.readonly"
            ng-click="showProfilePopover($event)">
           <i class="avatar avatar-member"
              ng-if="!walletData.avatar"
-- 
GitLab