Skip to content
Snippets Groups Projects
Commit a208ec87 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] wallet refresh options

[fix] change log when receiving new block
parent 7177a6d0
No related branches found
No related tags found
No related merge requests found
......@@ -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();
}
});
});
......
......@@ -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();
});
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment