Skip to content

Commit a208ec8

Browse files
committed
[fix] wallet refresh options
[fix] change log when receiving new block
1 parent 7177a6d commit a208ec8

File tree

3 files changed

+31
-24
lines changed

3 files changed

+31
-24
lines changed

www/js/controllers/wallet-controllers.js

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ angular.module('cesium.wallet.controllers', ['cesium.services', 'cesium.currency
2727
}
2828
},
2929
data: {
30-
login: true
30+
login: true,
31+
silentLocationChange: true
3132
}
3233
})
3334

@@ -521,34 +522,40 @@ function WalletController($scope, $rootScope, $q, $ionicPopup, $timeout, $state,
521522
}
522523

523524

524-
function WalletTxController($scope, $ionicPopover, $state, $timeout,
525+
function WalletTxController($scope, $ionicPopover, $state, $timeout, $location,
525526
UIUtils, Modals, BMA, csSettings, csWallet, csTx) {
526527
'ngInject';
527528

528529
$scope.loading = true;
529530
$scope.settings = csSettings.data;
530531

531532
$scope.$on('$ionicView.enter', function(e, state) {
532-
if (!$scope.loading && (!state.stateParams || !state.stateParams.refresh)) {
533+
$scope.loading = $scope.loading || (state.stateParams && state.stateParams.refresh);
534+
if ($scope.loading) {
535+
$scope.loadWallet()
536+
.then(function (res) {
537+
$scope.formData = res;
538+
$scope.loading = false; // very important, to avoid TX to be display before wallet.currentUd is loaded
539+
$scope.updateView();
540+
$scope.showFab('fab-transfer');
541+
$scope.showHelpTip();
542+
UIUtils.loading.hide(); // loading could have be open (e.g. new account)
543+
544+
// remove the stateParams
545+
if (state.stateParams && state.stateParams.refresh) {
546+
$location.search({}).replace();
547+
}
548+
})
549+
.catch(function (err) {
550+
if (err == 'CANCELLED') {
551+
$scope.showHome();
552+
}
553+
});
554+
}
555+
else {
533556
// Make sure to display new pending (e.g. sending using another screen button)
534557
$timeout($scope.updateView, 300);
535-
return; // skip loading
536558
}
537-
538-
$scope.loadWallet()
539-
.then(function(res) {
540-
$scope.formData = res;
541-
$scope.loading=false; // very important, to avoid TX to be display before wallet.currentUd is loaded
542-
$scope.updateView();
543-
$scope.showFab('fab-transfer');
544-
$scope.showHelpTip();
545-
UIUtils.loading.hide(); // loading could have be open (e.g. new account)
546-
})
547-
.catch(function(err){
548-
if (err == 'CANCELLED') {
549-
$scope.showHome();
550-
}
551-
});
552559
});
553560

554561

www/js/controllers/wot-controllers.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ function WotIdentityViewController($scope, $rootScope, $controller, $timeout, UI
950950
/**
951951
* Identity tx view controller
952952
*/
953-
function WotIdentityTxViewController($scope, $timeout, $q, BMA, csSettings, csCurrency, csWot, csTx, UIUtils) {
953+
function WotIdentityTxViewController($scope, $timeout, $q, BMA, csSettings, csWot, csTx, UIUtils) {
954954
'ngInject';
955955

956956
$scope.formData= {};
@@ -972,13 +972,11 @@ function WotIdentityTxViewController($scope, $timeout, $q, BMA, csSettings, csCu
972972
// Load data
973973
$scope.load = function(fromTime) {
974974
return $q.all([
975-
csCurrency.get(),
976975
csWot.extend({pubkey: $scope.pubkey}),
977976
csTx.load($scope.pubkey, fromTime)
978977
])
979978
.then(function(res) {
980-
$scope.currency = res[0];
981-
$scope.formData = angular.merge(res[1], res[2]);
979+
$scope.formData = angular.merge(res[0], res[1]);
982980
$scope.loading = false;
983981
$scope.updateView();
984982
});

www/js/services/currency-services.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ angular.module('cesium.currency.services', ['ngApi', 'cesium.bma.services'])
149149
function onBlock(json) {
150150
var block = new Block(json);
151151
block.cleanData(); // Remove unused content (arrays...) and keep items count
152-
console.debug('[currency] Received new block', block);
152+
153+
//console.debug('[currency] Received new block', block);
154+
console.debug('[currency] Received new block [' + block.number + '-' + block.hash + ']');
153155

154156
data.currentBlock = block;
155157
data.currentBlock.receivedAt = new Date().getTime() / 1000;

0 commit comments

Comments
 (0)