ref style

This commit is contained in:
JDonadio 2017-09-11 14:50:14 -03:00
commit eba074fd63
No known key found for this signature in database
GPG key ID: EC1F4E04B2BFA730
6 changed files with 85 additions and 50 deletions

View file

@ -5,19 +5,20 @@ angular.module('copayApp.controllers').controller('cashScanController',
var wallet;
var errors = bwcService.getErrors();
$scope.error = null;
$scope.walletDisabled = '#667';
$scope.$on("$ionicView.enter", function(event, data) {
$scope.$on("$ionicView.beforeEnter", function(event, data) {
updateAllWallets();
});
var updateAllWallets = function() {
var wallets1 = profileService.getWallets({
var walletsBTC = profileService.getWallets({
coin: 'btc',
onlyComplete: true,
network: 'livenet'
});
if (lodash.isEmpty(wallets1)) {
if (lodash.isEmpty(walletsBTC)) {
$state.go('tabs.home');
return;
}
@ -29,18 +30,19 @@ angular.module('copayApp.controllers').controller('cashScanController',
});
var xPubKeyIndex = lodash.indexBy(walletsBCH, "credentials.xPubKey");
wallets1 = lodash.filter(wallets1, function(w) {
walletsBTC = lodash.filter(walletsBTC, function(w) {
return !xPubKeyIndex[w.credentials.xPubKey];
});
// Filter out non BIP44 wallets
var wallets = lodash.filter(wallets1, function(w) {
var wallets = lodash.filter(walletsBTC, function(w) {
return w.credentials.derivationStrategy == 'BIP44'
});
$scope.wallets = wallets;
$scope.nonBIP44 = wallets1.length != wallets.length;
$scope.nonBIP44Wallets = lodash.filter(walletsBTC, function(w) {
return w.credentials.derivationStrategy != 'BIP44';
});
var i = wallets.length;
var j = 0;
@ -49,23 +51,18 @@ angular.module('copayApp.controllers').controller('cashScanController',
coin: 'bch'
}, function(err, balance) {
if (err) {
wallet.error = (err === 'WALLET_NOT_REGISTERED') ? gettextCatalog.getString('Wallet not registered') : bwcError.msg(err);
$log.error(err);
return;
}
//
wallet.error = null;
wallet.bchBalance = txFormatService.formatAmountStr('bch', balance.availableAmount);
if (++j == i) {
//Done
$timeout(function() {
$rootScope.$apply();
}, 10);
}
});
});
@ -135,7 +132,7 @@ angular.module('copayApp.controllers').controller('cashScanController',
});
};
walletService.getKeys(wallet,function(err,keys) {
walletService.getKeys(wallet, function(err, keys) {
if (err) {
$scope.error = err;
return $timeout(function() {

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesCashController', function($scope, $log, $timeout, appConfigService, lodash, configService, gettextCatalog, externalLinkService) {
angular.module('copayApp.controllers').controller('preferencesCashController', function($scope, $log, $timeout, appConfigService, configService, gettextCatalog, externalLinkService) {
var updateConfig = function() {
var config = configService.getSync();
@ -36,7 +36,7 @@ angular.module('copayApp.controllers').controller('preferencesCashController', f
};
$scope.$on("$ionicView.enter", function(event, data) {
$scope.$on("$ionicView.beforeEnter", function(event, data) {
updateConfig();
});
});

View file

@ -0,0 +1,39 @@
#cash-scan {
.comment {
color: #667;
font-size: 0.9em;
}
.item {
color: $v-dark-gray;
padding-top: 1.3rem;
padding-bottom: 1.3rem;
}
.heading {
font-size: 17px;
color: $v-dark-gray;
margin: 1rem 0;
padding-top: 5px;
padding-bottom: 5px;
border: none;
}
.text-disabled {
color: $v-light-gray;
}
.supported {
display: flex;
.wallet-content {
padding-left: 7px;
}
}
.duplicate-button {
position: absolute;
right: 15px;
padding-top: .5rem;
}
}

View file

@ -50,3 +50,4 @@
@import "includes/pin";
@import "includes/logOptions";
@import "includes/checkBar";
@import "cashScan";

View file

@ -1,4 +1,4 @@
<ion-view id="other-balance" hide-tabs>
<ion-view id="cash-scan" hide-tabs>
<ion-nav-bar class="bar-royal">
<ion-nav-title>
<span translate>Bitcoin Cash (BCH) Balances</span>
@ -10,51 +10,49 @@
<ion-content>
<div class="list card">
<div class="item item-icon-right item-heading">
<div class="item" ng-if="(!wallets || !wallets[0]) && !nonBIP44Wallets[0]">
<span class="assertive" translate>No wallets eligible for Bitcoin Cash support</span>
</div>
<div class="item" ng-if="error">
<span class="assertive">{{error}}</span>
</div>
<div class="item heading">
<span translate>BTC Wallets</span>
</div>
<div ng-repeat="wallet in wallets track by $index" class="item wallet supported">
<i class="icon big-icon-svg">
<img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.coin == 'btc' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg wallet"/>
</i>
<div class="wallet-content">
<div>{{wallet.name || wallet.id}}</div>
<div class="balanced">{{wallet.bchBalance || ('Checking...' | translate)}} </div>
<div class="tab-home__wallet__multisig-number" ng-if="wallet.n > 1" translate>{{wallet.m}}-of-{{wallet.n}}</div>
</div>
<div class="item" ng-if="(!wallets || !wallets[0]) && !nonBIP44">
<span class="assertive" >No wallets elegible for Bitcoin Cash support</span>
<div class="duplicate-button">
<button ng-click="duplicate(wallet)" class="button button-small button-outline button-primary" translate>Duplicate for BCH</button>
</div>
</div>
<div ng-if="nonBIP44Wallets[0]">
<div class="item item-divider"></div>
<div class="item heading">
<span translate>Non eligible BTC wallets</span>
</div>
<div class="item" ng-if="error">
<span class="assertive" >{{error}}</span>
</div>
<div class="item" ng-if="nonBIP44">
<span class="assertive" translate>Some of you wallets are not elegible for Bitcon Cash support because there where created before Copay v1.2. Please use our recovery tool to access your Bitcoin Cash balance for those wallets</span>
</div>
<div>
<div ng-repeat="wallet in wallets track by $index"
class="item item-sub item-icon-left item-big-icon-left item-button-right wallet"
>
<div ng-repeat="wallet in nonBIP44Wallets track by $index" class="item item-sub item-icon-left item-big-icon-left item-button-right wallet">
<i class="icon big-icon-svg">
<img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.coin == 'btc' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg wallet"/>
<img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.coin == 'btc' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': walletDisabled}" class="bg wallet"/>
</i>
<span>
{{wallet.name || wallet.id}}
</span>
<p>
<span class="text-disabled">{{wallet.name || wallet.id}}</span>
</div>
<span class="balanced" > {{wallet.bchBalance || 'Checking...'}} </span>
<span class="tab-home__wallet__multisig-number" ng-if="wallet.n > 1">
{{wallet.m}}-of-{{wallet.n}}
</span>
&nbsp;
</p>
<div class="buttons">
<button ng-click="duplicate(wallet)" class="button button-small button-outline button-primary" translate>
Duplicate for BCH
</button>
</div>
<div class="item">
<span class="comment">Some of you wallets are not eligible for Bitcon Cash support because there where created before Copay v1.2. Please use our recovery tool to access your Bitcoin Cash balance for those wallets</span>
</div>
</div>
</div>

View file

@ -15,7 +15,7 @@
<div class="settings-explanation">
<div class="settings-description" ng-show="!cashSupport.value">
<span translate>Enable Bitcoin Cash wallet creation and operation within the App.</span>
<a ng-click="openBitcoinCashWeb()">Learn more</a>
<a ng-click="openBitcoinCashWeb()" translate>Learn more</a>
</div>
</div>
<div class="padding" ng-if="cashSupport.value">