• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

blockchain / My-Wallet-V3-Frontend / 11626

pending completion
11626

push

travis-ci

web-flow
Merge pull request #1461 from blockchain/v1.33-release

v1.33 release

1586 of 3398 branches covered (46.67%)

113 of 113 new or added lines in 23 files covered. (100.0%)

5317 of 8025 relevant lines covered (66.26%)

76.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.73
/assets/js/controllers/home.controller.js
1
angular
1✔
2
  .module('walletApp')
3
  .controller('HomeCtrl', HomeCtrl);
4

5
let enumify = (...ns) => ns.reduce((e, n, i) => angular.merge(e, {[n]: i}), {});
1✔
6

7
function HomeCtrl ($rootScope, $scope, MyWallet, Wallet, Ethereum, BitcoinCash, Env, tradeStatus, localStorageService, currency, modals, $state, sfox, accounts) {
1✔
8
  $scope.btc = {
7✔
9
    total: () => Wallet.total('') || 0,
1!
10
    accounts: MyWallet.wallet.hdwallet && MyWallet.wallet.hdwallet.accounts
14✔
11
  };
12

13
  $scope.eth = {
7✔
14
    total: () => Ethereum.balance || 0
1✔
15
  };
16

17
  $scope.bch = {
7✔
18
    total: () => BitcoinCash.balance || 0,
1!
19
    accounts: BitcoinCash.accounts
20
  };
21

22
  $scope.hasBalance = (currencies) => {
7✔
23
    let total = 0;
×
24
    currencies.forEach((currency) => total += parseFloat($scope[currency].total()));
×
25
    return total > 0;
×
26
  };
27

28
  $scope.isWalletInitialized = () => {
7✔
29
    let { isLoggedIn, didLoadSettings, didLoadTransactions } = Wallet.status;
1✔
30
    return isLoggedIn && didLoadSettings && (didLoadTransactions || !Wallet.isUpgradedToHD);
1!
31
  };
32

33
  $scope.activeLegacyAddresses = () => (
7✔
34
    Wallet.status.isLoggedIn
2✔
35
      ? Wallet.legacyAddresses().filter(a => !a.archived)
1✔
36
      : null
37
  );
38

39
  $scope.activeAccounts = () => (
7✔
40
    Wallet.status.isLoggedIn
2✔
41
      ? Wallet.accounts().filter(a => !a.archived)
4✔
42
      : null
43
  );
44

45
  $scope.showMobileConversion = () => {
7✔
46
    const showMobileConversion = localStorageService.get('showMobileConversion');
1✔
47
    if (showMobileConversion === false) {
1!
48
      return false;
×
49
    } else {
50
      return true;
1✔
51
    }
52
  };
53

54
  $scope.goToShiftWithDestination = (dest) => {
7✔
55
    $state.go('wallet.common.shift', { destination: dest });
×
56
  };
57

58
  $scope.toggleDisplayCurrency = Wallet.toggleDisplayCurrency;
7✔
59
  $scope.openRequest = modals.openRequest;
7✔
60

61
  // ensure all recent transactions are reflected in activity widget
62
  $rootScope.$emit('updateActivityFeed');
7✔
63

64
  $scope.exchange = MyWallet.wallet && MyWallet.wallet.external && MyWallet.wallet.external.sfox;
7✔
65

66
  // SFOX signup
67
  $scope.steps = enumify('create', 'verify', 'upload', 'link');
7✔
68
  $scope.displaySteps = ['create', 'verify', 'upload', 'link'];
7✔
69
  $scope.onOrAfterStep = (s) => $scope.afterStep(s) || $scope.onStep(s);
7!
70
  $scope.afterStep = (s) => $scope.step > $scope.steps[s];
7✔
71
  $scope.onStep = (s) => $scope.steps[s] === $scope.step;
7✔
72
  $scope.goTo = (s) => {
7✔
73
    $scope.step = $scope.steps[s];
×
74
  };
75

76
  sfox.accounts = accounts;
7✔
77

78
  let calcSfoxStep = () => {
7✔
79
    if (!$scope.sfoxAvailable || (sfox.activeAccount && sfox.profile.verificationStatus.level === 'pending' && !sfox.profile.verificationStatus.required_docs.length)) {
7!
80
      $scope.showSfoxRegistration = false;
7✔
81
    } else {
82
      $scope.showSfoxRegistration = true;
×
83
      $scope.goTo(sfox.determineStep($scope.exchange));
×
84
    }
85
  };
86

87
  calcSfoxStep();
7✔
88

89
  Env.then((env) => {
7✔
90
    let accountInfo = MyWallet.wallet.accountInfo;
×
91
    let sfoxAvailableToUser = env.partners.sfox.countries.indexOf(accountInfo.countryCodeGuess) > -1 && env.partners.sfox.states.indexOf(accountInfo.stateCodeGuess) > -1;
×
92

93
    tradeStatus.canTrade().then(canTrade => {
×
94
      $scope.canBuy = canTrade && !sfoxAvailableToUser;
×
95
      $scope.sfoxAvailable = canTrade && sfoxAvailableToUser;
×
96

97
      if ($scope.sfoxAvailable) {
×
98
        calcSfoxStep();
×
99
      }
100
    });
101
  });
102
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc