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

blockchain / My-Wallet-V3-Frontend / 11551

pending completion
11551

Pull #1473

travis-ci

web-flow
organizing styles and translations
Pull Request #1473: Update home page to display SFOX signup process

1563 of 3377 branches covered (46.28%)

19 of 19 new or added lines in 1 file covered. (100.0%)

5266 of 7990 relevant lines covered (65.91%)

76.13 hits per line

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

55.1
/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 ($scope, MyWallet, Wallet, Ethereum, BitcoinCash, Env, tradeStatus, localStorageService, currency, modals, $state, sfox) {
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
  $scope.exchange = MyWallet.wallet.external.sfox;
7✔
61

62
  // SFOX signup
63
  $scope.steps = enumify('create', 'verify', 'upload', 'link');
×
64
  $scope.displaySteps = ['create', 'verify', 'upload', 'link'];
×
65
  $scope.onOrAfterStep = (s) => $scope.afterStep(s) || $scope.onStep(s);
×
66
  $scope.afterStep = (s) => $scope.step > $scope.steps[s];
×
67
  $scope.onStep = (s) => $scope.steps[s] === $scope.step;
×
68
  $scope.goTo = (s) => { $scope.step = $scope.steps[s]; };
×
69

70
  if ($scope.exchange.user && !$scope.exchange.profile) {
×
71
    $scope.exchange.fetchProfile().then(() => {
×
72
      $scope.goTo(sfox.determineStep($scope.exchange))
×
73
    });
74
  } else {
75
    $scope.goTo(sfox.determineStep($scope.exchange))
×
76
  }
77

78
  Env.then((env) => {
×
79
    let accountInfo = MyWallet.wallet.accountInfo;
×
80
    let sfoxAvailableToUser = env.partners.sfox.countries.indexOf(accountInfo.countryCodeGuess) > -1 && env.partners.sfox.states.indexOf(accountInfo.stateCodeGuess) > -1;
×
81

82
    tradeStatus.canTrade().then(canTrade => {
×
83
      $scope.canBuy = canTrade && !sfoxAvailableToUser;
×
84

85
      if (canTrade && sfoxAvailableToUser && !(sfox.profile && sfox.verified)) {
×
86
        $scope.showSfoxRegistration = true;
×
87
      }
88
    });
89
  });
90
}
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