Skip to content
Snippets Groups Projects
Select Git revision
  • 49cadf5fcad66629d877ab8d8ce7625d8efe0b1c
  • master default protected
  • chrome-manifest-v3
  • feature/migrate-cordova-13
  • feat/improve-network-scan
  • feat/force-migration-check
  • develop
  • feature/encrypted_comment
  • feature/android_api_19
  • gitlab_migration_1
  • rml8
  • v1.7.15-rc1
  • v1.7.14
  • v1.7.13
  • v1.7.12
  • v1.7.11
  • v1.7.10
  • v1.7.9
  • v1.7.8
  • v1.7.7
  • v1.7.6
  • v1.7.5
  • v1.7.4
  • v1.7.3
  • v1.7.2
  • v1.7.1
  • v1.7.0
  • v1.7.0-rc2
  • v1.7.0-rc1
  • v1.6.12
  • v1.6.11
31 results

wallet-controllers.js

Blame
  • wallet-controllers.js 11.38 KiB
    
    angular.module('cesium.wallet.controllers', ['cesium.services', 'cesium.currency.controllers'])
    
      .config(function($stateProvider) {
        'ngInject';
        $stateProvider
    
          .state('app.view_wallet', {
            url: "/wallet",
            views: {
              'menuContent': {
                templateUrl: "templates/wallet/view_wallet.html",
                controller: 'WalletCtrl'
              }
            }
          })
    
          .state('app.view_wallet_tx_errors', {
            url: "/wallet/tx/errors",
            views: {
              'menuContent': {
                templateUrl: "templates/wallet/view_wallet_tx_error.html",
                controller: 'WalletTxErrorCtrl'
              }
            }
          })
        ;
      })
    
      .controller('WalletCtrl', WalletController)
    
      .controller('WalletTxErrorCtrl', WalletTxErrorController)
    ;
    
    function WalletController($scope, $q, $ionicPopup, $timeout, $state, $ionicHistory, screenmatch,
      UIUtils, Wallet, $translate, $ionicPopover, Modals, csSettings, BMA) {
      'ngInject';
    
      $scope.walletData = null;
      $scope.convertedBalance = null;
      $scope.hasCredit = false;
      $scope.showDetails = false;
      $scope.loading = true;
    
      $scope.$on('$ionicView.enter', function() {
        $scope.loadWallet()
          .then(function(walletData) {
            $scope.walletData = walletData;
            $scope.updateView();
            $scope.loading=false;
            $scope.showFab('fab-transfer');
            $scope.showQRCode('qrcode', walletData.pubkey, 1100);
            UIUtils.loading.hide(); // loading could have be open (e.g. new account)
          })
          .catch(function(err){
            if ('CANCELLED' === err) {
              $ionicHistory.nextViewOptions({
                historyRoot: true
              });
              $state.go('app.home');
            }
          });
      });
    
      $ionicPopover.fromTemplateUrl('templates/wallet/popover_actions.html', {
        scope: $scope
      }).then(function(popover) {
        $scope.actionsPopover = popover;
      });