Split wallets by type (bitcoin and bitcoin cash)

This commit is contained in:
Gustavo Maximiliano Cortez 2017-10-05 15:18:30 -03:00
commit a853c17a0d
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
7 changed files with 76 additions and 41 deletions

View file

@ -28,7 +28,7 @@ angular.module('copayApp.controllers').controller('createController',
$scope.formData.bwsurl = defaults.bws.url;
$scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
$scope.formData.derivationPath = derivationPathHelper.default;
$scope.formData.coin = 'btc';
$scope.formData.coin = data.stateParams.coin;
if (config.cashSupport) $scope.enableCash = true;

View file

@ -16,7 +16,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.formData.bwsurl = defaults.bws.url;
$scope.formData.derivationPath = derivationPathHelper.default;
$scope.formData.account = 1;
$scope.formData.coin = 'btc';
$scope.formData.coin = $stateParams.coin;
$scope.importErr = false;
$scope.isCopay = appConfigService.name == 'copay';
$scope.fromHardwareWallet = {

View file

@ -11,7 +11,7 @@ angular.module('copayApp.controllers').controller('joinController',
$scope.formData.derivationPath = derivationPathHelper.default;
$scope.formData.account = 1;
$scope.formData.secret = null;
$scope.formData.coin = 'btc';
$scope.formData.coin = data.stateParams.coin;
if (config.cashSupport) $scope.enableCash = true;
resetPasswordFields();
updateSeedSourceSelect();

View file

@ -206,14 +206,24 @@ angular.module('copayApp.controllers').controller('tabHomeController',
};
var updateAllWallets = function() {
$scope.wallets = profileService.getWallets();
if (lodash.isEmpty($scope.wallets)) return;
var wallets = [];
$scope.walletsBtc = profileService.getWallets({coin: 'btc'});
$scope.walletsBch = profileService.getWallets({coin: 'bch'});
var i = $scope.wallets.length;
lodash.each($scope.walletsBtc, function(wBtc) {
wallets.push(wBtc);
});
lodash.each($scope.walletsBch, function(wBch) {
wallets.push(wBch);
});
if (lodash.isEmpty(wallets)) return;
var i = wallets.length;
var j = 0;
var timeSpan = 60 * 60 * 24 * 7;
lodash.each($scope.wallets, function(wallet) {
lodash.each(wallets, function(wallet) {
walletService.getStatus(wallet, {}, function(err, status) {
if (err) {

View file

@ -329,6 +329,9 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
'tab-home@tabs': {
templateUrl: 'views/add.html'
}
},
params: {
coin: 'btc'
}
})
.state('tabs.add.join', {

View file

@ -0,0 +1,22 @@
<i class="icon big-icon-svg" ng-include="'views/includes/walletIcon.html'"></i>
<span>
{{wallet.name || wallet.id}}
</span>
<p>
<span ng-if="!wallet.isComplete()" class="assertive" translate>
Incomplete
</span>
<span ng-if="wallet.isComplete()">
<span ng-if="!wallet.balanceHidden && !wallet.scanning"> {{wallet.status.totalBalanceStr ? wallet.status.totalBalanceStr : ( wallet.cachedBalance ? wallet.cachedBalance + (wallet.cachedBalanceUpdatedOn ? ' &middot; ' + ( wallet.cachedBalanceUpdatedOn * 1000 | amTimeAgo) : '') : '' ) }} </span>
<span ng-if="wallet.scanning" translate> Scanning funds... </span>
<span ng-if="wallet.balanceHidden && !wallet.scanning" translate>[Balance Hidden]</span>
<span class="tab-home__wallet__multisig-number" ng-if="wallet.n > 1">
{{wallet.m}}-of-{{wallet.n}}
</span>
<i ng-if="!wallet.balanceHidden && (wallet.status.totalBalanceSat != wallet.status.spendableAmount)" class="tab-home__wallet__status-icon ion-ios-timer-outline"></i>
<span class="assertive" ng-if="wallet.error">{{wallet.error}}</span>
</span>
&nbsp;
</p>
<i class="icon bp-arrow-right"></i>

View file

@ -64,49 +64,49 @@
</a>
</div>
<div class="list card">
<div class="list card" ng-if="!walletsBtc[0] && !walletsBch[0]">
<div class="item item-icon-right item-heading">
<span translate>Wallets</span>
<a ui-sref="tabs.add" ng-if="wallets[0]"><i class="icon ion-ios-plus-empty list-add-button"></i></a>
</div>
<div>
<a ng-if="!wallets[0]" ui-sref="tabs.add" class="item item-icon-left item-big-icon-left item-icon-right next-step">
<a ui-sref="tabs.add" class="item item-icon-left item-big-icon-left item-icon-right next-step">
<i class="icon big-icon-svg">
<img src="img/icon-wallet.svg" class="bg wallet icon-create-wallet"/>
</i>
<span translate>Create bitcoin wallet</span>
<i class="icon bp-arrow-right"></i>
</a>
<a ng-repeat="wallet in wallets track by $index"
</div>
<div class="list card" ng-if="walletsBtc[0]">
<div class="item item-icon-right item-heading">
<span translate>Bitcoin Wallets</span>
<a ui-sref="tabs.add"><i class="icon ion-ios-plus-empty list-add-button"></i></a>
</div>
<div>
<a ng-repeat="wallet in walletsBtc track by $index"
class="item item-sub item-icon-left item-big-icon-left item-icon-right wallet"
ng-click="openWallet(wallet)">
<i class="icon big-icon-svg" ng-include="'views/includes/walletIcon.html'"></i>
<span>
{{wallet.name || wallet.id}}
</span>
<p>
<span ng-if="!wallet.isComplete()" class="assertive" translate>
Incomplete
</span>
<span ng-if="wallet.isComplete()">
<span ng-if="!wallet.balanceHidden && !wallet.scanning"> {{wallet.status.totalBalanceStr ? wallet.status.totalBalanceStr : ( wallet.cachedBalance ? wallet.cachedBalance + (wallet.cachedBalanceUpdatedOn ? ' &middot; ' + ( wallet.cachedBalanceUpdatedOn * 1000 | amTimeAgo) : '') : '' ) }} </span>
<span ng-if="wallet.scanning" translate> Scanning funds... </span>
<span ng-if="wallet.balanceHidden && !wallet.scanning" translate>[Balance Hidden]</span>
<span class="tab-home__wallet__multisig-number" ng-if="wallet.n > 1">
{{wallet.m}}-of-{{wallet.n}}
</span>
<i ng-if="!wallet.balanceHidden && (wallet.status.totalBalanceSat != wallet.status.spendableAmount)" class="tab-home__wallet__status-icon ion-ios-timer-outline"></i>
<span class="assertive" ng-if="wallet.error">{{wallet.error}}</span>
</span>
&nbsp;
</p>
<i class="icon bp-arrow-right"></i>
<span ng-include="'views/includes/walletList.html'"></span>
</a>
</div>
</div>
<div class="ng-hide list card" ng-show="wallets[0] && bitpayCardItems.length>0" ng-include="'views/includes/bitpayCardsCard.html'"></div>
<div class="ng-hide list card" ng-show="wallets[0] && buyAndSellItems.length>0" ng-include="'views/includes/buyAndSellCard.html'"></div>
<div class="list card" ng-if="walletsBch[0]">
<div class="item item-icon-right item-heading">
<span translate>Bitcoin Cash Wallets</span>
<a ui-sref="tabs.add({coin:'bch'})"><i class="icon ion-ios-plus-empty list-add-button"></i></a>
</div>
<div>
<a ng-repeat="wallet in walletsBch track by $index"
class="item item-sub item-icon-left item-big-icon-left item-icon-right wallet"
ng-click="openWallet(wallet)">
<span ng-include="'views/includes/walletList.html'"></span>
</a>
</div>
</div>
<div class="ng-hide list card" ng-show="walletsBtc[0] && bitpayCardItems.length>0" ng-include="'views/includes/bitpayCardsCard.html'"></div>
<div class="ng-hide list card" ng-show="walletsBtc[0] && buyAndSellItems.length>0" ng-include="'views/includes/buyAndSellCard.html'"></div>
<div class="ng-hide list card" ng-show="homeIntegrations.length>0" ng-include="'views/includes/homeIntegrations.html'"></div>
<div class="ng-hide list card" ng-show="nextStepsItems.length>0 && !isWindowsPhoneApp" ng-include="'views/includes/nextSteps.html'"></div>