@@ -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
0 commit comments