diff --git a/config.xml b/config.xml index 11c90352cd1eaf4d18d860a6c20af89083330dba..a78377a3934cd4b517f1864291c003f8eeac89b9 100644 --- a/config.xml +++ b/config.xml @@ -3,8 +3,8 @@ xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" id="fr.duniter.cesium" - version="0.1.27" - android-versionCode="14" + version="0.1.28" + android-versionCode="15" > <name>Cesium</name> <description> diff --git a/package.json b/package.json index 5bdb2528bf1f67f498ec59509f2590fcdbc2caf6..e9a56de3ffc9ec9577594752b1f58c15ff9c785e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cesium", - "version": "0.1.27", + "version": "0.1.28", "description": "Unhosted webapp client for Duniter network", "dependencies": { "delete-empty": "^0.1.3", diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index 0eae981512b729b700b21024ba91a83a49e8efe7..d1c23bdccc8439e136f36de6b98cf5851e6df253 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -69,7 +69,7 @@ "BTN_MARKET": "Market place", "BTN_CURRENCIES": "Explore currencies", "BTN_CURRENCY": "Explore currency", - "BTN_ABOUT": "About", + "BTN_ABOUT": "about", "BTN_ACCOUNT": "My Account", "REPORT_ISSUE": "Report an issue" }, diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 063d5c699c0b239fc3ca3a047ce029726feee1fd..110ff1b7bdf6a4888dc8ea0ea4b4b75b27390670 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -69,7 +69,7 @@ "BTN_MARKET": "Offres/demandes", "BTN_CURRENCIES": "Explorer les monnaies", "BTN_CURRENCY": "Explorer la monnaie", - "BTN_ABOUT": "A propos", + "BTN_ABOUT": "Ã propos", "BTN_ACCOUNT": "Mon compte", "REPORT_ISSUE": "anomalie" }, diff --git a/www/js/config.js b/www/js/config.js index 3bc00880fd6201e4feab15b303f679834de05d1b..62912cf4411b94b67cd78f5e04e1d9da17357624 100644 --- a/www/js/config.js +++ b/www/js/config.js @@ -13,8 +13,8 @@ angular.module("cesium.config", []) "NEW_ISSUE_LINK": "https://github.com/duniter/cesium/issues/new?labels=bug", "TIMEOUT": 4000, "DEBUG": false, - "VERSION": "0.1.27", - "BUILD_DATE": "2016-08-18T14:32:54.704Z" + "VERSION": "0.1.28", + "BUILD_DATE": "2016-08-18T16:43:00.994Z" }) ; \ No newline at end of file diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index ca56874604607f6ab76f43d0b3f41eb2d4172135..3f2859bec3731d018c94b6a0351a7fb5b4486eaa 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -8,6 +8,9 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser Wallet = function(id) { var + events = { + SETTINGS: 'wallet-settings-changed' + }, defaultSettings = { useRelative: true, @@ -201,41 +204,51 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser return isLogin() && data.pubkey === pubkey; }, - store = function() { + store = function(options) { if (data.settings.useLocalStorage) { - localStorage.setObject('CESIUM_SETTINGS', data.settings); - if (isLogin() && data.settings.rememberMe) { - var dataToStore = { - keypair: data.keypair, - pubkey: data.pubkey - }; + if (!options || options.settings) { + localStorage.setObject('CESIUM_SETTINGS', data.settings); + // Send event when settings changed + $rootScope.$broadcast(events.SETTINGS); + } - if (data.tx && data.tx.pendings && data.tx.pendings.length>0) { - var pendings = data.tx.pendings.reduce(function(res, tx){ - return tx.time ? res.concat({ - amount: tx.amount, - time: tx.time, - hash: tx.hash - }) : res; - }, []); - if (pendings.length) { - dataToStore.tx = { - pendings: pendings - }; + if (!options || options.data) { + if (isLogin() && data.settings.rememberMe) { + var dataToStore = { + keypair: data.keypair, + pubkey: data.pubkey + }; + + if (data.tx && data.tx.pendings && data.tx.pendings.length>0) { + var pendings = data.tx.pendings.reduce(function(res, tx){ + return tx.time ? res.concat({ + amount: tx.amount, + time: tx.time, + hash: tx.hash + }) : res; + }, []); + if (pendings.length) { + dataToStore.tx = { + pendings: pendings + }; + } } - } - localStorage.setObject('CESIUM_DATA', dataToStore); - } - else { - localStorage.setObject('CESIUM_DATA', null); + localStorage.setObject('CESIUM_DATA', dataToStore); + } + else { + localStorage.setObject('CESIUM_DATA', null); + } } } else { localStorage.setObject('CESIUM_SETTINGS', null); localStorage.setObject('CESIUM_DATA', null); + // Send event when settings changed + $rootScope.$broadcast(events.SETTINGS); } + }, restore = function() { @@ -1059,7 +1072,8 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser toJson: toJson, fromJson: fromJson, defaultSettings: defaultSettings, - api: api + api: api, + events: events }; }; diff --git a/www/plugins/es/i18n/locale-en.json b/www/plugins/es/i18n/locale-en.json index 7ca7936e18e3cd08703c3517b44975d05d792620..0cda4e4cff3363fc9cef3b576fac7e372ca5832a 100644 --- a/www/plugins/es/i18n/locale-en.json +++ b/www/plugins/es/i18n/locale-en.json @@ -143,11 +143,11 @@ "PROFILE_SAVED": "Profile saved" } }, - "SETTINGS": { + "ES_SETTINGS": { "PLUGIN_NAME": "Registry and market place", "ENABLE_TOGGLE": "Enable extension ?", - "ES_NODE": "Data node address", - "ES_NODE_HELP": "server.domain.com:port", + "NODE": "Data node address", + "NODE_HELP": "server.domain.com:port", "POPUP_NODE": { "TITLE" : "Data Node", "HELP" : "Set the address of the node to use:" diff --git a/www/plugins/es/js/controllers/common-controllers.js b/www/plugins/es/js/controllers/common-controllers.js index c017bb44487b84e68e452d13123dcfc4e87a3474..ea8c965f02a31c8f0a1cf10c5b53b9cf1b20d530 100644 --- a/www/plugins/es/js/controllers/common-controllers.js +++ b/www/plugins/es/js/controllers/common-controllers.js @@ -1,4 +1,4 @@ -angular.module('cesium.es.common.controllers', ['cesium.es.services']) +angular.module('cesium.es.common.controllers', ['ngResource', 'cesium.es.services']) // Configure menu items .config(function(PluginServiceProvider, APP_CONFIG) { @@ -36,13 +36,19 @@ angular.module('cesium.es.common.controllers', ['cesium.es.services']) /** * Control menu extension */ -function ESMenuExtendController($scope, PluginService, Wallet) { +function ESMenuExtendController($scope, $rootScope, PluginService, Wallet, APP_CONFIG) { 'ngInject'; $scope.extensionPoint = PluginService.extensions.points.current.get(); - $scope.es = Wallet.data.settings.plugins && Wallet.data.settings.plugins.es ? Wallet.data.settings.plugins.es : { - enable: false + $scope.refreshEnable = function() { + $scope.enable = Wallet.data && Wallet.data.settings.plugins && Wallet.data.settings.plugins.es ? + Wallet.data.settings.plugins.es.enable : + !!APP_CONFIG.DUNITER_NODE_ES }; + + $rootScope.$on(Wallet.events.SETTINGS, $scope.refreshEnable); + + $scope.refreshEnable(); } function ESPicturesEditController($scope, $ionicModal, Wallet, esMarket, UIUtils, $state, CryptoUtils, $q, $ionicPopup, Device, $timeout, ModalUtils) { diff --git a/www/plugins/es/js/controllers/settings-controllers.js b/www/plugins/es/js/controllers/settings-controllers.js index 462b3a0ab8a86d7b2b256d68a5cd251e82932497..954188b80be617b2cb4e7098ebc4c1c38e96678f 100644 --- a/www/plugins/es/js/controllers/settings-controllers.js +++ b/www/plugins/es/js/controllers/settings-controllers.js @@ -38,7 +38,8 @@ angular.module('cesium.es.settings.controllers', ['cesium.es.services']) /* * Settings extend controller */ -function ESExtendSettingsController ($scope, Wallet, PluginService, APP_CONFIG) { +function ESExtendSettingsController ($scope, $rootScope, Wallet, PluginService, APP_CONFIG) { + 'ngInject'; $scope.extensionPoint = PluginService.extensions.points.current.get(); $scope.enable = false; @@ -59,20 +60,27 @@ function ESExtendSettingsController ($scope, Wallet, PluginService, APP_CONFIG) /* * Settings extend controller */ -function ESPluginSettingsController ($scope, $q, $translate, $ionicPopup, $ionicHistory, UIUtils, APP_CONFIG, esHttp, esMarket, +function ESPluginSettingsController ($scope, $rootScope, $q, $translate, $ionicPopup, $ionicHistory, UIUtils, APP_CONFIG, esHttp, esMarket, esRegistry, esUser, Wallet) { + 'ngInject'; $scope.formData = {}; + $scope.loading = true; $scope.$on('$ionicView.enter', function(e, $state) { - if (!$scope.formData.node && APP_CONFIG.DUNITER_NODE_ES) { + if (!$scope.formData.node) { if (Wallet.data.settings && Wallet.data.settings.plugins && Wallet.data.settings.plugins.es) { angular.merge($scope.formData, Wallet.data.settings.plugins.es); } else { $scope.formData.enable = !!APP_CONFIG.DUNITER_NODE_ES; + + } + if (!$scope.formData.node) { + $scope.formData.node = APP_CONFIG.DUNITER_NODE_ES; } } + $scope.loading = false; }); $scope.setSettingsForm = function(settingsForm) { @@ -155,11 +163,9 @@ function ESPluginSettingsController ($scope, $q, $translate, $ionicPopup, $ioni $scope.onSettingsChanged = function() { if ($scope.loading) { - $timeout(function() { - $scope.onSettingsChanged(); - }, 200); return; } + $scope.loading = true; if (!Wallet.data.settings.plugins) { @@ -176,7 +182,7 @@ function ESPluginSettingsController ($scope, $q, $translate, $ionicPopup, $ioni esHttp.setEnable($scope.formData.enable); esUser.refreshListeners(); - Wallet.store(); + Wallet.store({settings: true, data: false}); // Clean cache $ionicHistory.clearCache(); diff --git a/www/plugins/es/templates/menu_extend.html b/www/plugins/es/templates/menu_extend.html index d78b145331b98c27756f258090b2209c25f93114..5968b51ee0e5a1c76d7ecc299e33ae040d774455 100644 --- a/www/plugins/es/templates/menu_extend.html +++ b/www/plugins/es/templates/menu_extend.html @@ -1,6 +1,6 @@ <!-- Main section --> -<ng-if ng-if="es.enable && extensionPoint === 'menu-main'"> +<ng-if ng-if="enable && extensionPoint === 'menu-main'"> <!-- professionals registry--> <ion-item menu-close class="item item-icon-left" active-link="active" @@ -18,7 +18,7 @@ </ng-if> <!-- User section --> -<ng-if ng-if="es.enable && extensionPoint === 'menu-user'"> +<ng-if ng-if="enable && extensionPoint === 'menu-user'"> <!-- user profile --> <ion-item menu-close class="item item-icon-left" active-link="active" ng-if="isLogin()" diff --git a/www/plugins/es/templates/settings/settings_extend.html b/www/plugins/es/templates/settings/settings_extend.html index 38cae82b5b92e823edd1d94475de5c2dd28c53d1..0d9d277f92f5889de75d85a2417f88d97b05ee4f 100644 --- a/www/plugins/es/templates/settings/settings_extend.html +++ b/www/plugins/es/templates/settings/settings_extend.html @@ -1,4 +1,6 @@ +<span class="item item-divider" translate>SETTINGS.PLUGINS_SETTINGS</span> + <div class="item ink" ui-sref="app.es_settings"> <div class="input-label ng-binding" translate>ES_SETTINGS.PLUGIN_NAME</div> diff --git a/www/templates/menu.html b/www/templates/menu.html index b1b85741a78827aa4f5b6de382b27ec31c9c827c..2624b789fc209a61892856819f7e8312c964ae17 100644 --- a/www/templates/menu.html +++ b/www/templates/menu.html @@ -125,7 +125,7 @@ <span translate="COMMON.APP_VERSION" translate-values="{version: config.VERSION}"></span> | <!-- about --> - <a href="#" ng-click="showAboutModal()" translate>HOME.BTN_ABOUT</a> + <a ng-click="showAboutModal()" translate>HOME.BTN_ABOUT</a> </h1> </ion-footer-bar> </ion-side-menu> diff --git a/www/templates/settings/settings.html b/www/templates/settings/settings.html index 8747d982fafc42900f1aa4ad63a2d00a67d4b4aa..a26847a4f742158c67c5e179a73f4b84698ae1a0 100644 --- a/www/templates/settings/settings.html +++ b/www/templates/settings/settings.html @@ -84,8 +84,6 @@ <!-- Allow extension here --> <cs-extension-point name="network"></cs-extension-point> - <span class="item item-divider" translate>SETTINGS.PLUGINS_SETTINGS</span> - <!-- Allow extension here --> <cs-extension-point name="plugins"></cs-extension-point>