diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index 5393dbf995ec01f9dae3cf96948854fc33c6a2cf..b44dd9051a5df736a6d2f1d8f53b31f6c35d2044 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -30,7 +30,7 @@ "LANGUAGE": "Language", "UNIVERSAL_DIVIDEND": "Universal dividend", "UD": "UD", - "DATE_PATTERN": "YYYY-MM-DD HH:mm", + "DATE_PATTERN": "MM/DD/YYYY HH:mm", "EMPTY_PARENTHESIS": "(empty)", "UID": "Pseudonym", "ENABLE": "Enable", diff --git a/www/js/app.js b/www/js/app.js index 8dffcf983d8f2ac54e686d804b6bc586d18d3a2a..dc9be0b474c0520a9776583fdaf42a7266dc3c98 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -210,7 +210,7 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngAnimate', $translate('COMMON.DATE_PATTERN') .then(function(datePattern) { $rootScope.datePattern = datePattern; - }) + }); }; // Set up moment translation diff --git a/www/js/config.js b/www/js/config.js index 255faaaba8b179206c54e6f1790aa4ffa092b22b..a5685437d8b16d8778b0bb485ca92c90129d946a 100644 --- a/www/js/config.js +++ b/www/js/config.js @@ -28,8 +28,8 @@ angular.module("cesium.config", []) "port": "9203" } }, - "version": "0.2.5", - "build": "2016-08-24T17:33:24.544Z", + "version": "0.2.6", + "build": "2016-08-25T06:51:00.355Z", "newIssueUrl": "https://github.com/duniter/cesium/issues/new?labels=bug" }) diff --git a/www/js/controllers/currency-controllers.js b/www/js/controllers/currency-controllers.js index e10bb250a238573ff0a4cf28a78abf38c8c24de1..582512381ae87c07ea71f2acc702800aef97f4ed 100644 --- a/www/js/controllers/currency-controllers.js +++ b/www/js/controllers/currency-controllers.js @@ -211,31 +211,31 @@ function CurrencyViewController($scope, $q, $translate, $timeout, BMA, UIUtils, ]) // Done - .then(function(){ - var Mprev = M - $scope.currentUD * $scope.Nprev; // remove fresh money - var MoverN = Mprev / $scope.Nprev; - $scope.cactual = 100 * $scope.currentUD / MoverN; - - if ($scope.formData.useRelative) { - $scope.M = Mprev / $scope.currentUD; - $scope.MoverN = MoverN / $scope.currentUD; - $scope.UD = 1; - } else { - $scope.M = Mprev; - $scope.MoverN = MoverN; - $scope.UD = $scope.currentUD; - } - // Set Ink - UIUtils.ink({selector: '.peer-item'}); + .then(function(){ + var Mprev = M - $scope.currentUD * $scope.Nprev; // remove fresh money + var MoverN = Mprev / $scope.Nprev; + $scope.cactual = 100 * $scope.currentUD / MoverN; + + if ($scope.formData.useRelative) { + $scope.M = Mprev / $scope.currentUD; + $scope.MoverN = MoverN / $scope.currentUD; + $scope.UD = 1; + } else { + $scope.M = Mprev; + $scope.MoverN = MoverN; + $scope.UD = $scope.currentUD; + } + // Set Ink + UIUtils.ink({selector: '.peer-item'}); - $scope.loading = false; + $scope.loading = false; - UIUtils.loading.hide(); - }) - .catch(function(err) { - $scope.loading = false; - UIUtils.onError('ERROR.LOAD_NODE_DATA_FAILED')(err); - }) + UIUtils.loading.hide(); + }) + .catch(function(err) { + $scope.loading = false; + UIUtils.onError('ERROR.LOAD_NODE_DATA_FAILED')(err); + }); }; $scope.refresh = function() { @@ -254,7 +254,7 @@ function CurrencyViewController($scope, $q, $translate, $timeout, BMA, UIUtils, $scope.loadingPeers = false; }); }); - } + }; $scope.onUseRelativeChanged = function() { if ($scope.loading) return; diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index c03ed7fad508f87e65d67f2b286b5dab37ff74c4..9e49fd55210a64b7f537da135c4236e81d4fb720 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -67,10 +67,10 @@ angular.module('cesium.bma.services', ['ngResource', 'cesium.http.services', 'ce pubkey: pubkey, uid: (uid ? uid : null) }; - }) + }); } - var getBlockchainWithUd = csHttp.getWithCache(host, port, '/blockchain/with/ud', csHttp.cache.SHORT) + var getBlockchainWithUd = csHttp.getWithCache(host, port, '/blockchain/with/ud', csHttp.cache.SHORT); var getBlockchainBlock = csHttp.getWithCache(host, port, '/blockchain/block/:block', csHttp.cache.SHORT); function getBlockchainLastUd() { diff --git a/www/js/services/http-services.js b/www/js/services/http-services.js index d044974d8c5ebb7b6fc4c8c1162a9692e5f66f6d..54b44dae4ba2d23c7c0e1853e53521a0673a695f 100644 --- a/www/js/services/http-services.js +++ b/www/js/services/http-services.js @@ -92,9 +92,9 @@ angular.module('cesium.http.services', ['ngResource', 'angular-cache']) maxAge: maxAge, deleteOnExpire: 'aggressive', recycleFreq: Math.max(maxAge - 1000, 5 * 60 * 1000 /*5min*/), - storageMode: + storageMode: 'memory' // FIXME : enable this when cache is cleaning on rollback - csSettings.data.useLocalStorage ? 'localStorage' : 'memory' + //csSettings.data.useLocalStorage ? 'localStorage' : 'memory' }); } else { @@ -107,9 +107,9 @@ angular.module('cesium.http.services', ['ngResource', 'angular-cache']) deleteOnExpire: 'aggressive', recycleFreq: maxAge, onExpire: onExpire, - storageMode: + storageMode: 'memory' // FIXME : enable this when cache is cleaning on rollback - csSettings.data.useLocalStorage ? 'localStorage' : 'memory' + //csSettings.data.useLocalStorage ? 'localStorage' : 'memory' }); } } @@ -123,7 +123,7 @@ angular.module('cesium.http.services', ['ngResource', 'angular-cache']) return $q(function(resolve, reject) { var config = { timeout: timeout - } + }; if (autoRefresh) { // redo the request if need config.cache = getOrCreateCache(maxAge, function (key, value) { console.debug('[http] Refreshing cache for ['+key+'] '); @@ -135,8 +135,7 @@ angular.module('cesium.http.services', ['ngResource', 'angular-cache']) } else { config.cache = getOrCreateCache(maxAge); - }; - + } prepare(url, params, config, function(url, config) { $http.get(url, config) diff --git a/www/js/services/network-services.js b/www/js/services/network-services.js index f497dc09414d9f19497a423cdb850e87c0f2000a..7fd749414167299322e5a362c94185916c3e04c1 100644 --- a/www/js/services/network-services.js +++ b/www/js/services/network-services.js @@ -196,7 +196,7 @@ angular.module('cesium.network.services', ['ngResource', 'ngApi', 'cesium.bma.se processPeer(peer); if (!data.updatingPeers) { sortPeers(); - }; + } }); }, @@ -211,20 +211,13 @@ angular.module('cesium.network.services', ['ngResource', 'ngApi', 'cesium.bma.se .then(function(peers){ resolve(peers); console.debug('[network] Started in '+(new Date().getTime() - now.getTime())+'ms'); - }) + }); }); - - // Add a destroy hook - if ($scope) { - $scope.$on('$destroy', function(){ - close(); - }); - } }, close = function() { if (data.bma) { - console.info('[network] Close'); + console.info('[network] Stopping'); data.bma.websocket.close(); resetData(); } diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index cd0c792c6a8764e4c4c8b677a8b87cbafc01fcac..dd61879a69a004fde77489cc9e17756d39fbc2ad 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -362,31 +362,29 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser var fromTime = nowInSec - csSettings.data.walletHistoryTimeSecond; var processedTxMap = {}; + var reduceTx = function(res){ + reduceTxAndPush(res.history.sent, txHistory, processedTxMap, true/*exclude pending*/); + reduceTxAndPush(res.history.received, txHistory, processedTxMap, true/*exclude pending*/); + reduceTxAndPush(res.history.sending, txHistory, processedTxMap, true/*exclude pending*/); + reduceTxAndPush(res.history.pending, txPendings, processedTxMap, false/*exclude pending*/); + }; + var jobs = [ // get pendings history BMA.tx.history.pending({pubkey: data.pubkey}) - .then(function(res){ - reduceTxAndPush(res.history.sending, txHistory, processedTxMap, true/*exclude pending*/); - reduceTxAndPush(res.history.pending, txPendings, processedTxMap, false/*exclude pending*/); - }) + .then(reduceTx) ]; // get TX history since var sliceTime = csSettings.data.walletHistorySliceSecond; for(var i = fromTime - (fromTime % sliceTime); i - sliceTime < nowInSec; i += sliceTime) { jobs.push(BMA.tx.history.times({pubkey: data.pubkey, from: i, to: i+sliceTime-1}) - .then(function(res){ - reduceTxAndPush(res.history.sent, txHistory, processedTxMap, true/*exclude pending*/); - reduceTxAndPush(res.history.received, txHistory, processedTxMap, true/*exclude pending*/); - }) + .then(reduceTx) ); } jobs.push(BMA.tx.history.timesNoCache({pubkey: data.pubkey, from: nowInSec - (nowInSec % sliceTime), to: nowInSec+999999999}) - .then(function(res){ - reduceTxAndPush(res.history.sent, txHistory, processedTxMap, true/*exclude pending*/); - reduceTxAndPush(res.history.received, txHistory, processedTxMap, true/*exclude pending*/); - })); + .then(reduceTx)); // get UD history if (csSettings.data.showUDHistory) { diff --git a/www/plugins/es/js/controllers/market-controllers.js b/www/plugins/es/js/controllers/market-controllers.js index 6747be3d59d5f533544e79b106515b0a10e374e7..a4940c215519cbcc731ed0eea3a0c6f997885149 100644 --- a/www/plugins/es/js/controllers/market-controllers.js +++ b/www/plugins/es/js/controllers/market-controllers.js @@ -414,21 +414,21 @@ function ESMarketRecordViewController($scope, $rootScope, Wallet, esMarket, UIUt } }); - // Continue loading other data - $q.all([ - // Load pictures - esMarket.record.picture.all({id: id}) - .then(function (hit) { - if (hit._source.pictures) { - $scope.pictures = hit._source.pictures.reduce(function (res, pic) { - return res.concat(UIUtils.image.fromAttachment(pic.file)); - }, []); - } - }), + // Continue loading other data + $q.all([ + // Load pictures + esMarket.record.picture.all({id: id}) + .then(function (hit) { + if (hit._source.pictures) { + $scope.pictures = hit._source.pictures.reduce(function (res, pic) { + return res.concat(UIUtils.image.fromAttachment(pic.file)); + }, []); + } + }), - // Load comments - $scope.loadComments(id) - ]) + // Load comments + $scope.loadComments(id) + ]) .then(function () { // Set Motion $timeout(function () { @@ -441,7 +441,7 @@ function ESMarketRecordViewController($scope, $rootScope, Wallet, esMarket, UIUt $scope.pictures = []; $scope.comments = []; }); - } + }; $scope.refreshConvertedPrice = function() { if (!$scope.formData.price) {