diff --git a/www/js/controllers/wallet-controllers.js b/www/js/controllers/wallet-controllers.js index ecc2d47e5070d977f84d702835ba1c55c2406dc6..d1cb02f3225af73d48de637d5623af7ca3b025f5 100644 --- a/www/js/controllers/wallet-controllers.js +++ b/www/js/controllers/wallet-controllers.js @@ -27,7 +27,8 @@ angular.module('cesium.wallet.controllers', ['cesium.services', 'cesium.currency } }, data: { - login: true + login: true, + silentLocationChange: true } }) @@ -521,7 +522,7 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state, } -function WalletTxController($scope, $ionicPopover, $state, $timeout, +function WalletTxController($scope, $ionicPopover, $state, $timeout, $location, UIUtils, Modals, BMA, csSettings, csWallet, csTx) { 'ngInject'; @@ -529,26 +530,32 @@ function WalletTxController($scope, $ionicPopover, $state, $timeout, $scope.settings = csSettings.data; $scope.$on('$ionicView.enter', function(e, state) { - if (!$scope.loading && (!state.stateParams || !state.stateParams.refresh)) { + $scope.loading = $scope.loading || (state.stateParams && state.stateParams.refresh); + if ($scope.loading) { + $scope.loadWallet() + .then(function (res) { + $scope.formData = res; + $scope.loading = false; // very important, to avoid TX to be display before wallet.currentUd is loaded + $scope.updateView(); + $scope.showFab('fab-transfer'); + $scope.showHelpTip(); + UIUtils.loading.hide(); // loading could have be open (e.g. new account) + + // remove the stateParams + if (state.stateParams && state.stateParams.refresh) { + $location.search({}).replace(); + } + }) + .catch(function (err) { + if (err == 'CANCELLED') { + $scope.showHome(); + } + }); + } + else { // Make sure to display new pending (e.g. sending using another screen button) $timeout($scope.updateView, 300); - return; // skip loading } - - $scope.loadWallet() - .then(function(res) { - $scope.formData = res; - $scope.loading=false; // very important, to avoid TX to be display before wallet.currentUd is loaded - $scope.updateView(); - $scope.showFab('fab-transfer'); - $scope.showHelpTip(); - UIUtils.loading.hide(); // loading could have be open (e.g. new account) - }) - .catch(function(err){ - if (err == 'CANCELLED') { - $scope.showHome(); - } - }); }); diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index 167cba3b8eeb03630e91937e6f88851e1f4e1271..9d1b36f03ac7ba2ff9cdbba62fbf97b3e919d9ec 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -950,7 +950,7 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, UI /** * Identity tx view controller */ -function WotIdentityTxViewController($scope, $timeout, $q, BMA, csSettings, csCurrency, csWot, csTx, UIUtils) { +function WotIdentityTxViewController($scope, $timeout, $q, BMA, csSettings, csWot, csTx, UIUtils) { 'ngInject'; $scope.formData= {}; @@ -972,13 +972,11 @@ function WotIdentityTxViewController($scope, $timeout, $q, BMA, csSettings, csCu // Load data $scope.load = function(fromTime) { return $q.all([ - csCurrency.get(), csWot.extend({pubkey: $scope.pubkey}), csTx.load($scope.pubkey, fromTime) ]) .then(function(res) { - $scope.currency = res[0]; - $scope.formData = angular.merge(res[1], res[2]); + $scope.formData = angular.merge(res[0], res[1]); $scope.loading = false; $scope.updateView(); }); diff --git a/www/js/services/currency-services.js b/www/js/services/currency-services.js index f156b0edb725c6fba91c614ff6f38ba714f40ecc..71698462244434b3b502144e1f3f628f582b5083 100644 --- a/www/js/services/currency-services.js +++ b/www/js/services/currency-services.js @@ -149,7 +149,9 @@ angular.module('cesium.currency.services', ['ngApi', 'cesium.bma.services']) function onBlock(json) { var block = new Block(json); block.cleanData(); // Remove unused content (arrays...) and keep items count - console.debug('[currency] Received new block', block); + + //console.debug('[currency] Received new block', block); + console.debug('[currency] Received new block [' + block.number + '-' + block.hash + ']'); data.currentBlock = block; data.currentBlock.receivedAt = new Date().getTime() / 1000;